mirror-chatterino2/emotes.h

102 lines
2.4 KiB
C
Raw Normal View History

2017-01-04 15:12:31 +01:00
#ifndef EMOTES_H
#define EMOTES_H
#include "concurrentmap.h"
2017-01-11 18:52:09 +01:00
#include "lazyloadedimage.h"
#include "twitchemotevalue.h"
2017-01-04 15:12:31 +01:00
2017-01-18 04:52:47 +01:00
#include <QMap>
#include <QMutex>
2017-01-04 15:12:31 +01:00
class Emotes
{
public:
2017-01-11 18:52:09 +01:00
static ConcurrentMap<QString, TwitchEmoteValue *> &
2017-01-18 04:33:30 +01:00
getTwitchEmotes()
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return twitchEmotes;
2017-01-11 18:52:09 +01:00
}
2017-01-13 18:59:11 +01:00
2017-01-11 18:52:09 +01:00
static ConcurrentMap<QString, LazyLoadedImage *> &
2017-01-18 04:33:30 +01:00
getBttvEmotes()
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return bttvEmotes;
2017-01-11 18:52:09 +01:00
}
2017-01-13 18:59:11 +01:00
2017-01-11 18:52:09 +01:00
static ConcurrentMap<QString, LazyLoadedImage *> &
2017-01-18 04:33:30 +01:00
getFfzEmotes()
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return ffzEmotes;
2017-01-11 18:52:09 +01:00
}
2017-01-13 18:59:11 +01:00
2017-01-11 18:52:09 +01:00
static ConcurrentMap<QString, LazyLoadedImage *> &
2017-01-18 04:33:30 +01:00
getChatterinoEmotes()
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return chatterinoEmotes;
2017-01-11 18:52:09 +01:00
}
2017-01-13 18:59:11 +01:00
2017-01-11 18:52:09 +01:00
static ConcurrentMap<QString, LazyLoadedImage *> &
2017-01-18 04:33:30 +01:00
getBttvChannelEmoteFromCaches()
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return bttvChannelEmoteFromCaches;
2017-01-11 18:52:09 +01:00
}
2017-01-13 18:59:11 +01:00
2017-01-11 18:52:09 +01:00
static ConcurrentMap<QString, LazyLoadedImage *> &
2017-01-18 04:33:30 +01:00
getFfzChannelEmoteFromCaches()
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return ffzChannelEmoteFromCaches;
2017-01-11 18:52:09 +01:00
}
2017-01-13 18:59:11 +01:00
static ConcurrentMap<long, LazyLoadedImage *> &
2017-01-18 04:33:30 +01:00
getTwitchEmoteFromCache()
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return twitchEmoteFromCache;
2017-01-11 18:52:09 +01:00
}
2017-01-13 18:59:11 +01:00
2017-01-11 18:52:09 +01:00
static ConcurrentMap<QString, LazyLoadedImage *> &
2017-01-18 04:33:30 +01:00
getMiscImageFromCache()
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return miscImageFromCache;
2017-01-11 18:52:09 +01:00
}
2017-01-04 15:12:31 +01:00
2017-01-05 16:07:20 +01:00
static void loadGlobalEmotes();
2017-01-11 18:52:09 +01:00
static LazyLoadedImage *getCheerImage(long long int amount, bool animated);
static LazyLoadedImage *getCheerBadge(long long int amount);
2017-01-05 16:07:20 +01:00
2017-01-11 18:52:09 +01:00
static LazyLoadedImage *getTwitchEmoteById(const QString &name,
long int id);
2017-01-06 23:28:48 +01:00
2017-01-15 16:38:30 +01:00
static int
2017-01-18 04:33:30 +01:00
getGeneration()
2017-01-15 16:38:30 +01:00
{
2017-01-18 04:33:30 +01:00
return generation;
2017-01-15 16:38:30 +01:00
}
static void
incGeneration()
{
2017-01-18 04:33:30 +01:00
generation++;
2017-01-15 16:38:30 +01:00
}
2017-01-04 15:12:31 +01:00
private:
Emotes();
2017-01-18 04:33:30 +01:00
static QString twitchEmoteTemplate;
2017-01-13 18:59:11 +01:00
2017-01-18 04:33:30 +01:00
static ConcurrentMap<QString, TwitchEmoteValue *> twitchEmotes;
static ConcurrentMap<QString, LazyLoadedImage *> bttvEmotes;
static ConcurrentMap<QString, LazyLoadedImage *> ffzEmotes;
static ConcurrentMap<QString, LazyLoadedImage *> chatterinoEmotes;
static ConcurrentMap<QString, LazyLoadedImage *> bttvChannelEmoteFromCaches;
static ConcurrentMap<QString, LazyLoadedImage *> ffzChannelEmoteFromCaches;
static ConcurrentMap<long, LazyLoadedImage *> twitchEmoteFromCache;
static ConcurrentMap<QString, LazyLoadedImage *> miscImageFromCache;
2017-01-13 18:59:11 +01:00
static QString getTwitchEmoteLink(long id, qreal &scale);
2017-01-15 16:38:30 +01:00
2017-01-18 04:33:30 +01:00
static int generation;
2017-01-04 15:12:31 +01:00
};
2017-01-11 18:52:09 +01:00
#endif // EMOTES_H