mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
48 lines
977 B
C++
48 lines
977 B
C++
#pragma once
|
|
|
|
#include "common/Aliases.hpp"
|
|
#include "common/Singleton.hpp"
|
|
#include "util/QStringHash.hpp"
|
|
|
|
#include <QColor>
|
|
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <set>
|
|
#include <shared_mutex>
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
|
|
namespace chatterino {
|
|
|
|
struct Emote;
|
|
using EmotePtr = std::shared_ptr<const Emote>;
|
|
|
|
class FfzBadges : public Singleton
|
|
{
|
|
public:
|
|
void initialize(Settings &settings, Paths &paths) override;
|
|
FfzBadges() = default;
|
|
|
|
struct Badge {
|
|
EmotePtr emote;
|
|
QColor color;
|
|
};
|
|
|
|
std::vector<Badge> getUserBadges(const UserId &id);
|
|
|
|
private:
|
|
std::optional<Badge> getBadge(int badgeID);
|
|
|
|
void load();
|
|
|
|
std::shared_mutex mutex_;
|
|
|
|
// userBadges points a user ID to the list of badges they have
|
|
std::unordered_map<QString, std::set<int>> userBadges;
|
|
|
|
// badges points a badge ID to the information about the badge
|
|
std::unordered_map<int, Badge> badges;
|
|
};
|
|
|
|
} // namespace chatterino
|