2018-06-05 17:13:29 +02:00
|
|
|
#pragma once
|
|
|
|
|
2018-08-02 14:23:27 +02:00
|
|
|
#include <QString>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
2018-06-26 17:20:03 +02:00
|
|
|
#include "common/Emotemap.hpp"
|
2018-08-02 14:23:27 +02:00
|
|
|
#include "common/UniqueAccess.hpp"
|
|
|
|
#include "messages/Emote.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
|
|
|
|
2018-08-02 14:23:27 +02:00
|
|
|
#define TWITCH_EMOTE_TEMPLATE "https://static-cdn.jtvnw.net/emoticons/v1/{id}/{scale}"
|
2018-06-24 14:42:40 +02:00
|
|
|
|
2018-06-05 17:13:29 +02:00
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
class TwitchEmotes
|
|
|
|
{
|
|
|
|
public:
|
2018-06-24 14:42:40 +02:00
|
|
|
TwitchEmotes();
|
|
|
|
|
2018-08-02 14:23:27 +02:00
|
|
|
EmotePtr getOrCreateEmote(const EmoteId &id, const EmoteName &name);
|
|
|
|
Url getEmoteLink(const EmoteId &id, const QString &emoteScale);
|
|
|
|
AccessGuard<std::unordered_map<EmoteName, EmotePtr>> accessAll();
|
2018-06-05 17:13:29 +02:00
|
|
|
|
|
|
|
private:
|
2018-08-02 14:23:27 +02:00
|
|
|
UniqueAccess<std::unordered_map<EmoteName, EmotePtr>> twitchEmotes_;
|
|
|
|
UniqueAccess<std::unordered_map<EmoteId, std::weak_ptr<Emote>>> twitchEmotesCache_;
|
2018-06-05 17:13:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|