2018-06-05 17:13:29 +02:00
|
|
|
#pragma once
|
|
|
|
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include "common/Aliases.hpp"
|
|
|
|
#include "common/UniqueAccess.hpp"
|
|
|
|
|
2018-08-13 13:54:39 +02:00
|
|
|
#include <QColor>
|
|
|
|
#include <QRegularExpression>
|
2018-08-02 14:23:27 +02:00
|
|
|
#include <QString>
|
2018-06-05 17:13:29 +02:00
|
|
|
|
2021-05-08 15:57:00 +02:00
|
|
|
#include <memory>
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include <unordered_map>
|
2021-05-08 15:57:00 +02:00
|
|
|
|
2021-06-04 21:42:32 +02:00
|
|
|
// NB: "default" can be replaced with "static" to always get a non-animated
|
|
|
|
// variant
|
2018-08-06 21:17:03 +02:00
|
|
|
#define TWITCH_EMOTE_TEMPLATE \
|
2021-06-04 21:42:32 +02:00
|
|
|
"https://static-cdn.jtvnw.net/emoticons/v2/{id}/default/dark/{scale}"
|
2018-06-24 14:42:40 +02:00
|
|
|
|
2018-06-05 17:13:29 +02:00
|
|
|
namespace chatterino {
|
2018-08-11 22:23:06 +02:00
|
|
|
struct Emote;
|
|
|
|
using EmotePtr = std::shared_ptr<const Emote>;
|
|
|
|
|
2018-08-13 13:54:39 +02:00
|
|
|
struct CheerEmote {
|
|
|
|
QColor color;
|
|
|
|
int minBits;
|
2019-12-19 21:36:02 +01:00
|
|
|
QRegularExpression regex;
|
2018-08-13 13:54:39 +02:00
|
|
|
|
|
|
|
EmotePtr animatedEmote;
|
|
|
|
EmotePtr staticEmote;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CheerEmoteSet {
|
|
|
|
QRegularExpression regex;
|
|
|
|
std::vector<CheerEmote> cheerEmotes;
|
|
|
|
};
|
|
|
|
|
2022-11-05 11:04:35 +01:00
|
|
|
class ITwitchEmotes
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~ITwitchEmotes() = default;
|
|
|
|
|
|
|
|
virtual EmotePtr getOrCreateEmote(const EmoteId &id,
|
|
|
|
const EmoteName &name) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class TwitchEmotes : public ITwitchEmotes
|
2018-06-05 17:13:29 +02:00
|
|
|
{
|
|
|
|
public:
|
2021-07-17 12:35:43 +02:00
|
|
|
static QString cleanUpEmoteCode(const QString &dirtyEmoteCode);
|
2022-11-05 11:04:35 +01:00
|
|
|
TwitchEmotes() = default;
|
2018-06-24 14:42:40 +02:00
|
|
|
|
2022-11-05 11:04:35 +01:00
|
|
|
EmotePtr getOrCreateEmote(const EmoteId &id,
|
|
|
|
const EmoteName &name) override;
|
2018-06-05 17:13:29 +02:00
|
|
|
|
|
|
|
private:
|
2019-08-13 13:02:11 +02:00
|
|
|
Url getEmoteLink(const EmoteId &id, const QString &emoteScale);
|
2018-08-06 21:17:03 +02:00
|
|
|
UniqueAccess<std::unordered_map<EmoteId, std::weak_ptr<Emote>>>
|
|
|
|
twitchEmotesCache_;
|
2018-06-05 17:13:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|