mirror-chatterino2/emotes.h

103 lines
2.4 KiB
C
Raw Normal View History

2017-01-04 15:12:31 +01:00
#ifndef EMOTES_H
#define EMOTES_H
#include "QMap"
2017-01-11 18:52:09 +01:00
#include "QMutex"
2017-01-04 15:12:31 +01:00
#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
class Emotes
{
public:
2017-01-11 18:52:09 +01:00
static ConcurrentMap<QString, TwitchEmoteValue *> &
twitchEmotes()
{
2017-01-13 18:59:11 +01:00
return m_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 *> &
bttvEmotes()
{
2017-01-13 18:59:11 +01:00
return m_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 *> &
ffzEmotes()
{
2017-01-13 18:59:11 +01:00
return m_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 *> &
chatterinoEmotes()
{
2017-01-13 18:59:11 +01:00
return m_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 *> &
bttvChannelEmoteFromCaches()
{
2017-01-13 18:59:11 +01:00
return m_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 *> &
ffzChannelEmoteFromCaches()
{
2017-01-13 18:59:11 +01:00
return m_ffzChannelEmoteFromCaches;
2017-01-11 18:52:09 +01:00
}
2017-01-13 18:59:11 +01:00
static ConcurrentMap<long, LazyLoadedImage *> &
2017-01-11 18:52:09 +01:00
twitchEmoteFromCache()
{
2017-01-13 18:59:11 +01:00
return m_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 *> &
miscImageFromCache()
{
2017-01-13 18:59:11 +01:00
return m_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
generation()
{
return m_generation;
}
static void
incGeneration()
{
m_generation++;
}
2017-01-04 15:12:31 +01:00
private:
Emotes();
2017-01-13 18:59:11 +01:00
static QString m_twitchEmoteTemplate;
static ConcurrentMap<QString, TwitchEmoteValue *> m_twitchEmotes;
static ConcurrentMap<QString, LazyLoadedImage *> m_bttvEmotes;
static ConcurrentMap<QString, LazyLoadedImage *> m_ffzEmotes;
static ConcurrentMap<QString, LazyLoadedImage *> m_chatterinoEmotes;
2017-01-11 18:52:09 +01:00
static ConcurrentMap<QString, LazyLoadedImage *>
2017-01-13 18:59:11 +01:00
m_bttvChannelEmoteFromCaches;
2017-01-11 18:52:09 +01:00
static ConcurrentMap<QString, LazyLoadedImage *>
2017-01-13 18:59:11 +01:00
m_ffzChannelEmoteFromCaches;
static ConcurrentMap<long, LazyLoadedImage *> m_twitchEmoteFromCache;
static ConcurrentMap<QString, LazyLoadedImage *> m_miscImageFromCache;
static QString getTwitchEmoteLink(long id, qreal &scale);
2017-01-15 16:38:30 +01:00
static int m_generation;
2017-01-04 15:12:31 +01:00
};
2017-01-11 18:52:09 +01:00
#endif // EMOTES_H