#ifndef EMOTES_H #define EMOTES_H #define GIF_FRAME_LENGTH 33 #include "concurrentmap.h" #include "messages/lazyloadedimage.h" #include "twitch/emotevalue.h" #include "windowmanager.h" #include #include #include #include namespace chatterino { class EmoteManager { public: static EmoteManager &getInstance() { return instance; } ConcurrentMap &getTwitchEmotes(); ConcurrentMap &getBttvEmotes(); ConcurrentMap &getFfzEmotes(); ConcurrentMap &getChatterinoEmotes(); ConcurrentMap &getBttvChannelEmoteFromCaches(); ConcurrentMap &getFfzChannelEmoteFromCaches(); ConcurrentMap &getTwitchEmoteFromCache(); ConcurrentMap &getMiscImageFromCache(); void loadGlobalEmotes(); 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() { if (!_gifUpdateTimerInitiated) { _gifUpdateTimerInitiated = true; _gifUpdateTimer.setInterval(30); _gifUpdateTimer.start(); QObject::connect(&_gifUpdateTimer, &QTimer::timeout, [this] { _gifUpdateTimerSignal(); WindowManager::getInstance().repaintGifEmotes(); }); } return _gifUpdateTimerSignal; } private: static EmoteManager instance; EmoteManager(); // variables ConcurrentMap _twitchEmotes; ConcurrentMap _bttvEmotes; ConcurrentMap _ffzEmotes; ConcurrentMap _chatterinoEmotes; ConcurrentMap _bttvChannelEmoteFromCaches; ConcurrentMap _ffzChannelEmoteFromCaches; ConcurrentMap _twitchEmoteFromCache; ConcurrentMap _miscImageFromCache; QTimer _gifUpdateTimer; bool _gifUpdateTimerInitiated; int _generation; boost::signals2::signal _gifUpdateTimerSignal; // methods static QString getTwitchEmoteLink(long id, qreal &scale); void loadFfzEmotes(); void loadBttvEmotes(); }; } // namespace chatterino #endif // EMOTES_H