mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Clean up BTTVEmotes class
This commit is contained in:
parent
049329e176
commit
09963700ae
2 changed files with 3 additions and 11 deletions
|
@ -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();
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue