mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Combined emotes of different tiers in Emote Popup.
This commit is contained in:
parent
31b9d497d7
commit
71a51d34c7
1 changed files with 20 additions and 4 deletions
|
@ -48,19 +48,26 @@ namespace {
|
|||
std::vector<std::shared_ptr<TwitchAccount::EmoteSet>> sets,
|
||||
Channel &globalChannel, Channel &subChannel)
|
||||
{
|
||||
for (const auto &set : sets) {
|
||||
auto &channel = set->key == "0" ? globalChannel : subChannel;
|
||||
QMap<QString, QPair<bool, std::vector<MessagePtr>>> mapOfSets;
|
||||
|
||||
for (const auto &set : sets) {
|
||||
// TITLE
|
||||
auto channelName = set->channelName;
|
||||
auto text =
|
||||
set->key == "0" || set->text.isEmpty() ? "Twitch" : set->text;
|
||||
channel.addMessage(makeTitleMessage(text));
|
||||
|
||||
// EMOTES
|
||||
MessageBuilder builder;
|
||||
builder->flags.set(MessageFlag::Centered);
|
||||
builder->flags.set(MessageFlag::DisableCompactEmotes);
|
||||
|
||||
// If value of map is empty, create init pair and add title.
|
||||
if (mapOfSets.find(channelName) == mapOfSets.end()) {
|
||||
std::vector<MessagePtr> b;
|
||||
b.push_back(makeTitleMessage(text));
|
||||
mapOfSets[channelName] = qMakePair(set->key == "0", b);
|
||||
}
|
||||
|
||||
for (const auto &emote : set->emotes) {
|
||||
builder
|
||||
.emplace<EmoteElement>(
|
||||
|
@ -70,7 +77,16 @@ namespace {
|
|||
->setLink(Link(Link::InsertText, emote.name.string));
|
||||
}
|
||||
|
||||
channel.addMessage(builder.release());
|
||||
mapOfSets[channelName].second.push_back(builder.release());
|
||||
}
|
||||
|
||||
// Output to channel all created messages,
|
||||
// That contain title or emotes.
|
||||
foreach (auto pair, mapOfSets) {
|
||||
auto &channel = pair.first ? globalChannel : subChannel;
|
||||
for (auto message : pair.second) {
|
||||
channel.addMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
|
Loading…
Reference in a new issue