Clean up BTTVEmotes class

This commit is contained in:
Rasmus Karlsson 2018-06-07 12:22:28 +02:00
parent 049329e176
commit 09963700ae
2 changed files with 3 additions and 11 deletions

View file

@ -19,11 +19,6 @@ QString getEmoteLink(QString urlTemplate, const QString &id, const QString &emot
} // namespace } // namespace
util::EmoteMap &BTTVEmotes::getBTTVChannelEmoteFromCaches()
{
return _bttvChannelEmoteFromCaches;
}
void BTTVEmotes::loadGlobalEmotes() void BTTVEmotes::loadGlobalEmotes()
{ {
QString url("https://api.betterttv.net/2/emotes"); QString url("https://api.betterttv.net/2/emotes");
@ -91,7 +86,7 @@ void BTTVEmotes::loadChannelEmotes(const QString &channelName, std::weak_ptr<uti
QString code = emoteObject.value("code").toString(); QString code = emoteObject.value("code").toString();
// emoteObject.value("imageType").toString(); // emoteObject.value("imageType").toString();
auto emote = this->getBTTVChannelEmoteFromCaches().getOrAdd(id, [&] { auto emote = this->channelEmoteCache.getOrAdd(id, [&] {
util::EmoteData emoteData; util::EmoteData emoteData;
QString link = linkTemplate; QString link = linkTemplate;
link.detach(); link.detach();

View file

@ -19,15 +19,12 @@ public:
util::EmoteMap channelEmotes; util::EmoteMap channelEmotes;
std::map<std::string, SignalVector<std::string>> channelEmoteCodes; std::map<std::string, SignalVector<std::string>> channelEmoteCodes;
util::EmoteMap &getBTTVChannelEmoteFromCaches();
void loadGlobalEmotes(); void loadGlobalEmotes();
void loadChannelEmotes(const QString &channelName, void loadChannelEmotes(const QString &channelName,
std::weak_ptr<util::EmoteMap> channelEmoteMap); std::weak_ptr<util::EmoteMap> channelEmoteMap);
util::ConcurrentMap<QString, util::EmoteMap> channels; private:
util::EmoteMap channelEmoteCache;
util::EmoteMap _bttvChannelEmoteFromCaches;
}; };
} // namespace bttv } // namespace bttv