2018-08-02 14:23:27 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <boost/optional.hpp>
|
2018-09-16 17:27:51 +02:00
|
|
|
#include <common/Singleton.hpp>
|
2021-05-01 13:38:58 +02:00
|
|
|
#include <shared_mutex>
|
|
|
|
#include <unordered_map>
|
2018-09-16 17:27:51 +02:00
|
|
|
#include <vector>
|
2021-05-01 13:38:58 +02:00
|
|
|
#include "common/Aliases.hpp"
|
|
|
|
#include "util/QStringHash.hpp"
|
2018-09-16 17:27:51 +02:00
|
|
|
|
2018-08-02 14:23:27 +02:00
|
|
|
namespace chatterino {
|
|
|
|
|
2018-08-11 22:23:06 +02:00
|
|
|
struct Emote;
|
|
|
|
using EmotePtr = std::shared_ptr<const Emote>;
|
|
|
|
|
2018-09-16 17:27:51 +02:00
|
|
|
class ChatterinoBadges : public Singleton
|
2018-08-02 14:23:27 +02:00
|
|
|
{
|
|
|
|
public:
|
2018-09-16 17:27:51 +02:00
|
|
|
virtual void initialize(Settings &settings, Paths &paths) override;
|
2018-08-02 14:23:27 +02:00
|
|
|
ChatterinoBadges();
|
|
|
|
|
2019-08-23 16:52:04 +02:00
|
|
|
boost::optional<EmotePtr> getBadge(const UserId &id);
|
2018-08-02 14:23:27 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
void loadChatterinoBadges();
|
2021-05-01 13:38:58 +02:00
|
|
|
|
|
|
|
std::shared_mutex mutex_;
|
|
|
|
|
|
|
|
std::unordered_map<QString, int> badgeMap;
|
2018-09-16 17:27:51 +02:00
|
|
|
std::vector<EmotePtr> emotes;
|
2018-08-02 14:23:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|