Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve appearance of Twitch emotes in popup #5632

Merged
merged 7 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
- Bugfix: Fixed splits staying paused after unfocusing Chatterino in certain configurations. (#5504, #5637)
- Bugfix: Links with invalid characters in the domain are no longer detected. (#5509)
- Bugfix: Fixed janky selection for messages with RTL segments (selection is still wrong, but consistently wrong). (#5525)
- Bugfix: Fixed event emotes not showing up in autocomplete and popups. (#5239, #5580, #5582)
- Bugfix: Fixed event emotes not showing up in autocomplete and popups. (#5239, #5580, #5582, #5632)
- Bugfix: Fixed tab visibility being controllable in the emote popup. (#5530)
- Bugfix: Fixed account switch not being saved if no other settings were changed. (#5558)
- Bugfix: Fixed some tooltips not being readable. (#5578)
Expand Down
15 changes: 6 additions & 9 deletions src/providers/twitch/TwitchEmotes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,17 +494,14 @@ TwitchEmoteSetMeta getTwitchEmoteSetMeta(const HelixChannelEmote &emote)
return u"x-c2-globals"_s;
}

if (!emote.setID.isEmpty())
// some bit emote-sets have an id, but we want to combine them into a
// single set
if (isBits)
{
return emote.setID;
return TWITCH_BIT_EMOTE_SET_PREFIX % emote.ownerID;
}

if (isSub)
{
return TWITCH_SUB_EMOTE_SET_PREFIX % emote.ownerID;
}
// isBits
return TWITCH_BIT_EMOTE_SET_PREFIX % emote.ownerID;
// isSub
return TWITCH_SUB_EMOTE_SET_PREFIX % emote.ownerID;
Comment on lines +497 to +504
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just relaized I could make this more readable by checking bits/subs first, but let's see if this works at all

}();

return {
Expand Down
25 changes: 16 additions & 9 deletions src/widgets/dialogs/EmotePopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,25 +136,32 @@ void addTwitchEmoteSets(const std::shared_ptr<const EmoteMap> &local,
MessageElementFlag::TwitchEmote);
}

// Put current channel emotes at the top
std::vector<
std::pair<QString, std::reference_wrapper<const TwitchEmoteSet>>>
sortedSets;
sortedSets.reserve(sets->size());
for (const auto &[_id, set] : *sets)
{
if (set.owner->id == currentChannelID)
{
// Put current channel emotes at the top
addEmotes(subChannel, set.emotes, set.title(),
MessageElementFlag::TwitchEmote);
}
}

for (const auto &[id, set] : *sets)
{
if (set.owner->id == currentChannelID)
else
{
continue;
sortedSets.emplace_back(set.title(), std::cref(set));
}
}

std::ranges::sort(sortedSets, [](const auto &a, const auto &b) {
return a.first.compare(b.first, Qt::CaseInsensitive) < 0;
});

addEmotes(set.isSubLike ? subChannel : globalChannel, set.emotes,
set.title(), MessageElementFlag::TwitchEmote);
for (const auto &[title, set] : sortedSets)
{
addEmotes(set.get().isSubLike ? subChannel : globalChannel,
set.get().emotes, title, MessageElementFlag::TwitchEmote);
}
}

Expand Down
Loading