put the account emotes into groups

This commit is contained in:
fourtf 2018-05-31 16:20:46 +02:00
parent 85505a055d
commit a3e4c92b9f
2 changed files with 31 additions and 4 deletions

View file

@ -442,6 +442,7 @@ void EmoteManager::refreshTwitchEmotes(const std::shared_ptr<TwitchAccount> &use
[=, &emoteData](const QJsonObject &root) { [=, &emoteData](const QJsonObject &root) {
emoteData.emoteSets.clear(); emoteData.emoteSets.clear();
emoteData.emoteCodes.clear(); emoteData.emoteCodes.clear();
auto emoticonSets = root.value("emoticon_sets").toObject(); auto emoticonSets = root.value("emoticon_sets").toObject();
for (QJsonObject::iterator it = emoticonSets.begin(); it != emoticonSets.end(); ++it) { for (QJsonObject::iterator it = emoticonSets.begin(); it != emoticonSets.end(); ++it) {
std::string emoteSetString = it.key().toStdString(); std::string emoteSetString = it.key().toStdString();

View file

@ -22,9 +22,9 @@ EmotePopup::EmotePopup()
this->viewEmotes = new ChannelView(); this->viewEmotes = new ChannelView();
this->viewEmojis = new ChannelView(); this->viewEmojis = new ChannelView();
this->viewEmotes->setOverrideFlags((MessageElement::Flags)( this->viewEmotes->setOverrideFlags(MessageElement::Flags(
MessageElement::Default | MessageElement::AlwaysShow | MessageElement::EmoteImages)); MessageElement::Default | MessageElement::AlwaysShow | MessageElement::EmoteImages));
this->viewEmojis->setOverrideFlags((MessageElement::Flags)( this->viewEmojis->setOverrideFlags(MessageElement::Flags(
MessageElement::Default | MessageElement::AlwaysShow | MessageElement::EmoteImages)); MessageElement::Default | MessageElement::AlwaysShow | MessageElement::EmoteImages));
this->viewEmotes->setEnableScrollingToBottom(false); this->viewEmotes->setEnableScrollingToBottom(false);
@ -86,8 +86,34 @@ void EmotePopup::loadChannel(ChannelPtr _channel)
QString userID = app->accounts->twitch.getCurrent()->getUserId(); QString userID = app->accounts->twitch.getCurrent()->getUserId();
addEmotes(app->emotes->twitchAccountEmotes[userID.toStdString()].emotes, // fourtf: the entire emote manager needs to be refactored so there's no point in trying to
"Twitch Account Emotes", "Twitch Account Emote"); // fix this pile of garbage
for (const auto &set : app->emotes->twitchAccountEmotes[userID.toStdString()].emoteSets) {
// TITLE
messages::MessageBuilder builder1;
builder1.append(new TextElement("Twitch Account Emotes", MessageElement::Text));
builder1.getMessage()->flags |= Message::Centered;
emoteChannel->addMessage(builder1.getMessage());
// EMOTES
messages::MessageBuilder builder2;
builder2.getMessage()->flags |= Message::Centered;
builder2.getMessage()->flags |= Message::DisableCompactEmotes;
for (const auto &emote : set.second) {
[&](const QString &key, const util::EmoteData &value) {
builder2.append((new EmoteElement(value, MessageElement::Flags::AlwaysShow))
->setLink(Link(Link::InsertText, key)));
}(QString::fromStdString(emote.code),
app->emotes->getTwitchEmoteById(QString::fromStdString(emote.id).toLong(),
QString::fromStdString(emote.code)));
}
emoteChannel->addMessage(builder2.getMessage());
}
addEmotes(app->emotes->bttvGlobalEmotes, "BetterTTV Global Emotes", "BetterTTV Global Emote"); addEmotes(app->emotes->bttvGlobalEmotes, "BetterTTV Global Emotes", "BetterTTV Global Emote");
addEmotes(*channel->bttvChannelEmotes.get(), "BetterTTV Channel Emotes", addEmotes(*channel->bttvChannelEmotes.get(), "BetterTTV Channel Emotes",
"BetterTTV Channel Emote"); "BetterTTV Channel Emote");