mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
added emote loading
This commit is contained in:
parent
0fbc40a52a
commit
4dbe2b0254
Binary file not shown.
|
@ -9,11 +9,11 @@ Channel Channel::mentions(QString("/mentions"));
|
||||||
QMap<QString, Channel *> Channel::channels = QMap<QString, Channel *>();
|
QMap<QString, Channel *> Channel::channels = QMap<QString, Channel *>();
|
||||||
|
|
||||||
Channel::Channel(QString channel)
|
Channel::Channel(QString channel)
|
||||||
: m_name((channel.length() > 0 && channel[0] == '#') ? channel.mid(1)
|
: m_messages()
|
||||||
|
, m_name((channel.length() > 0 && channel[0] == '#') ? channel.mid(1)
|
||||||
: channel)
|
: channel)
|
||||||
, m_bttvChannelEmotes()
|
, m_bttvChannelEmotes()
|
||||||
, m_ffzChannelEmotes()
|
, m_ffzChannelEmotes()
|
||||||
, m_messages()
|
|
||||||
, m_messageMutex()
|
, m_messageMutex()
|
||||||
, m_subLink("https://www.twitch.tv/" + m_name +
|
, m_subLink("https://www.twitch.tv/" + m_name +
|
||||||
"/subscribe?ref=in_chat_subscriber_link")
|
"/subscribe?ref=in_chat_subscriber_link")
|
||||||
|
|
|
@ -104,10 +104,6 @@ public:
|
||||||
private:
|
private:
|
||||||
Channel(QString channel);
|
Channel(QString channel);
|
||||||
|
|
||||||
ConcurrentMap<QString, LazyLoadedImage *> m_bttvChannelEmotes;
|
|
||||||
ConcurrentMap<QString, LazyLoadedImage *> m_ffzChannelEmotes;
|
|
||||||
QMutex m_messageMutex;
|
|
||||||
|
|
||||||
int m_referenceCount = 0;
|
int m_referenceCount = 0;
|
||||||
|
|
||||||
QVector<std::shared_ptr<Message>> m_messages;
|
QVector<std::shared_ptr<Message>> m_messages;
|
||||||
|
@ -115,6 +111,10 @@ private:
|
||||||
QString m_name;
|
QString m_name;
|
||||||
int m_roomID;
|
int m_roomID;
|
||||||
|
|
||||||
|
ConcurrentMap<QString, LazyLoadedImage *> m_bttvChannelEmotes;
|
||||||
|
ConcurrentMap<QString, LazyLoadedImage *> m_ffzChannelEmotes;
|
||||||
|
QMutex m_messageMutex;
|
||||||
|
|
||||||
QString m_subLink;
|
QString m_subLink;
|
||||||
QString m_channelLink;
|
QString m_channelLink;
|
||||||
QString m_popoutPlayerLink;
|
QString m_popoutPlayerLink;
|
||||||
|
|
|
@ -8,6 +8,9 @@ QT += core gui network
|
||||||
CONFIG += communi
|
CONFIG += communi
|
||||||
COMMUNI += core model util
|
COMMUNI += core model util
|
||||||
|
|
||||||
|
win32:LIBS += -LC:/OpenSSL-Win32/lib/openssl.lib
|
||||||
|
INCLUDEPATH += C:/OpenSSL-Win32/include
|
||||||
|
|
||||||
include(lib/libcommuni/src/src.pri)
|
include(lib/libcommuni/src/src.pri)
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
@ -57,7 +60,8 @@ SOURCES += main.cpp\
|
||||||
fonts.cpp \
|
fonts.cpp \
|
||||||
appsettings.cpp \
|
appsettings.cpp \
|
||||||
emojis.cpp \
|
emojis.cpp \
|
||||||
wordpart.cpp
|
wordpart.cpp \
|
||||||
|
resources.cpp
|
||||||
|
|
||||||
HEADERS += mainwindow.h \
|
HEADERS += mainwindow.h \
|
||||||
chatwidget.h \
|
chatwidget.h \
|
||||||
|
@ -91,7 +95,8 @@ HEADERS += mainwindow.h \
|
||||||
appsettings.h \
|
appsettings.h \
|
||||||
emojis.h \
|
emojis.h \
|
||||||
wordpart.h \
|
wordpart.h \
|
||||||
common.h
|
common.h \
|
||||||
|
resources.h
|
||||||
|
|
||||||
PRECOMPILED_HEADER =
|
PRECOMPILED_HEADER =
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,8 @@ ChatWidgetView::resizeEvent(QResizeEvent *)
|
||||||
auto messages = c->getMessagesClone();
|
auto messages = c->getMessagesClone();
|
||||||
|
|
||||||
for (std::shared_ptr<Message> &message : messages) {
|
for (std::shared_ptr<Message> &message : messages) {
|
||||||
message.get()->layout(width(), true);
|
qInfo(QString::number(width()).toStdString().c_str());
|
||||||
|
message.get()->layout(this->width(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,18 +49,22 @@ ChatWidgetView::paintEvent(QPaintEvent *)
|
||||||
|
|
||||||
auto messages = c->getMessagesClone();
|
auto messages = c->getMessagesClone();
|
||||||
|
|
||||||
int y = 0;
|
int y = 32;
|
||||||
|
|
||||||
for (std::shared_ptr<Message> const &message : messages) {
|
for (std::shared_ptr<Message> const &message : messages) {
|
||||||
for (WordPart const &wordPart : message.get()->wordParts()) {
|
for (WordPart const &wordPart : message.get()->wordParts()) {
|
||||||
|
painter.setPen(QColor(255, 0, 0));
|
||||||
|
painter.drawRect(wordPart.x(), wordPart.y() + y, wordPart.width(),
|
||||||
|
wordPart.height());
|
||||||
|
|
||||||
// image
|
// image
|
||||||
if (wordPart.word().isImage()) {
|
if (wordPart.word().isImage()) {
|
||||||
LazyLoadedImage &lli = wordPart.word().getImage();
|
LazyLoadedImage &lli = wordPart.word().getImage();
|
||||||
|
|
||||||
const QImage *image = lli.image();
|
const QPixmap *image = lli.pixmap();
|
||||||
|
|
||||||
if (image != NULL) {
|
if (image != NULL) {
|
||||||
painter.drawImage(
|
painter.drawPixmap(
|
||||||
QRect(wordPart.x(), wordPart.y() + y, wordPart.width(),
|
QRect(wordPart.x(), wordPart.y() + y, wordPart.width(),
|
||||||
wordPart.height()),
|
wordPart.height()),
|
||||||
*image);
|
*image);
|
||||||
|
@ -70,8 +75,10 @@ ChatWidgetView::paintEvent(QPaintEvent *)
|
||||||
painter.setPen(wordPart.word().color());
|
painter.setPen(wordPart.word().color());
|
||||||
painter.setFont(wordPart.word().getFont());
|
painter.setFont(wordPart.word().getFont());
|
||||||
|
|
||||||
painter.drawText(wordPart.x(), wordPart.y() + y,
|
painter.drawText(
|
||||||
wordPart.getText());
|
QRectF(wordPart.x(), wordPart.y() + y, 10000, 10000),
|
||||||
|
wordPart.getText(),
|
||||||
|
QTextOption(Qt::AlignLeft | Qt::AlignTop));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ Emojis::parseEmojis(std::vector<std::tuple<LazyLoadedImage *, QString>> &vector,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Emojis::initEmojis()
|
Emojis::loadEmojis()
|
||||||
{
|
{
|
||||||
QFile file(":/emojidata.txt");
|
QFile file(":/emojidata.txt");
|
||||||
file.open(QFile::ReadOnly);
|
file.open(QFile::ReadOnly);
|
||||||
|
|
2
emojis.h
2
emojis.h
|
@ -16,7 +16,7 @@ public:
|
||||||
std::vector<std::tuple<LazyLoadedImage *, QString>> &vector,
|
std::vector<std::tuple<LazyLoadedImage *, QString>> &vector,
|
||||||
const QString &text);
|
const QString &text);
|
||||||
|
|
||||||
static void initEmojis();
|
static void loadEmojis();
|
||||||
|
|
||||||
static QString replaceShortCodes(const QString &text);
|
static QString replaceShortCodes(const QString &text);
|
||||||
|
|
||||||
|
|
70
emotes.cpp
70
emotes.cpp
|
@ -1,35 +1,17 @@
|
||||||
#include "emotes.h"
|
#include "emotes.h"
|
||||||
|
#include "resources.h"
|
||||||
|
|
||||||
ConcurrentMap<QString, TwitchEmoteValue *> *Emotes::m_twitchEmotes =
|
QString Emotes::m_twitchEmoteTemplate(
|
||||||
new ConcurrentMap<QString, TwitchEmoteValue *>();
|
"http://static-cdn.jtvnw.net/emoticons/v1/{id}/{scale}.0");
|
||||||
ConcurrentMap<QString, LazyLoadedImage *> *Emotes::m_bttvEmotes =
|
|
||||||
new ConcurrentMap<QString, LazyLoadedImage *>();
|
|
||||||
ConcurrentMap<QString, LazyLoadedImage *> *Emotes::m_ffzEmotes =
|
|
||||||
new ConcurrentMap<QString, LazyLoadedImage *>();
|
|
||||||
ConcurrentMap<QString, LazyLoadedImage *> *Emotes::m_chatterinoEmotes =
|
|
||||||
new ConcurrentMap<QString, LazyLoadedImage *>();
|
|
||||||
ConcurrentMap<QString, LazyLoadedImage *>
|
|
||||||
*Emotes::m_bttvChannelEmoteFromCaches =
|
|
||||||
new ConcurrentMap<QString, LazyLoadedImage *>();
|
|
||||||
ConcurrentMap<QString, LazyLoadedImage *> *Emotes::m_ffzChannelEmoteFromCaches =
|
|
||||||
new ConcurrentMap<QString, LazyLoadedImage *>();
|
|
||||||
ConcurrentMap<int, LazyLoadedImage *> *Emotes::m_twitchEmoteFromCache =
|
|
||||||
new ConcurrentMap<int, LazyLoadedImage *>();
|
|
||||||
ConcurrentMap<QString, LazyLoadedImage *> *Emotes::m_miscImageFromCache =
|
|
||||||
new ConcurrentMap<QString, LazyLoadedImage *>();
|
|
||||||
|
|
||||||
LazyLoadedImage *Emotes::m_cheerBadge100000 =
|
ConcurrentMap<QString, TwitchEmoteValue *> Emotes::m_twitchEmotes;
|
||||||
new LazyLoadedImage(new QImage(":/cheer100000"));
|
ConcurrentMap<QString, LazyLoadedImage *> Emotes::m_bttvEmotes;
|
||||||
LazyLoadedImage *Emotes::m_cheerBadge10000 =
|
ConcurrentMap<QString, LazyLoadedImage *> Emotes::m_ffzEmotes;
|
||||||
new LazyLoadedImage(new QImage(":/cheer10000"));
|
ConcurrentMap<QString, LazyLoadedImage *> Emotes::m_chatterinoEmotes;
|
||||||
LazyLoadedImage *Emotes::m_cheerBadge5000 =
|
ConcurrentMap<QString, LazyLoadedImage *> Emotes::m_bttvChannelEmoteFromCaches;
|
||||||
new LazyLoadedImage(new QImage(":/cheer5000"));
|
ConcurrentMap<QString, LazyLoadedImage *> Emotes::m_ffzChannelEmoteFromCaches;
|
||||||
LazyLoadedImage *Emotes::m_cheerBadge1000 =
|
ConcurrentMap<long, LazyLoadedImage *> Emotes::m_twitchEmoteFromCache;
|
||||||
new LazyLoadedImage(new QImage(":/cheer1000"));
|
ConcurrentMap<QString, LazyLoadedImage *> Emotes::m_miscImageFromCache;
|
||||||
LazyLoadedImage *Emotes::m_cheerBadge100 =
|
|
||||||
new LazyLoadedImage(new QImage(":/cheer100"));
|
|
||||||
LazyLoadedImage *Emotes::m_cheerBadge1 =
|
|
||||||
new LazyLoadedImage(new QImage(":/cheer1"));
|
|
||||||
|
|
||||||
Emotes::Emotes()
|
Emotes::Emotes()
|
||||||
{
|
{
|
||||||
|
@ -38,9 +20,21 @@ Emotes::Emotes()
|
||||||
LazyLoadedImage *
|
LazyLoadedImage *
|
||||||
Emotes::getTwitchEmoteById(const QString &name, long id)
|
Emotes::getTwitchEmoteById(const QString &name, long id)
|
||||||
{
|
{
|
||||||
#pragma message WARN("xD")
|
return m_twitchEmoteFromCache.getOrAdd(id, [&name, id] {
|
||||||
return new LazyLoadedImage(NULL);
|
qreal scale;
|
||||||
// return m_twitchEmoteFromCache->getOrAdd()
|
QString url = getTwitchEmoteLink(id, scale);
|
||||||
|
|
||||||
|
return new LazyLoadedImage(url, scale, name, name + "\nTwitch Emote");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
QString
|
||||||
|
Emotes::getTwitchEmoteLink(long id, qreal &scale)
|
||||||
|
{
|
||||||
|
scale = .5;
|
||||||
|
|
||||||
|
return m_twitchEmoteTemplate.replace("{id}", QString::number(id))
|
||||||
|
.replace("{scale}", "2");
|
||||||
}
|
}
|
||||||
|
|
||||||
LazyLoadedImage *
|
LazyLoadedImage *
|
||||||
|
@ -54,16 +48,16 @@ LazyLoadedImage *
|
||||||
Emotes::getCheerBadge(long long amount)
|
Emotes::getCheerBadge(long long amount)
|
||||||
{
|
{
|
||||||
if (amount >= 100000) {
|
if (amount >= 100000) {
|
||||||
return m_cheerBadge100000;
|
return Resources::cheerBadge100000();
|
||||||
} else if (amount >= 10000) {
|
} else if (amount >= 10000) {
|
||||||
return m_cheerBadge10000;
|
return Resources::cheerBadge10000();
|
||||||
} else if (amount >= 5000) {
|
} else if (amount >= 5000) {
|
||||||
return m_cheerBadge5000;
|
return Resources::cheerBadge5000();
|
||||||
} else if (amount >= 1000) {
|
} else if (amount >= 1000) {
|
||||||
return m_cheerBadge1000;
|
return Resources::cheerBadge1000();
|
||||||
} else if (amount >= 100) {
|
} else if (amount >= 100) {
|
||||||
return m_cheerBadge100;
|
return Resources::cheerBadge100();
|
||||||
} else {
|
} else {
|
||||||
return m_cheerBadge1;
|
return Resources::cheerBadge1();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
54
emotes.h
54
emotes.h
|
@ -13,42 +13,49 @@ public:
|
||||||
static ConcurrentMap<QString, TwitchEmoteValue *> &
|
static ConcurrentMap<QString, TwitchEmoteValue *> &
|
||||||
twitchEmotes()
|
twitchEmotes()
|
||||||
{
|
{
|
||||||
return *m_twitchEmotes;
|
return m_twitchEmotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> &
|
static ConcurrentMap<QString, LazyLoadedImage *> &
|
||||||
bttvEmotes()
|
bttvEmotes()
|
||||||
{
|
{
|
||||||
return *m_bttvEmotes;
|
return m_bttvEmotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> &
|
static ConcurrentMap<QString, LazyLoadedImage *> &
|
||||||
ffzEmotes()
|
ffzEmotes()
|
||||||
{
|
{
|
||||||
return *m_ffzEmotes;
|
return m_ffzEmotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> &
|
static ConcurrentMap<QString, LazyLoadedImage *> &
|
||||||
chatterinoEmotes()
|
chatterinoEmotes()
|
||||||
{
|
{
|
||||||
return *m_chatterinoEmotes;
|
return m_chatterinoEmotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> &
|
static ConcurrentMap<QString, LazyLoadedImage *> &
|
||||||
bttvChannelEmoteFromCaches()
|
bttvChannelEmoteFromCaches()
|
||||||
{
|
{
|
||||||
return *m_bttvChannelEmoteFromCaches;
|
return m_bttvChannelEmoteFromCaches;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> &
|
static ConcurrentMap<QString, LazyLoadedImage *> &
|
||||||
ffzChannelEmoteFromCaches()
|
ffzChannelEmoteFromCaches()
|
||||||
{
|
{
|
||||||
return *m_ffzChannelEmoteFromCaches;
|
return m_ffzChannelEmoteFromCaches;
|
||||||
}
|
}
|
||||||
static ConcurrentMap<int, LazyLoadedImage *> &
|
|
||||||
|
static ConcurrentMap<long, LazyLoadedImage *> &
|
||||||
twitchEmoteFromCache()
|
twitchEmoteFromCache()
|
||||||
{
|
{
|
||||||
return *m_twitchEmoteFromCache;
|
return m_twitchEmoteFromCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> &
|
static ConcurrentMap<QString, LazyLoadedImage *> &
|
||||||
miscImageFromCache()
|
miscImageFromCache()
|
||||||
{
|
{
|
||||||
return *m_miscImageFromCache;
|
return m_miscImageFromCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void loadGlobalEmotes();
|
static void loadGlobalEmotes();
|
||||||
|
@ -62,23 +69,20 @@ public:
|
||||||
private:
|
private:
|
||||||
Emotes();
|
Emotes();
|
||||||
|
|
||||||
static ConcurrentMap<QString, TwitchEmoteValue *> *m_twitchEmotes;
|
static QString m_twitchEmoteTemplate;
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> *m_bttvEmotes;
|
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> *m_ffzEmotes;
|
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> *m_chatterinoEmotes;
|
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *>
|
|
||||||
*m_bttvChannelEmoteFromCaches;
|
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *>
|
|
||||||
*m_ffzChannelEmoteFromCaches;
|
|
||||||
static ConcurrentMap<int, LazyLoadedImage *> *m_twitchEmoteFromCache;
|
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> *m_miscImageFromCache;
|
|
||||||
|
|
||||||
static LazyLoadedImage *m_cheerBadge100000;
|
static ConcurrentMap<QString, TwitchEmoteValue *> m_twitchEmotes;
|
||||||
static LazyLoadedImage *m_cheerBadge10000;
|
static ConcurrentMap<QString, LazyLoadedImage *> m_bttvEmotes;
|
||||||
static LazyLoadedImage *m_cheerBadge5000;
|
static ConcurrentMap<QString, LazyLoadedImage *> m_ffzEmotes;
|
||||||
static LazyLoadedImage *m_cheerBadge1000;
|
static ConcurrentMap<QString, LazyLoadedImage *> m_chatterinoEmotes;
|
||||||
static LazyLoadedImage *m_cheerBadge100;
|
static ConcurrentMap<QString, LazyLoadedImage *>
|
||||||
static LazyLoadedImage *m_cheerBadge1;
|
m_bttvChannelEmoteFromCaches;
|
||||||
|
static ConcurrentMap<QString, LazyLoadedImage *>
|
||||||
|
m_ffzChannelEmoteFromCaches;
|
||||||
|
static ConcurrentMap<long, LazyLoadedImage *> m_twitchEmoteFromCache;
|
||||||
|
static ConcurrentMap<QString, LazyLoadedImage *> m_miscImageFromCache;
|
||||||
|
|
||||||
|
static QString getTwitchEmoteLink(long id, qreal &scale);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EMOTES_H
|
#endif // EMOTES_H
|
||||||
|
|
|
@ -121,6 +121,7 @@ IrcManager::beginConnecting()
|
||||||
c->setRealName("justinfan123");
|
c->setRealName("justinfan123");
|
||||||
c->sendRaw("JOIN #fourtf");
|
c->sendRaw("JOIN #fourtf");
|
||||||
c->sendRaw("JOIN #ian678");
|
c->sendRaw("JOIN #ian678");
|
||||||
|
c->sendRaw("JOIN #nuuls");
|
||||||
|
|
||||||
c->sendCommand(IrcCommand::createCapability("REQ", "twitch.tv/commands"));
|
c->sendCommand(IrcCommand::createCapability("REQ", "twitch.tv/commands"));
|
||||||
c->sendCommand(IrcCommand::createCapability("REQ", "twitch.tv/tags"));
|
c->sendCommand(IrcCommand::createCapability("REQ", "twitch.tv/tags"));
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
LazyLoadedImage::LazyLoadedImage(const QString &url, qreal scale,
|
LazyLoadedImage::LazyLoadedImage(const QString &url, qreal scale,
|
||||||
const QString &name, const QString &tooltip,
|
const QString &name, const QString &tooltip,
|
||||||
const QMargins &margin, bool isHat)
|
const QMargins &margin, bool isHat)
|
||||||
: m_image(NULL)
|
: m_pixmap(NULL)
|
||||||
, m_url(url)
|
, m_url(url)
|
||||||
, m_name(name)
|
, m_name(name)
|
||||||
, m_tooltip(tooltip)
|
, m_tooltip(tooltip)
|
||||||
|
@ -23,16 +23,17 @@ LazyLoadedImage::LazyLoadedImage(const QString &url, qreal scale,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LazyLoadedImage::LazyLoadedImage(QImage *image, qreal scale,
|
LazyLoadedImage::LazyLoadedImage(QPixmap *image, qreal scale,
|
||||||
const QString &name, const QString &tooltip,
|
const QString &name, const QString &tooltip,
|
||||||
const QMargins &margin, bool isHat)
|
const QMargins &margin, bool isHat)
|
||||||
: m_name(name)
|
: m_pixmap(image)
|
||||||
|
, m_url()
|
||||||
|
, m_name(name)
|
||||||
, m_tooltip(tooltip)
|
, m_tooltip(tooltip)
|
||||||
, m_animated(false)
|
, m_animated(false)
|
||||||
, m_margin(margin)
|
, m_margin(margin)
|
||||||
, m_ishat(isHat)
|
, m_ishat(isHat)
|
||||||
, m_scale(scale)
|
, m_scale(scale)
|
||||||
, m_image(image)
|
|
||||||
, m_isLoading(true)
|
, m_isLoading(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -40,13 +41,21 @@ LazyLoadedImage::LazyLoadedImage(QImage *image, qreal scale,
|
||||||
void
|
void
|
||||||
LazyLoadedImage::loadImage()
|
LazyLoadedImage::loadImage()
|
||||||
{
|
{
|
||||||
QString url = m_url;
|
// QThreadPool::globalInstance()->start(new LambdaQRunnable([=] {
|
||||||
|
QUrl url(m_url);
|
||||||
|
QNetworkRequest request(url);
|
||||||
|
|
||||||
async_exec([url] {
|
QNetworkReply *reply = IrcManager::accessManager().get(request);
|
||||||
QNetworkRequest req(QUrl(url));
|
|
||||||
|
|
||||||
QNetworkReply *reply = IrcManager::accessManager().get(req);
|
QObject::connect(reply, &QNetworkReply::finished, [=] {
|
||||||
|
QPixmap *pixmap = new QPixmap();
|
||||||
|
pixmap->loadFromData(reply->readAll());
|
||||||
|
|
||||||
QObject::connect(reply, &QNetworkReply::finished, [=] {});
|
if (pixmap->isNull()) {
|
||||||
})
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pixmap = pixmap;
|
||||||
|
});
|
||||||
|
//}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef LAZYLOADEDIMAGE_H
|
#ifndef LAZYLOADEDIMAGE_H
|
||||||
#define LAZYLOADEDIMAGE_H
|
#define LAZYLOADEDIMAGE_H
|
||||||
|
|
||||||
#include <QImage>
|
#include <QPixmap>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
class LazyLoadedImage
|
class LazyLoadedImage
|
||||||
|
@ -10,19 +10,19 @@ public:
|
||||||
LazyLoadedImage(const QString &url, qreal scale = 1,
|
LazyLoadedImage(const QString &url, qreal scale = 1,
|
||||||
const QString &name = "", const QString &tooltip = "",
|
const QString &name = "", const QString &tooltip = "",
|
||||||
const QMargins &margin = QMargins(), bool isHat = false);
|
const QMargins &margin = QMargins(), bool isHat = false);
|
||||||
LazyLoadedImage(QImage *image, qreal scale = 1, const QString &name = "",
|
LazyLoadedImage(QPixmap *pixmap, qreal scale = 1, const QString &name = "",
|
||||||
const QString &tooltip = "",
|
const QString &tooltip = "",
|
||||||
const QMargins &margin = QMargins(), bool isHat = false);
|
const QMargins &margin = QMargins(), bool isHat = false);
|
||||||
|
|
||||||
const QImage *
|
const QPixmap *
|
||||||
image()
|
pixmap()
|
||||||
{
|
{
|
||||||
if (!m_isLoading) {
|
if (!m_isLoading) {
|
||||||
m_isLoading = true;
|
m_isLoading = true;
|
||||||
|
|
||||||
loadImage();
|
loadImage();
|
||||||
}
|
}
|
||||||
return m_image;
|
return m_pixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal
|
qreal
|
||||||
|
@ -67,27 +67,26 @@ public:
|
||||||
return m_ishat;
|
return m_ishat;
|
||||||
}
|
}
|
||||||
|
|
||||||
const long
|
int
|
||||||
width() const
|
width() const
|
||||||
{
|
{
|
||||||
if (m_image == NULL) {
|
if (m_pixmap == NULL) {
|
||||||
return 16;
|
return 16;
|
||||||
}
|
}
|
||||||
return m_image->width();
|
return m_pixmap->width();
|
||||||
}
|
}
|
||||||
|
|
||||||
const long
|
int
|
||||||
height() const
|
height() const
|
||||||
{
|
{
|
||||||
if (m_image == NULL) {
|
if (m_pixmap == NULL) {
|
||||||
return 16;
|
return 16;
|
||||||
}
|
}
|
||||||
return m_image->height();
|
return m_pixmap->height();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QImage *m_image;
|
QPixmap *m_pixmap;
|
||||||
qreal m_scale;
|
|
||||||
|
|
||||||
QString m_url;
|
QString m_url;
|
||||||
QString m_name;
|
QString m_name;
|
||||||
|
@ -95,6 +94,7 @@ private:
|
||||||
bool m_animated;
|
bool m_animated;
|
||||||
QMargins m_margin;
|
QMargins m_margin;
|
||||||
bool m_ishat;
|
bool m_ishat;
|
||||||
|
qreal m_scale;
|
||||||
|
|
||||||
bool m_isLoading;
|
bool m_isLoading;
|
||||||
|
|
||||||
|
|
11
main.cpp
11
main.cpp
|
@ -1,16 +1,19 @@
|
||||||
#include "mainwindow.h"
|
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
#include "ircmanager.h"
|
|
||||||
#include "emojis.h"
|
#include "emojis.h"
|
||||||
|
#include "ircmanager.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
|
#include "resources.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
Emojis::initEmojis();
|
Resources::load();
|
||||||
|
Emojis::loadEmojis();
|
||||||
|
|
||||||
ColorScheme::instance().setColors(0, -0.8);
|
ColorScheme::instance().setColors(0, -0.8);
|
||||||
|
|
||||||
|
|
136
message.cpp
136
message.cpp
|
@ -7,6 +7,7 @@
|
||||||
#include "ircmanager.h"
|
#include "ircmanager.h"
|
||||||
#include "link.h"
|
#include "link.h"
|
||||||
#include "qcolor.h"
|
#include "qcolor.h"
|
||||||
|
#include "resources.h"
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
@ -18,21 +19,6 @@
|
||||||
#define MARGIN_TOP 8
|
#define MARGIN_TOP 8
|
||||||
#define MARGIN_BOTTOM 8
|
#define MARGIN_BOTTOM 8
|
||||||
|
|
||||||
LazyLoadedImage *Message::badgeStaff =
|
|
||||||
new LazyLoadedImage(new QImage(":/images/staff_bg.png"));
|
|
||||||
LazyLoadedImage *Message::badgeAdmin =
|
|
||||||
new LazyLoadedImage(new QImage(":/images/admin_bg.png"));
|
|
||||||
LazyLoadedImage *Message::badgeModerator =
|
|
||||||
new LazyLoadedImage(new QImage(":/images/moderator_bg.png"));
|
|
||||||
LazyLoadedImage *Message::badgeGlobalmod =
|
|
||||||
new LazyLoadedImage(new QImage(":/images/globalmod_bg.png"));
|
|
||||||
LazyLoadedImage *Message::badgeTurbo =
|
|
||||||
new LazyLoadedImage(new QImage(":/images/turbo_bg.png"));
|
|
||||||
LazyLoadedImage *Message::badgeBroadcaster =
|
|
||||||
new LazyLoadedImage(new QImage(":/images/broadcaster_bg.png"));
|
|
||||||
LazyLoadedImage *Message::badgePremium =
|
|
||||||
new LazyLoadedImage(new QImage(":/images/twitchprime_bg.png"));
|
|
||||||
|
|
||||||
QRegularExpression *Message::cheerRegex =
|
QRegularExpression *Message::cheerRegex =
|
||||||
new QRegularExpression("cheer[1-9][0-9]*");
|
new QRegularExpression("cheer[1-9][0-9]*");
|
||||||
|
|
||||||
|
@ -60,12 +46,14 @@ Message::Message(const IrcPrivateMessage &ircMessage, const Channel &channel,
|
||||||
|
|
||||||
// timestamps
|
// timestamps
|
||||||
iterator = tags.find("tmi-sent-ts");
|
iterator = tags.find("tmi-sent-ts");
|
||||||
|
|
||||||
std::time_t time = std::time(NULL);
|
std::time_t time = std::time(NULL);
|
||||||
|
|
||||||
if (iterator != tags.end()) {
|
// if (iterator != tags.end()) {
|
||||||
time = strtoll(iterator.value().toString().toStdString().c_str(), NULL,
|
// time = strtoll(iterator.value().toString().toStdString().c_str(),
|
||||||
10);
|
// NULL,
|
||||||
}
|
// 10);
|
||||||
|
// }
|
||||||
|
|
||||||
char timeStampBuffer[69];
|
char timeStampBuffer[69];
|
||||||
|
|
||||||
|
@ -96,29 +84,31 @@ Message::Message(const IrcPrivateMessage &ircMessage, const Channel &channel,
|
||||||
Emotes::getCheerBadge(cheer), Word::BadgeCheer, QString(),
|
Emotes::getCheerBadge(cheer), Word::BadgeCheer, QString(),
|
||||||
QString("Twitch Cheer" + QString::number(cheer))));
|
QString("Twitch Cheer" + QString::number(cheer))));
|
||||||
} else if (badge == "staff/1") {
|
} else if (badge == "staff/1") {
|
||||||
words.push_back(Word(badgeStaff, Word::BadgeStaff, QString(),
|
words.push_back(Word(Resources::badgeStaff(), Word::BadgeStaff,
|
||||||
QString("Twitch Staff")));
|
QString(), QString("Twitch Staff")));
|
||||||
} else if (badge == "admin/1") {
|
} else if (badge == "admin/1") {
|
||||||
words.push_back(Word(badgeAdmin, Word::BadgeAdmin, QString(),
|
words.push_back(Word(Resources::badgeAdmin(), Word::BadgeAdmin,
|
||||||
QString("Twitch Admin")));
|
QString(), QString("Twitch Admin")));
|
||||||
} else if (badge == "global_mod/1") {
|
} else if (badge == "global_mod/1") {
|
||||||
words.push_back(Word(badgeGlobalmod, Word::BadgeGlobalMod,
|
words.push_back(Word(Resources::badgeGlobalmod(),
|
||||||
QString(), QString("Global Moderator")));
|
Word::BadgeGlobalMod, QString(),
|
||||||
|
QString("Global Moderator")));
|
||||||
} else if (badge == "moderator/1") {
|
} else if (badge == "moderator/1") {
|
||||||
#pragma message WARN("xD")
|
#pragma message WARN("xD")
|
||||||
words.push_back(
|
words.push_back(Word(
|
||||||
Word(badgeTurbo, Word::BadgeModerator, QString(),
|
Resources::badgeTurbo(), Word::BadgeModerator, QString(),
|
||||||
QString("Channel Moderator"))); // custom badge
|
QString("Channel Moderator"))); // custom badge
|
||||||
} else if (badge == "turbo/1") {
|
} else if (badge == "turbo/1") {
|
||||||
words.push_back(Word(badgeStaff, Word::BadgeTurbo, QString(),
|
words.push_back(Word(Resources::badgeStaff(), Word::BadgeTurbo,
|
||||||
QString("Turbo Subscriber")));
|
QString(), QString("Turbo Subscriber")));
|
||||||
} else if (badge == "broadcaster/1") {
|
} else if (badge == "broadcaster/1") {
|
||||||
words.push_back(Word(badgeBroadcaster, Word::BadgeBroadcaster,
|
words.push_back(Word(Resources::badgeBroadcaster(),
|
||||||
QString(),
|
Word::BadgeBroadcaster, QString(),
|
||||||
QString("Channel Broadcaster")));
|
QString("Channel Broadcaster")));
|
||||||
} else if (badge == "premium/1") {
|
} else if (badge == "premium/1") {
|
||||||
words.push_back(Word(badgePremium, Word::BadgePremium,
|
words.push_back(Word(Resources::badgePremium(),
|
||||||
QString(), QString("Twitch Prime")));
|
Word::BadgePremium, QString(),
|
||||||
|
QString("Twitch Prime")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -390,14 +380,13 @@ Message::Message(const IrcPrivateMessage &ircMessage, const Channel &channel,
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// static void normalize
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Message::layout(int width, bool enableEmoteMargins)
|
Message::layout(int width, bool enableEmoteMargins)
|
||||||
{
|
{
|
||||||
width = width - (width % 2);
|
width = width - (width % 2);
|
||||||
|
|
||||||
int mediumTextLineHeight = Fonts::getFontMetrics(Fonts::Medium).height();
|
int mediumTextLineHeight = Fonts::getFontMetrics(Fonts::Medium).height();
|
||||||
|
int spaceWidth = 4;
|
||||||
|
|
||||||
bool redraw = width != m_currentLayoutWidth || m_relayoutRequested;
|
bool redraw = width != m_currentLayoutWidth || m_relayoutRequested;
|
||||||
|
|
||||||
|
@ -436,20 +425,41 @@ Message::layout(int width, bool enableEmoteMargins)
|
||||||
m_recalculateText = false;
|
m_recalculateText = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (redraw) {
|
if (!redraw) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int x = MARGIN_LEFT;
|
int x = MARGIN_LEFT;
|
||||||
int y = MARGIN_TOP;
|
int y = MARGIN_TOP;
|
||||||
|
|
||||||
int right = width - MARGIN_RIGHT;
|
int right = width - MARGIN_RIGHT - MARGIN_LEFT;
|
||||||
|
|
||||||
std::list<WordPart> *parts = new std::list<WordPart>();
|
std::list<WordPart> *parts = new std::list<WordPart>();
|
||||||
|
|
||||||
auto lineStart = m_wordParts->begin();
|
auto lineStart = parts->begin();
|
||||||
int lineHeight = 0;
|
int lineHeight = 0;
|
||||||
|
|
||||||
|
auto alignParts = [&lineStart, &lineHeight, &parts, this] {
|
||||||
|
for (auto it2 = lineStart; true; it2++) {
|
||||||
|
WordPart &wordPart2 = *it2;
|
||||||
|
|
||||||
|
wordPart2.setY(wordPart2.y() + lineHeight);
|
||||||
|
|
||||||
|
if (it2 == parts->end()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int flags = AppSettings::wordTypeMask();
|
||||||
|
|
||||||
for (auto it = m_words.begin(); it != m_words.end(); ++it) {
|
for (auto it = m_words.begin(); it != m_words.end(); ++it) {
|
||||||
Word &word = *it;
|
Word &word = *it;
|
||||||
|
|
||||||
|
if ((word.type() & flags) == Word::None) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int xOffset = 0, yOffset = 0;
|
int xOffset = 0, yOffset = 0;
|
||||||
|
|
||||||
if (enableEmoteMargins) {
|
if (enableEmoteMargins) {
|
||||||
|
@ -459,33 +469,59 @@ Message::layout(int width, bool enableEmoteMargins)
|
||||||
xOffset = word.xOffset();
|
xOffset = word.xOffset();
|
||||||
yOffset = word.yOffset();
|
yOffset = word.yOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
lineHeight = std::max(word.height(), lineHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fits in the line
|
||||||
if (x + word.width() + xOffset <= right) {
|
if (x + word.width() + xOffset <= right) {
|
||||||
parts->push_back(WordPart(word, x, y, word.copyText()));
|
parts->push_back(
|
||||||
x += word.width() + xOffset;
|
WordPart(word, x, y - word.height(), word.copyText()));
|
||||||
}
|
|
||||||
// else if (word.isText() && word.getText().length() > 2)
|
|
||||||
// {
|
|
||||||
|
|
||||||
// }
|
x += word.width() + xOffset;
|
||||||
else {
|
|
||||||
parts->push_back(WordPart(word, x, y, word.copyText()));
|
if (word.hasTrailingSpace()) {
|
||||||
|
x += spaceWidth;
|
||||||
|
}
|
||||||
|
|
||||||
lineHeight = std::max(word.height(), lineHeight);
|
lineHeight = std::max(word.height(), lineHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// else if (word.isText() && word.getText().length()
|
||||||
|
// > 2)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
|
||||||
|
// doesn't fit in the line
|
||||||
|
else {
|
||||||
|
alignParts();
|
||||||
|
|
||||||
|
y += lineHeight;
|
||||||
|
|
||||||
|
parts->push_back(WordPart(word, MARGIN_LEFT, y - word.height(),
|
||||||
|
word.copyText()));
|
||||||
|
|
||||||
|
lineStart = parts->end();
|
||||||
|
|
||||||
|
lineHeight = word.height();
|
||||||
|
|
||||||
|
x = word.width();
|
||||||
|
|
||||||
|
if (word.hasTrailingSpace()) {
|
||||||
|
x += spaceWidth;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
alignParts();
|
||||||
|
|
||||||
|
qInfo("words: %d, parts: %d", m_words.size(), parts->size());
|
||||||
|
|
||||||
auto tmp = m_wordParts;
|
auto tmp = m_wordParts;
|
||||||
m_wordParts = parts;
|
m_wordParts = parts;
|
||||||
delete tmp;
|
delete tmp;
|
||||||
|
|
||||||
m_height = y + lineHeight;
|
m_height = y + lineHeight;
|
||||||
}
|
|
||||||
|
|
||||||
return redraw;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
46
resources.cpp
Normal file
46
resources.cpp
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#include "resources.h"
|
||||||
|
#include "QPixmap"
|
||||||
|
|
||||||
|
LazyLoadedImage *Resources::m_badgeStaff;
|
||||||
|
LazyLoadedImage *Resources::m_badgeAdmin;
|
||||||
|
LazyLoadedImage *Resources::m_badgeModerator;
|
||||||
|
LazyLoadedImage *Resources::m_badgeGlobalmod;
|
||||||
|
LazyLoadedImage *Resources::m_badgeTurbo;
|
||||||
|
LazyLoadedImage *Resources::m_badgeBroadcaster;
|
||||||
|
LazyLoadedImage *Resources::m_badgePremium;
|
||||||
|
|
||||||
|
LazyLoadedImage *Resources::m_cheerBadge100000;
|
||||||
|
LazyLoadedImage *Resources::m_cheerBadge10000;
|
||||||
|
LazyLoadedImage *Resources::m_cheerBadge5000;
|
||||||
|
LazyLoadedImage *Resources::m_cheerBadge1000;
|
||||||
|
LazyLoadedImage *Resources::m_cheerBadge100;
|
||||||
|
LazyLoadedImage *Resources::m_cheerBadge1;
|
||||||
|
|
||||||
|
Resources::Resources()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Resources::load()
|
||||||
|
{
|
||||||
|
// badges
|
||||||
|
m_badgeStaff = new LazyLoadedImage(new QPixmap(":/images/staff_bg.png"));
|
||||||
|
m_badgeAdmin = new LazyLoadedImage(new QPixmap(":/images/admin_bg.png"));
|
||||||
|
m_badgeModerator =
|
||||||
|
new LazyLoadedImage(new QPixmap(":/images/moderator_bg.png"));
|
||||||
|
m_badgeGlobalmod =
|
||||||
|
new LazyLoadedImage(new QPixmap(":/images/globalmod_bg.png"));
|
||||||
|
m_badgeTurbo = new LazyLoadedImage(new QPixmap(":/images/turbo_bg.png"));
|
||||||
|
m_badgeBroadcaster =
|
||||||
|
new LazyLoadedImage(new QPixmap(":/images/broadcaster_bg.png"));
|
||||||
|
m_badgePremium =
|
||||||
|
new LazyLoadedImage(new QPixmap(":/images/twitchprime_bg.png"));
|
||||||
|
|
||||||
|
// cheer badges
|
||||||
|
m_cheerBadge100000 = new LazyLoadedImage(new QPixmap(":/cheer100000"));
|
||||||
|
m_cheerBadge10000 = new LazyLoadedImage(new QPixmap(":/cheer10000"));
|
||||||
|
m_cheerBadge5000 = new LazyLoadedImage(new QPixmap(":/cheer5000"));
|
||||||
|
m_cheerBadge1000 = new LazyLoadedImage(new QPixmap(":/cheer1000"));
|
||||||
|
m_cheerBadge100 = new LazyLoadedImage(new QPixmap(":/cheer100"));
|
||||||
|
m_cheerBadge1 = new LazyLoadedImage(new QPixmap(":/cheer1"));
|
||||||
|
}
|
110
resources.h
Normal file
110
resources.h
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
#ifndef RESOURCES_H
|
||||||
|
#define RESOURCES_H
|
||||||
|
|
||||||
|
#include <lazyloadedimage.h>
|
||||||
|
|
||||||
|
class Resources
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void load();
|
||||||
|
|
||||||
|
// badges
|
||||||
|
static LazyLoadedImage *
|
||||||
|
badgeStaff()
|
||||||
|
{
|
||||||
|
return m_badgeStaff;
|
||||||
|
}
|
||||||
|
|
||||||
|
static LazyLoadedImage *
|
||||||
|
badgeAdmin()
|
||||||
|
{
|
||||||
|
return m_badgeAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
static LazyLoadedImage *
|
||||||
|
badgeGlobalmod()
|
||||||
|
{
|
||||||
|
return m_badgeGlobalmod;
|
||||||
|
}
|
||||||
|
|
||||||
|
static LazyLoadedImage *
|
||||||
|
badgeModerator()
|
||||||
|
{
|
||||||
|
return m_badgeModerator;
|
||||||
|
}
|
||||||
|
|
||||||
|
static LazyLoadedImage *
|
||||||
|
badgeTurbo()
|
||||||
|
{
|
||||||
|
return m_badgeTurbo;
|
||||||
|
}
|
||||||
|
|
||||||
|
static LazyLoadedImage *
|
||||||
|
badgeBroadcaster()
|
||||||
|
{
|
||||||
|
return m_badgeBroadcaster;
|
||||||
|
}
|
||||||
|
|
||||||
|
static LazyLoadedImage *
|
||||||
|
badgePremium()
|
||||||
|
{
|
||||||
|
return m_badgePremium;
|
||||||
|
}
|
||||||
|
|
||||||
|
// cheer badges
|
||||||
|
static LazyLoadedImage *
|
||||||
|
cheerBadge100000()
|
||||||
|
{
|
||||||
|
return m_cheerBadge100000;
|
||||||
|
}
|
||||||
|
|
||||||
|
static LazyLoadedImage *
|
||||||
|
cheerBadge10000()
|
||||||
|
{
|
||||||
|
return m_cheerBadge10000;
|
||||||
|
}
|
||||||
|
|
||||||
|
static LazyLoadedImage *
|
||||||
|
cheerBadge5000()
|
||||||
|
{
|
||||||
|
return m_cheerBadge5000;
|
||||||
|
}
|
||||||
|
|
||||||
|
static LazyLoadedImage *
|
||||||
|
cheerBadge1000()
|
||||||
|
{
|
||||||
|
return m_cheerBadge1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
static LazyLoadedImage *
|
||||||
|
cheerBadge100()
|
||||||
|
{
|
||||||
|
return m_cheerBadge100;
|
||||||
|
}
|
||||||
|
|
||||||
|
static LazyLoadedImage *
|
||||||
|
cheerBadge1()
|
||||||
|
{
|
||||||
|
return m_cheerBadge1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Resources();
|
||||||
|
|
||||||
|
static LazyLoadedImage *m_badgeStaff;
|
||||||
|
static LazyLoadedImage *m_badgeAdmin;
|
||||||
|
static LazyLoadedImage *m_badgeGlobalmod;
|
||||||
|
static LazyLoadedImage *m_badgeModerator;
|
||||||
|
static LazyLoadedImage *m_badgeTurbo;
|
||||||
|
static LazyLoadedImage *m_badgeBroadcaster;
|
||||||
|
static LazyLoadedImage *m_badgePremium;
|
||||||
|
|
||||||
|
static LazyLoadedImage *m_cheerBadge100000;
|
||||||
|
static LazyLoadedImage *m_cheerBadge10000;
|
||||||
|
static LazyLoadedImage *m_cheerBadge5000;
|
||||||
|
static LazyLoadedImage *m_cheerBadge1000;
|
||||||
|
static LazyLoadedImage *m_cheerBadge100;
|
||||||
|
static LazyLoadedImage *m_cheerBadge1;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // RESOURCES_H
|
10
word.h
10
word.h
|
@ -51,7 +51,7 @@ public:
|
||||||
|
|
||||||
Default = TimestampNoSeconds | Badges | Username | Bits |
|
Default = TimestampNoSeconds | Badges | Username | Bits |
|
||||||
FfzEmoteImage | BttvEmoteImage | BttvGifEmoteImage |
|
FfzEmoteImage | BttvEmoteImage | BttvGifEmoteImage |
|
||||||
TwitchEmoteImage | BitsAmount
|
TwitchEmoteImage | BitsAmount | Text
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit Word(LazyLoadedImage *m_image, Type type, const QString ©text,
|
explicit Word(LazyLoadedImage *m_image, Type type, const QString ©text,
|
||||||
|
@ -180,10 +180,10 @@ private:
|
||||||
QString m_copyText;
|
QString m_copyText;
|
||||||
QString m_tooltip;
|
QString m_tooltip;
|
||||||
|
|
||||||
int m_width;
|
int m_width = 16;
|
||||||
int m_height;
|
int m_height = 16;
|
||||||
int m_xOffset;
|
int m_xOffset = 0;
|
||||||
int m_yOffset;
|
int m_yOffset = 0;
|
||||||
|
|
||||||
bool m_hasTrailingSpace;
|
bool m_hasTrailingSpace;
|
||||||
Fonts::Type m_font = Fonts::Medium;
|
Fonts::Type m_font = Fonts::Medium;
|
||||||
|
|
|
@ -49,6 +49,12 @@ public:
|
||||||
m_y = y;
|
m_y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
setY(int y)
|
||||||
|
{
|
||||||
|
m_y = y;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
right() const
|
right() const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue