2018-06-05 17:13:29 +02:00
|
|
|
#pragma once
|
|
|
|
|
2018-06-26 17:20:03 +02:00
|
|
|
#include "common/Emotemap.hpp"
|
2018-06-26 14:09:39 +02:00
|
|
|
#include "providers/twitch/EmoteValue.hpp"
|
|
|
|
#include "providers/twitch/TwitchAccount.hpp"
|
|
|
|
#include "providers/twitch/TwitchEmotes.hpp"
|
|
|
|
#include "util/ConcurrentMap.hpp"
|
2018-06-05 17:13:29 +02:00
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
2018-06-24 14:42:40 +02:00
|
|
|
#include <QString>
|
|
|
|
|
2018-06-05 17:13:29 +02:00
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
class TwitchEmotes
|
|
|
|
{
|
|
|
|
public:
|
2018-06-24 14:42:40 +02:00
|
|
|
TwitchEmotes();
|
|
|
|
|
2018-06-26 17:06:17 +02:00
|
|
|
EmoteData getEmoteById(const QString &id, const QString &emoteName);
|
2018-06-05 17:13:29 +02:00
|
|
|
|
|
|
|
/// Twitch emotes
|
2018-06-26 17:06:17 +02:00
|
|
|
void refresh(const std::shared_ptr<TwitchAccount> &user);
|
2018-06-05 17:13:29 +02:00
|
|
|
|
2018-06-07 13:01:06 +02:00
|
|
|
struct TwitchEmote {
|
|
|
|
TwitchEmote(const QString &_id, const QString &_code)
|
|
|
|
: id(_id)
|
|
|
|
, code(_code)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// i.e. "403921"
|
|
|
|
QString id;
|
|
|
|
|
|
|
|
// i.e. "forsenE"
|
|
|
|
QString code;
|
|
|
|
};
|
2018-06-05 17:13:29 +02:00
|
|
|
|
2018-06-07 13:01:06 +02:00
|
|
|
struct EmoteSet {
|
|
|
|
QString key;
|
2018-06-24 14:42:40 +02:00
|
|
|
QString channelName;
|
|
|
|
QString text;
|
2018-06-07 13:01:06 +02:00
|
|
|
std::vector<TwitchEmote> emotes;
|
|
|
|
};
|
|
|
|
|
2018-06-24 14:42:40 +02:00
|
|
|
std::map<QString, EmoteSet> staticEmoteSets;
|
|
|
|
|
2018-06-07 13:01:06 +02:00
|
|
|
struct TwitchAccountEmoteData {
|
2018-06-24 14:42:40 +02:00
|
|
|
std::vector<std::shared_ptr<EmoteSet>> emoteSets;
|
2018-06-05 17:13:29 +02:00
|
|
|
|
2018-06-07 13:01:06 +02:00
|
|
|
std::vector<QString> emoteCodes;
|
2018-06-05 17:13:29 +02:00
|
|
|
|
2018-06-26 17:06:17 +02:00
|
|
|
EmoteMap emotes;
|
2018-06-05 17:13:29 +02:00
|
|
|
|
|
|
|
bool filled = false;
|
|
|
|
};
|
|
|
|
|
2018-06-07 13:01:06 +02:00
|
|
|
// Key is the user ID
|
2018-06-07 12:36:06 +02:00
|
|
|
std::map<QString, TwitchAccountEmoteData> emotes;
|
2018-06-05 17:13:29 +02:00
|
|
|
|
|
|
|
private:
|
2018-06-24 14:42:40 +02:00
|
|
|
void loadSetData(std::shared_ptr<TwitchEmotes::EmoteSet> emoteSet);
|
|
|
|
|
2018-06-05 17:13:29 +02:00
|
|
|
// emote code
|
2018-06-26 17:06:17 +02:00
|
|
|
ConcurrentMap<QString, EmoteValue *> _twitchEmotes;
|
2018-06-05 17:13:29 +02:00
|
|
|
|
|
|
|
// emote id
|
2018-06-26 17:06:17 +02:00
|
|
|
ConcurrentMap<QString, EmoteData> _twitchEmoteFromCache;
|
2018-06-05 17:13:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|