mirror-chatterino2/src/twitch/twitchmessagebuilder.hpp

77 lines
2 KiB
C++
Raw Normal View History

#pragma once
2017-04-12 17:46:44 +02:00
2017-06-11 09:31:45 +02:00
#include "messages/messagebuilder.hpp"
2017-09-24 18:43:24 +02:00
#include "messages/messageparseargs.hpp"
2017-06-15 23:13:01 +02:00
#include "resources.hpp"
#include "twitch/twitchchannel.hpp"
2017-04-12 17:46:44 +02:00
#include <QString>
#include <QVariant>
2017-04-12 17:46:44 +02:00
2017-04-14 17:52:22 +02:00
namespace chatterino {
class WindowManager;
2017-07-02 18:12:11 +02:00
class Channel;
class ColorScheme;
2017-04-14 17:52:22 +02:00
namespace twitch {
2017-04-12 17:46:44 +02:00
class TwitchMessageBuilder : public messages::MessageBuilder
{
public:
enum UsernameDisplayMode : int {
Username = 1, // Username
LocalizedName = 2, // Localized name
UsernameAndLocalizedName = 3, // Username (Localized name)
};
2017-07-02 18:12:11 +02:00
TwitchMessageBuilder() = delete;
2017-04-12 17:46:44 +02:00
explicit TwitchMessageBuilder(TwitchChannel *_channel, Resources &_resources,
2017-12-17 02:18:13 +01:00
WindowManager &_windowManager,
2017-07-02 18:12:11 +02:00
const Communi::IrcPrivateMessage *_ircMessage,
const messages::MessageParseArgs &_args);
Channel *channel;
TwitchChannel *twitchChannel;
2017-07-02 18:12:11 +02:00
Resources &resources;
WindowManager &windowManager;
ColorScheme &colorScheme;
const Communi::IrcPrivateMessage *ircMessage;
messages::MessageParseArgs args;
const QVariantMap tags;
QString messageID;
2017-04-12 17:46:44 +02:00
QString userName;
2017-07-02 18:12:11 +02:00
messages::SharedMessage parse();
2017-04-12 17:46:44 +02:00
// static bool sortTwitchEmotes(
// const std::pair<long int, messages::LazyLoadedImage *> &a,
// const std::pair<long int, messages::LazyLoadedImage *> &b);
private:
QString roomID;
2017-07-02 18:12:11 +02:00
QColor usernameColor;
void parseMessageID();
void parseRoomID();
void parseChannelName();
void parseUsername();
void appendUsername();
void parseHighlights();
2017-07-02 18:12:11 +02:00
void appendModerationButtons();
void appendTwitchEmote(const Communi::IrcPrivateMessage *ircMessage, const QString &emote,
2017-12-17 02:18:13 +01:00
std::vector<std::pair<long, EmoteData>> &vec);
2017-07-23 09:53:50 +02:00
bool tryAppendEmote(QString &emoteString);
bool appendEmote(EmoteData &emoteData);
2017-07-02 18:12:11 +02:00
void parseTwitchBadges();
2017-08-12 13:20:52 +02:00
void parseChatterinoBadges();
2017-04-12 17:46:44 +02:00
};
} // namespace twitch
} // namespace chatterino