2017-01-05 16:07:20 +01:00
|
|
|
#ifndef MESSAGE_H
|
|
|
|
#define MESSAGE_H
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
#include "channel.h"
|
2017-01-05 16:07:20 +01:00
|
|
|
#include "word.h"
|
2017-01-11 01:08:20 +01:00
|
|
|
#include "wordpart.h"
|
2017-01-05 16:07:20 +01:00
|
|
|
|
2017-01-11 01:08:20 +01:00
|
|
|
#include <IrcMessage>
|
|
|
|
#include <QVector>
|
|
|
|
#include <chrono>
|
|
|
|
|
2017-01-05 16:07:20 +01:00
|
|
|
class Message
|
|
|
|
{
|
|
|
|
public:
|
2017-01-11 18:52:09 +01:00
|
|
|
Message(const QString &text);
|
|
|
|
Message(const IrcPrivateMessage &ircMessage, const Channel &Channel,
|
|
|
|
bool enablePingSound = true, bool isReceivedWhisper = false,
|
|
|
|
bool isSentWhisper = false, bool includeChannel = false);
|
2017-01-05 16:07:20 +01:00
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
~Message()
|
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
if (wordParts != NULL) {
|
|
|
|
delete wordParts;
|
2017-01-11 01:08:20 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
bool
|
2017-01-18 04:33:30 +01:00
|
|
|
getCanHighlightTab() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return highlightTab;
|
2017-01-05 16:07:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
const QString &
|
2017-01-18 04:33:30 +01:00
|
|
|
getTimeoutUser() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return timeoutUser;
|
2017-01-05 16:07:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
int
|
2017-01-18 04:33:30 +01:00
|
|
|
getTimeoutCount() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return timeoutCount;
|
2017-01-05 16:07:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
const QString &
|
2017-01-18 04:33:30 +01:00
|
|
|
getUserName() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return userName;
|
2017-01-05 16:07:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
const QString &
|
2017-01-18 04:33:30 +01:00
|
|
|
getDisplayName() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return displayName;
|
2017-01-05 16:07:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
const std::vector<Word>
|
2017-01-18 04:33:30 +01:00
|
|
|
getWords() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return words;
|
2017-01-05 16:07:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-15 16:38:30 +01:00
|
|
|
const std::vector<WordPart>
|
2017-01-18 04:33:30 +01:00
|
|
|
getWordParts() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return *wordParts;
|
2017-01-11 01:08:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
bool
|
2017-01-18 04:33:30 +01:00
|
|
|
getDisabled() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return disabled;
|
2017-01-05 16:07:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
const QString &
|
2017-01-18 04:33:30 +01:00
|
|
|
getId() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return id;
|
2017-01-05 20:49:33 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
int
|
2017-01-18 04:33:30 +01:00
|
|
|
getHeight() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return height;
|
2017-01-11 01:08:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool layout(int width, bool enableEmoteMargins = true);
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
void
|
|
|
|
requestRelayout()
|
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
relayoutRequested = true;
|
2017-01-11 18:52:09 +01:00
|
|
|
}
|
2017-01-11 01:08:20 +01:00
|
|
|
|
2017-01-05 16:07:20 +01:00
|
|
|
private:
|
2017-01-11 18:52:09 +01:00
|
|
|
static LazyLoadedImage *badgeStaff;
|
|
|
|
static LazyLoadedImage *badgeAdmin;
|
|
|
|
static LazyLoadedImage *badgeGlobalmod;
|
|
|
|
static LazyLoadedImage *badgeModerator;
|
|
|
|
static LazyLoadedImage *badgeTurbo;
|
|
|
|
static LazyLoadedImage *badgeBroadcaster;
|
|
|
|
static LazyLoadedImage *badgePremium;
|
2017-01-05 16:07:20 +01:00
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
static QRegularExpression *cheerRegex;
|
2017-01-07 20:43:55 +01:00
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
bool highlightTab = false;
|
|
|
|
QString timeoutUser = "";
|
|
|
|
int timeoutCount = 0;
|
|
|
|
bool disabled = false;
|
|
|
|
std::chrono::time_point<std::chrono::system_clock> parseTime;
|
2017-01-05 16:07:20 +01:00
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
QString userName = "";
|
|
|
|
QString displayName = "";
|
|
|
|
QString id = "";
|
2017-01-05 16:07:20 +01:00
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
int height = 0;
|
2017-01-11 01:08:20 +01:00
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
std::vector<Word> words;
|
|
|
|
std::vector<WordPart> *wordParts;
|
2017-01-11 01:08:20 +01:00
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
long currentLayoutWidth = -1;
|
|
|
|
bool relayoutRequested = true;
|
|
|
|
int fontGeneration = -1;
|
|
|
|
int emoteGeneration = -1;
|
2017-01-06 23:28:48 +01:00
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
static QString matchLink(const QString &string);
|
2017-01-07 20:43:55 +01:00
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
static bool sortTwitchEmotes(
|
|
|
|
const std::pair<long int, LazyLoadedImage *> &a,
|
|
|
|
const std::pair<long int, LazyLoadedImage *> &b);
|
2017-01-05 16:07:20 +01:00
|
|
|
};
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
#endif // MESSAGE_H
|