mirror-chatterino2/src/providers/ffz/FfzBadges.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
977 B
C++
Raw Normal View History

#pragma once
#include "common/Aliases.hpp"
#include "common/Singleton.hpp"
2021-05-01 13:38:58 +02:00
#include "util/QStringHash.hpp"
#include <QColor>
#include <memory>
#include <optional>
#include <set>
2021-05-01 13:38:58 +02:00
#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();
2021-05-01 13:38:58 +02:00
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