feat: Add 7TV Emotes and Badges (#4002)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
nerix
2022-10-16 13:22:17 +02:00
committed by GitHub
parent e8fd49aadb
commit 3e41b84ed7
29 changed files with 780 additions and 7 deletions
+35
View File
@@ -0,0 +1,35 @@
#pragma once
#include "common/Aliases.hpp"
#include "util/QStringHash.hpp"
#include <boost/optional.hpp>
#include <common/Singleton.hpp>
#include <memory>
#include <shared_mutex>
#include <unordered_map>
namespace chatterino {
struct Emote;
using EmotePtr = std::shared_ptr<const Emote>;
class SeventvBadges : public Singleton
{
public:
void initialize(Settings &settings, Paths &paths) override;
boost::optional<EmotePtr> getBadge(const UserId &id);
private:
void loadSeventvBadges();
// Mutex for both `badgeMap_` and `emotes_`
std::shared_mutex mutex_;
std::unordered_map<QString, int> badgeMap_;
std::vector<EmotePtr> emotes_;
};
} // namespace chatterino