2018-06-05 17:13:29 +02:00
|
|
|
#pragma once
|
|
|
|
|
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"
|
|
|
|
#include "util/Emotemap.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 {
|
|
|
|
namespace providers {
|
|
|
|
namespace twitch {
|
|
|
|
|
|
|
|
class TwitchEmotes
|
|
|
|
{
|
|
|
|
public:
|
2018-06-24 14:42:40 +02:00
|
|
|
TwitchEmotes();
|
|
|
|
|
2018-06-07 13:01:06 +02:00
|
|
|
util::EmoteData getEmoteById(const QString &id, const QString &emoteName);
|
2018-06-05 17:13:29 +02:00
|
|
|
|
|
|
|
/// Twitch emotes
|
|
|
|
void refresh(const std::shared_ptr<providers::twitch::TwitchAccount> &user);
|
|
|
|
|
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
|
|
|
|
|
|
|
util::EmoteMap emotes;
|
|
|
|
|
|
|
|
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
|
|
|
|
util::ConcurrentMap<QString, providers::twitch::EmoteValue *> _twitchEmotes;
|
|
|
|
|
|
|
|
// emote id
|
2018-06-07 13:01:06 +02:00
|
|
|
util::ConcurrentMap<QString, util::EmoteData> _twitchEmoteFromCache;
|
2018-06-05 17:13:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace twitch
|
|
|
|
} // namespace providers
|
|
|
|
} // namespace chatterino
|