2017-01-05 16:07:20 +01:00
|
|
|
#ifndef WORD_H
|
|
|
|
#define WORD_H
|
|
|
|
|
|
|
|
#include "lazyloadedimage.h"
|
|
|
|
#include "fonts.h"
|
2017-01-05 20:49:33 +01:00
|
|
|
#include "link.h"
|
2017-01-05 17:02:05 +01:00
|
|
|
|
|
|
|
#include <QRect>
|
|
|
|
#include <QString>
|
2017-01-05 16:07:20 +01:00
|
|
|
|
|
|
|
class Word
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum Type : long int {
|
|
|
|
None = 0,
|
|
|
|
Misc = 1,
|
|
|
|
Text = 2,
|
|
|
|
|
|
|
|
TimestampNoSeconds = 4,
|
|
|
|
TimestampWithSeconds = 8,
|
|
|
|
|
|
|
|
TwitchEmoteImage = 0x10,
|
|
|
|
TwitchEmoteText = 0x20,
|
|
|
|
BttvEmoteImage = 0x40,
|
|
|
|
BttvEmoteText = 0x80,
|
|
|
|
BttvGifEmoteImage = 0x100,
|
|
|
|
BttvGifEmoteText = 0x200,
|
|
|
|
FfzEmoteImage = 0x400,
|
|
|
|
FfzEmoteText = 0x800,
|
|
|
|
|
|
|
|
Bits = 0x1000,
|
|
|
|
BitsAnimated = 0x2000,
|
|
|
|
|
|
|
|
BadgeStaff = 0x4000,
|
|
|
|
BadgeAdmin = 0x8000,
|
|
|
|
BadgeGlobalMod = 0x10000,
|
|
|
|
BadgeModerator = 0x20000,
|
|
|
|
BadgeTurbo = 0x40000,
|
|
|
|
BadgeBroadcaster = 0x80000,
|
|
|
|
BadgePremium = 0x100000,
|
|
|
|
BadgeChatterino = 0x200000,
|
2017-01-05 20:49:33 +01:00
|
|
|
BadgeCheer = 0x400000,
|
|
|
|
Badges = BadgeStaff
|
|
|
|
| BadgeAdmin
|
|
|
|
| BadgeGlobalMod
|
|
|
|
| BadgeModerator
|
|
|
|
| BadgeTurbo
|
|
|
|
| BadgeBroadcaster
|
|
|
|
| BadgePremium
|
|
|
|
| BadgeChatterino
|
|
|
|
| BadgeCheer,
|
|
|
|
|
|
|
|
Username = 0x800000,
|
2017-01-07 20:43:55 +01:00
|
|
|
BitsAmount = 0x1000000,
|
2017-01-05 20:49:33 +01:00
|
|
|
|
2017-01-07 20:43:55 +01:00
|
|
|
Default = TimestampNoSeconds | Badges | Username | Bits | FfzEmoteImage | BttvEmoteImage | BttvGifEmoteImage | TwitchEmoteImage | BitsAmount
|
2017-01-05 16:07:20 +01:00
|
|
|
};
|
|
|
|
|
2017-01-05 20:49:33 +01:00
|
|
|
explicit Word(LazyLoadedImage* m_image, Type type, const QString& copytext, const QString& tooltip, const Link& link = Link());
|
|
|
|
explicit Word(const QString& m_text, Type type, const QColor& color, const QString& copytext, const QString& tooltip, const Link& link = Link());
|
2017-01-05 16:07:20 +01:00
|
|
|
|
2017-01-07 20:43:55 +01:00
|
|
|
LazyLoadedImage& getImage() const {
|
2017-01-05 16:54:34 +01:00
|
|
|
return *m_image;
|
2017-01-05 16:07:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-07 20:43:55 +01:00
|
|
|
const QString& getText() const {
|
2017-01-05 16:54:34 +01:00
|
|
|
return m_text;
|
2017-01-05 16:07:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-07 20:43:55 +01:00
|
|
|
int width() const {
|
2017-01-05 16:07:20 +01:00
|
|
|
return m_width;
|
|
|
|
}
|
|
|
|
|
2017-01-07 20:43:55 +01:00
|
|
|
int height() const {
|
2017-01-05 16:07:20 +01:00
|
|
|
return m_height;
|
|
|
|
}
|
|
|
|
|
2017-01-07 20:43:55 +01:00
|
|
|
int x() const {
|
2017-01-05 16:07:20 +01:00
|
|
|
return m_x;
|
|
|
|
}
|
|
|
|
|
2017-01-07 20:43:55 +01:00
|
|
|
int y() const {
|
2017-01-05 16:07:20 +01:00
|
|
|
return m_y;
|
|
|
|
}
|
|
|
|
|
2017-01-07 20:43:55 +01:00
|
|
|
int right() const {
|
|
|
|
return m_x + m_width;
|
|
|
|
}
|
|
|
|
|
|
|
|
int bottom() const {
|
|
|
|
return m_y + m_height;
|
|
|
|
}
|
|
|
|
|
|
|
|
QRect rect() const {
|
2017-01-05 16:07:20 +01:00
|
|
|
return QRect(m_x, m_y, m_width, m_height);
|
|
|
|
}
|
|
|
|
|
2017-01-07 20:43:55 +01:00
|
|
|
bool isImage() const {
|
2017-01-05 16:07:20 +01:00
|
|
|
return m_isImage;
|
|
|
|
}
|
|
|
|
|
2017-01-07 20:43:55 +01:00
|
|
|
const QString& copyText() const {
|
2017-01-05 16:53:13 +01:00
|
|
|
return m_copyText;
|
2017-01-05 16:07:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-07 20:43:55 +01:00
|
|
|
bool hasTrailingSpace() const {
|
2017-01-05 16:07:20 +01:00
|
|
|
return m_hasTrailingSpace;
|
|
|
|
}
|
|
|
|
|
2017-01-07 20:43:55 +01:00
|
|
|
QFont& getFont() const {
|
2017-01-05 16:07:20 +01:00
|
|
|
return Fonts::getFont(m_font);
|
|
|
|
}
|
|
|
|
|
2017-01-07 20:43:55 +01:00
|
|
|
Type type() const {
|
2017-01-05 16:07:20 +01:00
|
|
|
return m_type;
|
|
|
|
}
|
|
|
|
|
2017-01-07 20:43:55 +01:00
|
|
|
const QString& tooltip() const {
|
2017-01-05 16:53:13 +01:00
|
|
|
return m_tooltip;
|
2017-01-05 16:07:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-07 20:43:55 +01:00
|
|
|
const QColor& color() const {
|
2017-01-05 20:49:33 +01:00
|
|
|
return m_color;
|
|
|
|
}
|
|
|
|
|
2017-01-07 20:43:55 +01:00
|
|
|
const Link& link() const {
|
2017-01-05 20:49:33 +01:00
|
|
|
return m_link;
|
|
|
|
}
|
|
|
|
|
2017-01-05 16:07:20 +01:00
|
|
|
private:
|
2017-01-05 16:54:34 +01:00
|
|
|
LazyLoadedImage* m_image;
|
|
|
|
QString m_text;
|
2017-01-05 20:49:33 +01:00
|
|
|
QColor m_color;
|
2017-01-05 16:07:20 +01:00
|
|
|
bool m_isImage;
|
|
|
|
|
|
|
|
Type m_type;
|
2017-01-05 16:53:13 +01:00
|
|
|
QString m_copyText;
|
|
|
|
QString m_tooltip;
|
2017-01-05 16:07:20 +01:00
|
|
|
int m_x;
|
|
|
|
int m_y;
|
|
|
|
int m_width;
|
|
|
|
int m_height;
|
|
|
|
bool m_hasTrailingSpace;
|
|
|
|
Fonts::Type m_font = Fonts::Medium;
|
2017-01-05 20:49:33 +01:00
|
|
|
Link m_link;
|
2017-01-05 16:07:20 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // WORD_H
|