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

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

View file

@ -32,7 +32,7 @@ void BTTVEmotes::loadGlobalEmotes()
QString urlTemplate = "https:" + root.value("urlTemplate").toString(); QString urlTemplate = "https:" + root.value("urlTemplate").toString();
std::vector<std::string> codes; std::vector<QString> codes;
for (const QJsonValue &emote : emotes) { for (const QJsonValue &emote : emotes) {
QString id = emote.toObject().value("id").toString(); QString id = emote.toObject().value("id").toString();
QString code = emote.toObject().value("code").toString(); QString code = emote.toObject().value("code").toString();
@ -47,7 +47,7 @@ void BTTVEmotes::loadGlobalEmotes()
emoteData.pageLink = "https://manage.betterttv.net/emotes/" + id; emoteData.pageLink = "https://manage.betterttv.net/emotes/" + id;
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;
@ -78,7 +78,7 @@ void BTTVEmotes::loadChannelEmotes(const QString &channelName, std::weak_ptr<uti
QString linkTemplate = "https:" + rootNode.value("urlTemplate").toString(); QString linkTemplate = "https:" + rootNode.value("urlTemplate").toString();
std::vector<std::string> codes; std::vector<QString> codes;
for (const QJsonValue &emoteNode : emotesNode) { for (const QJsonValue &emoteNode : emotesNode) {
QJsonObject emoteObject = emoteNode.toObject(); QJsonObject emoteObject = emoteNode.toObject();
@ -110,10 +110,10 @@ void BTTVEmotes::loadChannelEmotes(const QString &channelName, std::weak_ptr<uti
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 BTTVEmotes
{ {
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

@ -32,7 +32,7 @@ void CompletionModel::refresh()
} }
// Global: BTTV Global Emotes // Global: BTTV Global Emotes
std::vector<std::string> &bttvGlobalEmoteCodes = app->emotes->bttv.globalEmoteCodes; std::vector<QString> &bttvGlobalEmoteCodes = app->emotes->bttv.globalEmoteCodes;
for (const auto &m : bttvGlobalEmoteCodes) { for (const auto &m : bttvGlobalEmoteCodes) {
this->addString(m, TaggedString::Type::BTTVGlobalEmote); this->addString(m, TaggedString::Type::BTTVGlobalEmote);
} }
@ -44,8 +44,8 @@ void CompletionModel::refresh()
} }
// Channel-specific: BTTV Channel Emotes // Channel-specific: BTTV Channel Emotes
std::vector<std::string> &bttvChannelEmoteCodes = std::vector<QString> &bttvChannelEmoteCodes =
app->emotes->bttv.channelEmoteCodes[this->channelName.toStdString()]; app->emotes->bttv.channelEmoteCodes[this->channelName];
for (const auto &m : bttvChannelEmoteCodes) { for (const auto &m : bttvChannelEmoteCodes) {
this->addString(m, TaggedString::Type::BTTVChannelEmote); this->addString(m, TaggedString::Type::BTTVChannelEmote);
} }