chore: improve appearance of Twitch emotes in popup (#5632)

This commit is contained in:
nerix
2024-10-13 12:08:32 +02:00
committed by GitHub
parent 64864a0901
commit 3e2116629a
3 changed files with 23 additions and 19 deletions
+16 -9
View File
@@ -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);
}
else
{
sortedSets.emplace_back(set.title(), std::cref(set));
}
}
for (const auto &[id, set] : *sets)
{
if (set.owner->id == currentChannelID)
{
continue;
}
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);
}
}