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-11 01:08:20 +01:00
|
|
|
if (m_wordParts != NULL) {
|
|
|
|
delete m_wordParts;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
bool
|
|
|
|
canHighlightTab() const
|
|
|
|
{
|
2017-01-05 16:07:20 +01:00
|
|
|
return m_highlightTab;
|
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
const QString &
|
|
|
|
timeoutUser() const
|
|
|
|
{
|
2017-01-05 16:07:20 +01:00
|
|
|
return m_timeoutUser;
|
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
int
|
|
|
|
timeoutCount() const
|
|
|
|
{
|
2017-01-05 16:07:20 +01:00
|
|
|
return m_timeoutCount;
|
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
const QString &
|
|
|
|
userName() const
|
|
|
|
{
|
2017-01-05 16:07:20 +01:00
|
|
|
return m_userName;
|
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
const QString &
|
|
|
|
displayName() const
|
|
|
|
{
|
2017-01-05 16:07:20 +01:00
|
|
|
return m_displayName;
|
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
const std::vector<Word>
|
|
|
|
words() const
|
|
|
|
{
|
2017-01-05 16:07:20 +01:00
|
|
|
return m_words;
|
|
|
|
}
|
|
|
|
|
2017-01-15 16:38:30 +01:00
|
|
|
const std::vector<WordPart>
|
2017-01-11 18:52:09 +01:00
|
|
|
wordParts() const
|
|
|
|
{
|
2017-01-11 01:08:20 +01:00
|
|
|
return *m_wordParts;
|
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
bool
|
|
|
|
disabled() const
|
|
|
|
{
|
2017-01-05 16:07:20 +01:00
|
|
|
return m_disabled;
|
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
const QString &
|
|
|
|
id() const
|
|
|
|
{
|
2017-01-05 20:49:33 +01:00
|
|
|
return m_id;
|
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
int
|
|
|
|
height() const
|
|
|
|
{
|
2017-01-11 01:08:20 +01:00
|
|
|
return m_height;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool layout(int width, bool enableEmoteMargins = true);
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
void
|
|
|
|
requestRelayout()
|
|
|
|
{
|
|
|
|
m_relayoutRequested = true;
|
|
|
|
}
|
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-05 16:07:20 +01:00
|
|
|
bool m_highlightTab = false;
|
|
|
|
QString m_timeoutUser = "";
|
|
|
|
int m_timeoutCount = 0;
|
|
|
|
bool m_disabled = false;
|
|
|
|
std::chrono::time_point<std::chrono::system_clock> m_parseTime;
|
|
|
|
|
|
|
|
QString m_userName = "";
|
|
|
|
QString m_displayName = "";
|
2017-01-05 20:49:33 +01:00
|
|
|
QString m_id = "";
|
2017-01-05 16:07:20 +01:00
|
|
|
|
2017-01-11 01:08:20 +01:00
|
|
|
int m_height = 0;
|
|
|
|
|
|
|
|
std::vector<Word> m_words;
|
2017-01-15 16:38:30 +01:00
|
|
|
std::vector<WordPart> *m_wordParts;
|
2017-01-11 01:08:20 +01:00
|
|
|
|
|
|
|
long m_currentLayoutWidth = -1;
|
|
|
|
bool m_relayoutRequested = true;
|
2017-01-15 16:38:30 +01:00
|
|
|
int m_fontGeneration = -1;
|
|
|
|
int m_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
|