2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2017-01-13 18:59:11 +01:00
|
|
|
|
2017-06-11 09:31:45 +02:00
|
|
|
#include "messages/lazyloadedimage.hpp"
|
2017-01-18 21:30:23 +01:00
|
|
|
|
2017-06-15 23:13:01 +02:00
|
|
|
#include <map>
|
2017-08-12 13:20:52 +02:00
|
|
|
#include <memory>
|
2017-06-15 23:13:01 +02:00
|
|
|
#include <mutex>
|
|
|
|
|
2017-01-18 21:30:23 +01:00
|
|
|
namespace chatterino {
|
2017-01-13 18:59:11 +01:00
|
|
|
|
|
|
|
class Resources
|
|
|
|
{
|
2017-12-17 02:18:13 +01:00
|
|
|
explicit Resources();
|
2017-06-13 21:13:58 +02:00
|
|
|
|
2017-12-31 00:50:07 +01:00
|
|
|
public:
|
|
|
|
static Resources &getInstance();
|
|
|
|
|
2017-06-13 21:13:58 +02:00
|
|
|
messages::LazyLoadedImage *badgeStaff;
|
|
|
|
messages::LazyLoadedImage *badgeAdmin;
|
|
|
|
messages::LazyLoadedImage *badgeGlobalModerator;
|
|
|
|
messages::LazyLoadedImage *badgeModerator;
|
|
|
|
messages::LazyLoadedImage *badgeTurbo;
|
|
|
|
messages::LazyLoadedImage *badgeBroadcaster;
|
|
|
|
messages::LazyLoadedImage *badgePremium;
|
2017-06-13 22:03:29 +02:00
|
|
|
messages::LazyLoadedImage *badgeVerified;
|
2017-11-04 17:22:53 +01:00
|
|
|
messages::LazyLoadedImage *badgeSubscriber;
|
2017-12-19 00:09:38 +01:00
|
|
|
messages::LazyLoadedImage *badgeCollapsed;
|
2017-06-13 21:13:58 +02:00
|
|
|
|
|
|
|
messages::LazyLoadedImage *cheerBadge100000;
|
|
|
|
messages::LazyLoadedImage *cheerBadge10000;
|
|
|
|
messages::LazyLoadedImage *cheerBadge5000;
|
|
|
|
messages::LazyLoadedImage *cheerBadge1000;
|
|
|
|
messages::LazyLoadedImage *cheerBadge100;
|
|
|
|
messages::LazyLoadedImage *cheerBadge1;
|
|
|
|
|
2017-06-15 23:13:01 +02:00
|
|
|
std::map<std::string, messages::LazyLoadedImage *> cheerBadges;
|
|
|
|
|
|
|
|
struct BadgeVersion {
|
|
|
|
BadgeVersion() = delete;
|
|
|
|
|
2017-12-17 02:18:13 +01:00
|
|
|
explicit BadgeVersion(QJsonObject &&root);
|
2017-06-15 23:13:01 +02:00
|
|
|
|
|
|
|
messages::LazyLoadedImage *badgeImage1x;
|
|
|
|
messages::LazyLoadedImage *badgeImage2x;
|
|
|
|
messages::LazyLoadedImage *badgeImage4x;
|
|
|
|
std::string description;
|
|
|
|
std::string title;
|
|
|
|
std::string clickAction;
|
2017-06-16 08:03:13 +02:00
|
|
|
std::string clickURL;
|
2017-06-15 23:13:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct BadgeSet {
|
|
|
|
std::map<std::string, BadgeVersion> versions;
|
|
|
|
};
|
|
|
|
|
|
|
|
std::map<std::string, BadgeSet> badgeSets;
|
|
|
|
|
|
|
|
bool dynamicBadgesLoaded = false;
|
|
|
|
|
2017-06-13 21:13:58 +02:00
|
|
|
messages::LazyLoadedImage *buttonBan;
|
|
|
|
messages::LazyLoadedImage *buttonTimeout;
|
2017-06-15 23:13:01 +02:00
|
|
|
|
|
|
|
struct Channel {
|
2017-06-17 11:37:13 +02:00
|
|
|
std::map<std::string, BadgeSet> badgeSets;
|
2017-06-15 23:13:01 +02:00
|
|
|
|
2017-06-17 11:37:13 +02:00
|
|
|
bool loaded = false;
|
2017-06-15 23:13:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// channelId
|
2017-11-04 14:57:29 +01:00
|
|
|
std::map<QString, Channel> channels;
|
2017-06-16 10:01:21 +02:00
|
|
|
|
2017-08-12 13:20:52 +02:00
|
|
|
// Chatterino badges
|
|
|
|
struct ChatterinoBadge {
|
|
|
|
ChatterinoBadge(const std::string &_tooltip, messages::LazyLoadedImage *_image)
|
|
|
|
: tooltip(_tooltip)
|
|
|
|
, image(_image)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string tooltip;
|
|
|
|
messages::LazyLoadedImage *image;
|
|
|
|
};
|
|
|
|
|
|
|
|
// username
|
|
|
|
std::map<std::string, std::shared_ptr<ChatterinoBadge>> chatterinoBadges;
|
|
|
|
|
2017-11-04 14:57:29 +01:00
|
|
|
void loadChannelData(const QString &roomID, bool bypassCache = false);
|
2017-10-27 21:22:06 +02:00
|
|
|
void loadDynamicTwitchBadges();
|
2017-08-12 13:20:52 +02:00
|
|
|
void loadChatterinoBadges();
|
2017-01-13 18:59:11 +01:00
|
|
|
};
|
|
|
|
|
2017-06-07 10:09:24 +02:00
|
|
|
} // namespace chatterino
|