#pragma once #define GIF_FRAME_LENGTH 33 #include "concurrentmap.hpp" #include "emojis.hpp" #include "messages/lazyloadedimage.hpp" #include "twitch/emotevalue.hpp" #include #include #include #include #include namespace chatterino { class WindowManager; class Resources; class EmoteManager { public: using FFZEmoteMap = ConcurrentMap; using BTTVEmoteMap = ConcurrentMap; using ChatterinoEmoteMap = ConcurrentMap; EmoteManager(WindowManager &_windowManager, Resources &_resources); void loadGlobalEmotes(); void reloadBTTVChannelEmotes(const QString &channelName, BTTVEmoteMap &channelEmoteMap); void reloadFFZChannelEmotes(const QString &channelName, FFZEmoteMap &channelEmoteMap); ConcurrentMap &getTwitchEmotes(); ConcurrentMap &getBTTVEmotes(); ConcurrentMap &getFFZEmotes(); ConcurrentMap &getChatterinoEmotes(); ConcurrentMap &getBTTVChannelEmoteFromCaches(); ConcurrentMap &getFFZChannelEmoteFromCaches(); ConcurrentMap &getTwitchEmoteFromCache(); ConcurrentMap &getMiscImageFromCache(); messages::LazyLoadedImage *getCheerImage(long long int amount, bool animated); messages::LazyLoadedImage *getCheerBadge(long long int amount); messages::LazyLoadedImage *getTwitchEmoteById(const QString &name, long int id); int getGeneration() { return _generation; } void incGeneration() { _generation++; } boost::signals2::signal &getGifUpdateSignal(); private: WindowManager &windowManager; Resources &resources; // Emojis // shortCodeToEmoji maps strings like ":sunglasses:" to the unicode character QMap shortCodeToEmoji; // emojiToShortCode maps the unicode character to the shortcode like ":sunglasses:" QMap emojiToShortCode; // TODO(pajlada): Figure out what this is for QMap> firstEmojiChars; ConcurrentMap emojis; void loadEmojis(); public: void parseEmojis(std::vector> &vector, const QString &text); private: // Twitch emotes ConcurrentMap _twitchEmotes; ConcurrentMap _twitchEmoteFromCache; // BTTV emotes ConcurrentMap bttvChannelEmotes; ConcurrentMap _bttvEmotes; ConcurrentMap _bttvChannelEmoteFromCaches; void loadBTTVEmotes(); // FFZ emotes ConcurrentMap ffzChannelEmotes; ConcurrentMap _ffzEmotes; ConcurrentMap _ffzChannelEmoteFromCaches; void loadFFZEmotes(); // Chatterino emotes ConcurrentMap _chatterinoEmotes; // ??? ConcurrentMap _miscImageFromCache; boost::signals2::signal _gifUpdateTimerSignal; QTimer _gifUpdateTimer; bool _gifUpdateTimerInitiated = false; int _generation = 0; // methods static QString getTwitchEmoteLink(long id, qreal &scale); }; } // namespace chatterino