Clean up emotemanager emoji code

This commit is contained in:
Rasmus Karlsson 2017-12-19 03:33:48 +01:00
parent 01dbaed781
commit 47a1911df9
2 changed files with 4 additions and 10 deletions

View file

@ -160,11 +160,6 @@ EmoteMap &EmoteManager::getBTTVChannelEmoteFromCaches()
return _bttvChannelEmoteFromCaches; return _bttvChannelEmoteFromCaches;
} }
EmoteMap &EmoteManager::getEmojis()
{
return this->emojis;
}
ConcurrentMap<int, EmoteData> &EmoteManager::getFFZChannelEmoteFromCaches() ConcurrentMap<int, EmoteData> &EmoteManager::getFFZChannelEmoteFromCaches()
{ {
return _ffzChannelEmoteFromCaches; return _ffzChannelEmoteFromCaches;
@ -226,7 +221,8 @@ void EmoteManager::loadEmojis()
"emojione/2.2.6/assets/png/" + "emojione/2.2.6/assets/png/" +
code + ".png"; code + ".png";
this->emojis.insert(code, EmoteData(new LazyLoadedImage(url, 0.35))); this->emojis.insert(code, EmoteData(new LazyLoadedImage(url, 0.35, ":" + shortCode + ":",
":" + shortCode + ":")));
// TODO(pajlada): The vectors in emojiFirstByte need to be sorted by // TODO(pajlada): The vectors in emojiFirstByte need to be sorted by
// emojiData.code.length() // emojiData.code.length()
@ -303,8 +299,8 @@ void EmoteManager::parseEmojis(std::vector<std::tuple<EmoteData, QString>> &pars
matchedEmoji.code + ".png"; matchedEmoji.code + ".png";
// Create or fetch cached emoji image // Create or fetch cached emoji image
auto emojiImage = this->emojiCache.getOrAdd(url, [this, &url] { auto emojiImage = this->emojis.getOrAdd(matchedEmoji.code, [this, &url] {
return EmoteData(new LazyLoadedImage(url, 0.35)); // return EmoteData(new LazyLoadedImage(url, 0.35, "?????????", "???????????????")); //
}); });
// Push the emoji as a word to parsedWords // Push the emoji as a word to parsedWords

View file

@ -54,7 +54,6 @@ public:
EmoteMap &getFFZEmotes(); EmoteMap &getFFZEmotes();
EmoteMap &getChatterinoEmotes(); EmoteMap &getChatterinoEmotes();
EmoteMap &getBTTVChannelEmoteFromCaches(); EmoteMap &getBTTVChannelEmoteFromCaches();
EmoteMap &getEmojis();
ConcurrentMap<int, EmoteData> &getFFZChannelEmoteFromCaches(); ConcurrentMap<int, EmoteData> &getFFZChannelEmoteFromCaches();
ConcurrentMap<long, EmoteData> &getTwitchEmoteFromCache(); ConcurrentMap<long, EmoteData> &getTwitchEmoteFromCache();
@ -88,7 +87,6 @@ private:
QMap<QChar, QVector<EmojiData>> emojiFirstByte; QMap<QChar, QVector<EmojiData>> emojiFirstByte;
// url Emoji-one image // url Emoji-one image
EmoteMap emojiCache;
EmoteMap emojis; EmoteMap emojis;
void loadEmojis(); void loadEmojis();