Make FFZEmotes fully conform and use QString instead of std::string

This commit is contained in:
Rasmus Karlsson 2018-06-07 13:09:33 +02:00
parent 6906d1dc1c
commit 63c38c02d0
3 changed files with 10 additions and 10 deletions

View file

@ -54,7 +54,7 @@ void FFZEmotes::loadGlobalEmotes()
req.getJSON([this](QJsonObject &root) { req.getJSON([this](QJsonObject &root) {
auto sets = root.value("sets").toObject(); auto sets = root.value("sets").toObject();
std::vector<std::string> codes; std::vector<QString> codes;
for (const QJsonValue &set : sets) { for (const QJsonValue &set : sets) {
auto emoticons = set.toObject().value("emoticons").toArray(); auto emoticons = set.toObject().value("emoticons").toArray();
@ -71,7 +71,7 @@ void FFZEmotes::loadGlobalEmotes()
QString("https://www.frankerfacez.com/emoticon/%1-%2").arg(id).arg(code); QString("https://www.frankerfacez.com/emoticon/%1-%2").arg(id).arg(code);
this->globalEmotes.insert(code, emoteData); this->globalEmotes.insert(code, emoteData);
codes.push_back(code.toStdString()); codes.push_back(code);
} }
this->globalEmoteCodes = codes; this->globalEmoteCodes = codes;
@ -99,7 +99,7 @@ void FFZEmotes::loadChannelEmotes(const QString &channelName, std::weak_ptr<util
auto setsNode = rootNode.value("sets").toObject(); auto setsNode = rootNode.value("sets").toObject();
std::vector<std::string> codes; std::vector<QString> codes;
for (const QJsonValue &setNode : setsNode) { for (const QJsonValue &setNode : setsNode) {
auto emotesNode = setNode.toObject().value("emoticons").toArray(); auto emotesNode = setNode.toObject().value("emoticons").toArray();
@ -123,10 +123,10 @@ void FFZEmotes::loadChannelEmotes(const QString &channelName, std::weak_ptr<util
this->channelEmotes.insert(code, emote); this->channelEmotes.insert(code, emote);
map->insert(code, emote); map->insert(code, emote);
codes.push_back(code.toStdString()); codes.push_back(code);
} }
this->channelEmoteCodes[channelName.toStdString()] = codes; this->channelEmoteCodes[channelName] = codes;
} }
}); });
} }

View file

@ -14,10 +14,10 @@ class FFZEmotes
{ {
public: public:
util::EmoteMap globalEmotes; util::EmoteMap globalEmotes;
SignalVector<std::string> globalEmoteCodes; SignalVector<QString> globalEmoteCodes;
util::EmoteMap channelEmotes; util::EmoteMap channelEmotes;
std::map<std::string, SignalVector<std::string>> channelEmoteCodes; std::map<QString, SignalVector<QString>> channelEmoteCodes;
void loadGlobalEmotes(); void loadGlobalEmotes();
void loadChannelEmotes(const QString &channelName, void loadChannelEmotes(const QString &channelName,

View file

@ -38,7 +38,7 @@ void CompletionModel::refresh()
} }
// Global: FFZ Global Emotes // Global: FFZ Global Emotes
std::vector<std::string> &ffzGlobalEmoteCodes = app->emotes->ffz.globalEmoteCodes; std::vector<QString> &ffzGlobalEmoteCodes = app->emotes->ffz.globalEmoteCodes;
for (const auto &m : ffzGlobalEmoteCodes) { for (const auto &m : ffzGlobalEmoteCodes) {
this->addString(m, TaggedString::Type::FFZGlobalEmote); this->addString(m, TaggedString::Type::FFZGlobalEmote);
} }
@ -51,8 +51,8 @@ void CompletionModel::refresh()
} }
// Channel-specific: FFZ Channel Emotes // Channel-specific: FFZ Channel Emotes
std::vector<std::string> &ffzChannelEmoteCodes = std::vector<QString> &ffzChannelEmoteCodes =
app->emotes->ffz.channelEmoteCodes[this->channelName.toStdString()]; app->emotes->ffz.channelEmoteCodes[this->channelName];
for (const auto &m : ffzChannelEmoteCodes) { for (const auto &m : ffzChannelEmoteCodes) {
this->addString(m, TaggedString::Type::FFZChannelEmote); this->addString(m, TaggedString::Type::FFZChannelEmote);
} }