mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
added namespaces
This commit is contained in:
parent
82338baaa3
commit
2e8dc63a95
82 changed files with 681 additions and 459 deletions
|
@ -1,5 +1,7 @@
|
||||||
#include "account.h"
|
#include "account.h"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
Account Account::anon("justinfan123", "", "");
|
Account Account::anon("justinfan123", "", "");
|
||||||
|
|
||||||
Account::Account(QString username, QString oauthToken, QString oauthClient)
|
Account::Account(QString username, QString oauthToken, QString oauthClient)
|
||||||
|
@ -8,3 +10,4 @@ Account::Account(QString username, QString oauthToken, QString oauthClient)
|
||||||
this->oauthToken = oauthToken;
|
this->oauthToken = oauthToken;
|
||||||
this->username = username;
|
this->username = username;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
class Account
|
class Account
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -45,5 +47,6 @@ private:
|
||||||
QString oauthClient;
|
QString oauthClient;
|
||||||
QString oauthToken;
|
QString oauthToken;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#endif // ACCOUNT_H
|
#endif // ACCOUNT_H
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
#include "appsettings.h"
|
|
||||||
|
|
||||||
Word::Type AppSettings::wordTypeMask = Word::Default;
|
|
||||||
|
|
||||||
AppSettings::AppSettings()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
AppSettings::isIgnoredEmote(const QString &emote)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
22
asyncexec.h
22
asyncexec.h
|
@ -1,13 +1,31 @@
|
||||||
#ifndef ASYNCEXEC_H
|
#ifndef ASYNCEXEC_H
|
||||||
#define ASYNCEXEC_H
|
#define ASYNCEXEC_H
|
||||||
|
|
||||||
#include "lambdaqrunnable.h"
|
|
||||||
#include "qcoreapplication.h"
|
#include "qcoreapplication.h"
|
||||||
|
|
||||||
#include <QRunnable>
|
#include <QRunnable>
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
#define async_exec(a) \
|
#define async_exec(a) \
|
||||||
QThreadPool::globalInstance()->start(new LambdaQRunnable(a));
|
QThreadPool::globalInstance()->start(new LambdaRunnable(a));
|
||||||
|
|
||||||
|
class LambdaRunnable : public QRunnable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LambdaRunnable(std::function<void()> action)
|
||||||
|
{
|
||||||
|
this->action = action;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
run()
|
||||||
|
{
|
||||||
|
this->action();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::function<void()> action;
|
||||||
|
};
|
||||||
|
|
||||||
#endif // ASYNCEXEC_H
|
#endif // ASYNCEXEC_H
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
#include "channel.h"
|
#include "channel.h"
|
||||||
#include "message.h"
|
#include "messages/message.h"
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
Channel::Channel(const QString &channel)
|
Channel::Channel(const QString &channel)
|
||||||
: messages()
|
: messages()
|
||||||
, name((channel.length() > 0 && channel[0] == '#') ? channel.mid(1)
|
, name((channel.length() > 0 && channel[0] == '#') ? channel.mid(1)
|
||||||
|
@ -37,3 +39,4 @@ Channel::addMessage(std::shared_ptr<Message> message)
|
||||||
|
|
||||||
Windows::repaintVisibleChatWidgets();
|
Windows::repaintVisibleChatWidgets();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
10
channel.h
10
channel.h
|
@ -2,7 +2,7 @@
|
||||||
#define CHANNEL_H
|
#define CHANNEL_H
|
||||||
|
|
||||||
#include "concurrentmap.h"
|
#include "concurrentmap.h"
|
||||||
#include "lazyloadedimage.h"
|
#include "messages/lazyloadedimage.h"
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
@ -10,7 +10,13 @@
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
using namespace chatterino::messages;
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
|
namespace messages {
|
||||||
class Message;
|
class Message;
|
||||||
|
}
|
||||||
|
|
||||||
class Channel
|
class Channel
|
||||||
{
|
{
|
||||||
|
@ -23,6 +29,7 @@ public:
|
||||||
{
|
{
|
||||||
return bttvChannelEmotes;
|
return bttvChannelEmotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ConcurrentMap<QString, LazyLoadedImage *> &
|
const ConcurrentMap<QString, LazyLoadedImage *> &
|
||||||
getFfzChannelEmotes() const
|
getFfzChannelEmotes() const
|
||||||
{
|
{
|
||||||
|
@ -108,5 +115,6 @@ private:
|
||||||
QString streamStatus;
|
QString streamStatus;
|
||||||
QString streamGame;
|
QString streamGame;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#endif // CHANNEL_H
|
#endif // CHANNEL_H
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "channels.h"
|
#include "channels.h"
|
||||||
#include "ircmanager.h"
|
#include "ircmanager.h"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
Channel Channels::whispers(QString("/whispers"));
|
Channel Channels::whispers(QString("/whispers"));
|
||||||
Channel Channels::mentions(QString("/mentions"));
|
Channel Channels::mentions(QString("/mentions"));
|
||||||
Channel Channels::empty(QString(""));
|
Channel Channels::empty(QString(""));
|
||||||
|
@ -77,3 +79,4 @@ Channels::removeChannel(const QString &channel)
|
||||||
delete std::get<0>(a.value());
|
delete std::get<0>(a.value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include "channel.h"
|
#include "channel.h"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
class Channels
|
class Channels
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -33,5 +35,5 @@ private:
|
||||||
|
|
||||||
static QMap<QString, std::tuple<Channel *, int>> channels;
|
static QMap<QString, std::tuple<Channel *, int>> channels;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
#endif // CHANNELS_H
|
#endif // CHANNELS_H
|
||||||
|
|
144
chatterino.pro
144
chatterino.pro
|
@ -37,89 +37,83 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
|
||||||
SOURCES += main.cpp\
|
SOURCES += main.cpp\
|
||||||
mainwindow.cpp \
|
|
||||||
chatwidget.cpp \
|
|
||||||
notebook.cpp \
|
|
||||||
notebooktab.cpp \
|
|
||||||
notebookpage.cpp \
|
|
||||||
notebookbutton.cpp \
|
|
||||||
colorscheme.cpp \
|
|
||||||
chatwidgetheader.cpp \
|
|
||||||
chatwidgetinput.cpp \
|
|
||||||
chatwidgetview.cpp \
|
|
||||||
notebookpagedroppreview.cpp \
|
|
||||||
channel.cpp \
|
|
||||||
dialog.cpp \
|
|
||||||
settingsdialog.cpp \
|
|
||||||
settingsdialogtab.cpp \
|
|
||||||
scrollbar.cpp \
|
|
||||||
scrollbarhighlight.cpp \
|
|
||||||
ircmanager.cpp \
|
|
||||||
lambdaqrunnable.cpp \
|
|
||||||
account.cpp \
|
account.cpp \
|
||||||
emotes.cpp \
|
channel.cpp \
|
||||||
lazyloadedimage.cpp \
|
|
||||||
concurrentmap.cpp \
|
|
||||||
message.cpp \
|
|
||||||
word.cpp \
|
|
||||||
link.cpp \
|
|
||||||
fonts.cpp \
|
|
||||||
appsettings.cpp \
|
|
||||||
emojis.cpp \
|
|
||||||
wordpart.cpp \
|
|
||||||
resources.cpp \
|
|
||||||
windows.cpp \
|
|
||||||
chatwidgetheaderbutton.cpp \
|
|
||||||
chatwidgetheaderbuttonlabel.cpp \
|
|
||||||
channels.cpp \
|
channels.cpp \
|
||||||
textinputdialog.cpp
|
colorscheme.cpp \
|
||||||
|
emojis.cpp \
|
||||||
|
emotes.cpp \
|
||||||
|
fonts.cpp \
|
||||||
|
ircmanager.cpp \
|
||||||
|
messages/lazyloadedimage.cpp \
|
||||||
|
messages/link.cpp \
|
||||||
|
messages/message.cpp \
|
||||||
|
messages/word.cpp \
|
||||||
|
messages/wordpart.cpp \
|
||||||
|
resources.cpp \
|
||||||
|
settings/settings.cpp \
|
||||||
|
widgets/chatwidget.cpp \
|
||||||
|
widgets/chatwidgetheader.cpp \
|
||||||
|
widgets/chatwidgetheaderbutton.cpp \
|
||||||
|
widgets/chatwidgetheaderbuttonlabel.cpp \
|
||||||
|
widgets/chatwidgetinput.cpp \
|
||||||
|
widgets/chatwidgetview.cpp \
|
||||||
|
widgets/mainwindow.cpp \
|
||||||
|
widgets/notebook.cpp \
|
||||||
|
widgets/notebookbutton.cpp \
|
||||||
|
widgets/notebookpage.cpp \
|
||||||
|
widgets/notebookpagedroppreview.cpp \
|
||||||
|
widgets/notebooktab.cpp \
|
||||||
|
widgets/scrollbar.cpp \
|
||||||
|
widgets/scrollbarhighlight.cpp \
|
||||||
|
widgets/settingsdialog.cpp \
|
||||||
|
widgets/settingsdialogtab.cpp \
|
||||||
|
widgets/textinputdialog.cpp \
|
||||||
|
windows.cpp
|
||||||
|
|
||||||
HEADERS += mainwindow.h \
|
HEADERS += account.h \
|
||||||
chatwidget.h \
|
|
||||||
notebook.h \
|
|
||||||
notebooktab.h \
|
|
||||||
notebookpage.h \
|
|
||||||
notebookbutton.h \
|
|
||||||
colorscheme.h \
|
|
||||||
chatwidgetheader.h \
|
|
||||||
chatwidgetinput.h \
|
|
||||||
chatwidgetview.h \
|
|
||||||
notebookpagedroppreview.h \
|
|
||||||
channel.h \
|
|
||||||
dialog.h \
|
|
||||||
settingsdialog.h \
|
|
||||||
settingsdialogtab.h \
|
|
||||||
scrollbar.h \
|
|
||||||
scrollbarhighlight.h \
|
|
||||||
ircmanager.h \
|
|
||||||
lambdaqrunnable.h \
|
|
||||||
asyncexec.h \
|
asyncexec.h \
|
||||||
account.h \
|
channel.h \
|
||||||
emotes.h \
|
|
||||||
lazyloadedimage.h \
|
|
||||||
twitchemotevalue.h \
|
|
||||||
concurrentmap.h \
|
|
||||||
message.h \
|
|
||||||
word.h \
|
|
||||||
link.h \
|
|
||||||
fonts.h \
|
|
||||||
appsettings.h \
|
|
||||||
emojis.h \
|
|
||||||
wordpart.h \
|
|
||||||
common.h \
|
|
||||||
resources.h \
|
|
||||||
windows.h \
|
|
||||||
chatwidgetheaderbutton.h \
|
|
||||||
chatwidgetheaderbuttonlabel.h \
|
|
||||||
channels.h \
|
channels.h \
|
||||||
textinputdialog.h \
|
colorscheme.h \
|
||||||
signallabel.h
|
common.h \
|
||||||
|
concurrentmap.h \
|
||||||
|
emojis.h \
|
||||||
|
emotes.h \
|
||||||
|
fonts.h \
|
||||||
|
ircmanager.h \
|
||||||
|
messages/lazyloadedimage.h \
|
||||||
|
messages/link.h \
|
||||||
|
messages/message.h \
|
||||||
|
messages/word.h \
|
||||||
|
messages/wordpart.h \
|
||||||
|
resources.h \
|
||||||
|
settings/realsetting.h \
|
||||||
|
settings/setting.h \
|
||||||
|
settings/settings.h \
|
||||||
|
twitchemotevalue.h \
|
||||||
|
widgets/chatwidget.h \
|
||||||
|
widgets/chatwidgetheader.h \
|
||||||
|
widgets/chatwidgetheaderbutton.h \
|
||||||
|
widgets/chatwidgetheaderbuttonlabel.h \
|
||||||
|
widgets/chatwidgetinput.h \
|
||||||
|
widgets/chatwidgetview.h \
|
||||||
|
widgets/mainwindow.h \
|
||||||
|
widgets/notebook.h \
|
||||||
|
widgets/notebookbutton.h \
|
||||||
|
widgets/notebookpage.h \
|
||||||
|
widgets/notebookpagedroppreview.h \
|
||||||
|
widgets/notebooktab.h \
|
||||||
|
widgets/scrollbar.h \
|
||||||
|
widgets/scrollbarhighlight.h \
|
||||||
|
widgets/settingsdialog.h \
|
||||||
|
widgets/settingsdialogtab.h \
|
||||||
|
widgets/signallabel.h \
|
||||||
|
widgets/textinputdialog.h \
|
||||||
|
windows.h
|
||||||
|
|
||||||
PRECOMPILED_HEADER =
|
PRECOMPILED_HEADER =
|
||||||
|
|
||||||
FORMS += \
|
|
||||||
dialog.ui
|
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
resources.qrc
|
resources.qrc
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
// hue: theme color (0 - 1)
|
// hue: theme color (0 - 1)
|
||||||
// multiplyer: 1 = white, 0.8 = light, -0.8 dark, -1 black
|
// multiplyer: 1 = white, 0.8 = light, -0.8 dark, -1 black
|
||||||
void
|
void
|
||||||
|
@ -129,3 +131,4 @@ ColorScheme::normalizeColor(QColor &color)
|
||||||
|
|
||||||
// color.setHslF(color.hueF(), s, newL);
|
// color.setHslF(color.hueF(), s, newL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include <QBrush>
|
#include <QBrush>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
class ColorScheme
|
class ColorScheme
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -79,5 +81,6 @@ private:
|
||||||
void fillLookupTableValues(qreal (&array)[360], qreal from, qreal to,
|
void fillLookupTableValues(qreal (&array)[360], qreal from, qreal to,
|
||||||
qreal fromValue, qreal toValue);
|
qreal fromValue, qreal toValue);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#endif // COLORSCHEME_H
|
#endif // COLORSCHEME_H
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
#include "concurrentmap.h"
|
|
||||||
|
|
||||||
// template<typename TKey, typename TValue>
|
|
||||||
// ConcurrentMap<TKey, TValue>::ConcurrentMap()
|
|
||||||
//{
|
|
||||||
|
|
||||||
//}
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
template <typename TKey, typename TValue>
|
template <typename TKey, typename TValue>
|
||||||
class ConcurrentMap
|
class ConcurrentMap
|
||||||
{
|
{
|
||||||
|
@ -65,5 +67,6 @@ private:
|
||||||
QMutex *mutex;
|
QMutex *mutex;
|
||||||
QMap<TKey, TValue> *map;
|
QMap<TKey, TValue> *map;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#endif // CONCURRENTMAP_H
|
#endif // CONCURRENTMAP_H
|
||||||
|
|
14
dialog.cpp
14
dialog.cpp
|
@ -1,14 +0,0 @@
|
||||||
#include "dialog.h"
|
|
||||||
#include "ui_dialog.h"
|
|
||||||
|
|
||||||
Dialog::Dialog(QWidget *parent)
|
|
||||||
: QDialog(parent)
|
|
||||||
, ui(new Ui::Dialog)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
Dialog::~Dialog()
|
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
22
dialog.h
22
dialog.h
|
@ -1,22 +0,0 @@
|
||||||
#ifndef DIALOG_H
|
|
||||||
#define DIALOG_H
|
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class Dialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Dialog : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit Dialog(QWidget *parent = 0);
|
|
||||||
~Dialog();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::Dialog *ui;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // DIALOG_H
|
|
55
dialog.ui
55
dialog.ui
|
@ -1,55 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>Dialog</class>
|
|
||||||
<widget class="QDialog" name="Dialog">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>1031</width>
|
|
||||||
<height>625</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Dialog</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="documentMode">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="tab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Tab 1</string>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab_2">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Tab 2</string>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
33
emojis.cpp
33
emojis.cpp
|
@ -5,13 +5,15 @@
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
QRegularExpression Emojis::findShortCodesRegex(":([-+\\w]+):");
|
QRegularExpression Emojis::findShortCodesRegex(":([-+\\w]+):");
|
||||||
|
|
||||||
QMap<QString, Emojis::EmojiData> Emojis::shortCodeToEmoji;
|
QMap<QString, Emojis::EmojiData> Emojis::shortCodeToEmoji;
|
||||||
QMap<QString, QString> Emojis::emojiToShortCode;
|
QMap<QString, QString> Emojis::emojiToShortCode;
|
||||||
QMap<QChar, QMap<QString, QString>> Emojis::firstEmojiChars;
|
QMap<QChar, QMap<QString, QString>> Emojis::firstEmojiChars;
|
||||||
|
|
||||||
ConcurrentMap<QString, LazyLoadedImage *> Emojis::imageCache;
|
ConcurrentMap<QString, messages::LazyLoadedImage *> Emojis::imageCache;
|
||||||
|
|
||||||
QString
|
QString
|
||||||
Emojis::replaceShortCodes(const QString &text)
|
Emojis::replaceShortCodes(const QString &text)
|
||||||
|
@ -21,8 +23,9 @@ Emojis::replaceShortCodes(const QString &text)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Emojis::parseEmojis(std::vector<std::tuple<LazyLoadedImage *, QString>> &vector,
|
Emojis::parseEmojis(
|
||||||
const QString &text)
|
std::vector<std::tuple<messages::LazyLoadedImage *, QString>> &vector,
|
||||||
|
const QString &text)
|
||||||
{
|
{
|
||||||
long lastSlice = 0;
|
long lastSlice = 0;
|
||||||
|
|
||||||
|
@ -42,17 +45,20 @@ Emojis::parseEmojis(std::vector<std::tuple<LazyLoadedImage *, QString>> &vector,
|
||||||
|
|
||||||
if (i - lastSlice != 0) {
|
if (i - lastSlice != 0) {
|
||||||
vector.push_back(
|
vector.push_back(
|
||||||
std::tuple<LazyLoadedImage *, QString>(
|
std::tuple<messages::LazyLoadedImage *,
|
||||||
|
QString>(
|
||||||
NULL, text.mid(lastSlice, i - lastSlice)));
|
NULL, text.mid(lastSlice, i - lastSlice)));
|
||||||
}
|
}
|
||||||
|
|
||||||
vector.push_back(std::tuple<LazyLoadedImage *, QString>(
|
vector.push_back(
|
||||||
imageCache.getOrAdd(url,
|
std::tuple<messages::LazyLoadedImage *, QString>(
|
||||||
[&url] {
|
imageCache.getOrAdd(
|
||||||
return new LazyLoadedImage(
|
url,
|
||||||
url, 0.35);
|
[&url] {
|
||||||
}),
|
return new messages::LazyLoadedImage(
|
||||||
QString()));
|
url, 0.35);
|
||||||
|
}),
|
||||||
|
QString()));
|
||||||
|
|
||||||
i += j - 1;
|
i += j - 1;
|
||||||
|
|
||||||
|
@ -66,8 +72,8 @@ Emojis::parseEmojis(std::vector<std::tuple<LazyLoadedImage *, QString>> &vector,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastSlice < text.length()) {
|
if (lastSlice < text.length()) {
|
||||||
vector.push_back(
|
vector.push_back(std::tuple<messages::LazyLoadedImage *, QString>(
|
||||||
std::tuple<LazyLoadedImage *, QString>(NULL, text.mid(lastSlice)));
|
NULL, text.mid(lastSlice)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,3 +127,4 @@ Emojis::loadEmojis()
|
||||||
QMap<QString, QString>{{emoji.second.value, emoji.second.code}});
|
QMap<QString, QString>{{emoji.second.value, emoji.second.code}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
9
emojis.h
9
emojis.h
|
@ -2,18 +2,20 @@
|
||||||
#define EMOJIS_H
|
#define EMOJIS_H
|
||||||
|
|
||||||
#include "concurrentmap.h"
|
#include "concurrentmap.h"
|
||||||
#include "lazyloadedimage.h"
|
#include "messages/lazyloadedimage.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
class Emojis
|
class Emojis
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void parseEmojis(
|
static void parseEmojis(
|
||||||
std::vector<std::tuple<LazyLoadedImage *, QString>> &vector,
|
std::vector<std::tuple<messages::LazyLoadedImage *, QString>> &vector,
|
||||||
const QString &text);
|
const QString &text);
|
||||||
|
|
||||||
static void loadEmojis();
|
static void loadEmojis();
|
||||||
|
@ -32,11 +34,12 @@ private:
|
||||||
static QMap<QString, QString> emojiToShortCode;
|
static QMap<QString, QString> emojiToShortCode;
|
||||||
static QMap<QChar, QMap<QString, QString>> firstEmojiChars;
|
static QMap<QChar, QMap<QString, QString>> firstEmojiChars;
|
||||||
|
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> imageCache;
|
static ConcurrentMap<QString, messages::LazyLoadedImage *> imageCache;
|
||||||
|
|
||||||
Emojis()
|
Emojis()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#endif // EMOJIS_H
|
#endif // EMOJIS_H
|
||||||
|
|
28
emotes.cpp
28
emotes.cpp
|
@ -1,17 +1,21 @@
|
||||||
#include "emotes.h"
|
#include "emotes.h"
|
||||||
#include "resources.h"
|
#include "resources.h"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
QString Emotes::twitchEmoteTemplate(
|
QString Emotes::twitchEmoteTemplate(
|
||||||
"https://static-cdn.jtvnw.net/emoticons/v1/{id}/{scale}.0");
|
"https://static-cdn.jtvnw.net/emoticons/v1/{id}/{scale}.0");
|
||||||
|
|
||||||
ConcurrentMap<QString, TwitchEmoteValue *> Emotes::twitchEmotes;
|
ConcurrentMap<QString, TwitchEmoteValue *> Emotes::twitchEmotes;
|
||||||
ConcurrentMap<QString, LazyLoadedImage *> Emotes::bttvEmotes;
|
ConcurrentMap<QString, messages::LazyLoadedImage *> Emotes::bttvEmotes;
|
||||||
ConcurrentMap<QString, LazyLoadedImage *> Emotes::ffzEmotes;
|
ConcurrentMap<QString, messages::LazyLoadedImage *> Emotes::ffzEmotes;
|
||||||
ConcurrentMap<QString, LazyLoadedImage *> Emotes::chatterinoEmotes;
|
ConcurrentMap<QString, messages::LazyLoadedImage *> Emotes::chatterinoEmotes;
|
||||||
ConcurrentMap<QString, LazyLoadedImage *> Emotes::bttvChannelEmoteFromCaches;
|
ConcurrentMap<QString, messages::LazyLoadedImage *>
|
||||||
ConcurrentMap<QString, LazyLoadedImage *> Emotes::ffzChannelEmoteFromCaches;
|
Emotes::bttvChannelEmoteFromCaches;
|
||||||
ConcurrentMap<long, LazyLoadedImage *> Emotes::twitchEmoteFromCache;
|
ConcurrentMap<QString, messages::LazyLoadedImage *>
|
||||||
ConcurrentMap<QString, LazyLoadedImage *> Emotes::miscImageFromCache;
|
Emotes::ffzChannelEmoteFromCaches;
|
||||||
|
ConcurrentMap<long, messages::LazyLoadedImage *> Emotes::twitchEmoteFromCache;
|
||||||
|
ConcurrentMap<QString, messages::LazyLoadedImage *> Emotes::miscImageFromCache;
|
||||||
|
|
||||||
int Emotes::generation = 0;
|
int Emotes::generation = 0;
|
||||||
|
|
||||||
|
@ -19,13 +23,14 @@ Emotes::Emotes()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LazyLoadedImage *
|
messages::LazyLoadedImage *
|
||||||
Emotes::getTwitchEmoteById(const QString &name, long id)
|
Emotes::getTwitchEmoteById(const QString &name, long id)
|
||||||
{
|
{
|
||||||
return Emotes::twitchEmoteFromCache.getOrAdd(id, [&name, id] {
|
return Emotes::twitchEmoteFromCache.getOrAdd(id, [&name, id] {
|
||||||
qreal scale;
|
qreal scale;
|
||||||
QString url = getTwitchEmoteLink(id, scale);
|
QString url = getTwitchEmoteLink(id, scale);
|
||||||
return new LazyLoadedImage(url, scale, name, name + "\nTwitch Emote");
|
return new messages::LazyLoadedImage(url, scale, name,
|
||||||
|
name + "\nTwitch Emote");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,14 +43,14 @@ Emotes::getTwitchEmoteLink(long id, qreal &scale)
|
||||||
.replace("{scale}", "2");
|
.replace("{scale}", "2");
|
||||||
}
|
}
|
||||||
|
|
||||||
LazyLoadedImage *
|
messages::LazyLoadedImage *
|
||||||
Emotes::getCheerImage(long long amount, bool animated)
|
Emotes::getCheerImage(long long amount, bool animated)
|
||||||
{
|
{
|
||||||
// TODO: fix this xD
|
// TODO: fix this xD
|
||||||
return getCheerBadge(amount);
|
return getCheerBadge(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
LazyLoadedImage *
|
messages::LazyLoadedImage *
|
||||||
Emotes::getCheerBadge(long long amount)
|
Emotes::getCheerBadge(long long amount)
|
||||||
{
|
{
|
||||||
if (amount >= 100000) {
|
if (amount >= 100000) {
|
||||||
|
@ -62,3 +67,4 @@ Emotes::getCheerBadge(long long amount)
|
||||||
return Resources::getCheerBadge1();
|
return Resources::getCheerBadge1();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
46
emotes.h
46
emotes.h
|
@ -2,12 +2,14 @@
|
||||||
#define EMOTES_H
|
#define EMOTES_H
|
||||||
|
|
||||||
#include "concurrentmap.h"
|
#include "concurrentmap.h"
|
||||||
#include "lazyloadedimage.h"
|
#include "messages/lazyloadedimage.h"
|
||||||
#include "twitchemotevalue.h"
|
#include "twitchemotevalue.h"
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
class Emotes
|
class Emotes
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -17,43 +19,43 @@ public:
|
||||||
return twitchEmotes;
|
return twitchEmotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> &
|
static ConcurrentMap<QString, messages::LazyLoadedImage *> &
|
||||||
getBttvEmotes()
|
getBttvEmotes()
|
||||||
{
|
{
|
||||||
return bttvEmotes;
|
return bttvEmotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> &
|
static ConcurrentMap<QString, messages::LazyLoadedImage *> &
|
||||||
getFfzEmotes()
|
getFfzEmotes()
|
||||||
{
|
{
|
||||||
return ffzEmotes;
|
return ffzEmotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> &
|
static ConcurrentMap<QString, messages::LazyLoadedImage *> &
|
||||||
getChatterinoEmotes()
|
getChatterinoEmotes()
|
||||||
{
|
{
|
||||||
return chatterinoEmotes;
|
return chatterinoEmotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> &
|
static ConcurrentMap<QString, messages::LazyLoadedImage *> &
|
||||||
getBttvChannelEmoteFromCaches()
|
getBttvChannelEmoteFromCaches()
|
||||||
{
|
{
|
||||||
return bttvChannelEmoteFromCaches;
|
return bttvChannelEmoteFromCaches;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> &
|
static ConcurrentMap<QString, messages::LazyLoadedImage *> &
|
||||||
getFfzChannelEmoteFromCaches()
|
getFfzChannelEmoteFromCaches()
|
||||||
{
|
{
|
||||||
return ffzChannelEmoteFromCaches;
|
return ffzChannelEmoteFromCaches;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConcurrentMap<long, LazyLoadedImage *> &
|
static ConcurrentMap<long, messages::LazyLoadedImage *> &
|
||||||
getTwitchEmoteFromCache()
|
getTwitchEmoteFromCache()
|
||||||
{
|
{
|
||||||
return twitchEmoteFromCache;
|
return twitchEmoteFromCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> &
|
static ConcurrentMap<QString, messages::LazyLoadedImage *> &
|
||||||
getMiscImageFromCache()
|
getMiscImageFromCache()
|
||||||
{
|
{
|
||||||
return miscImageFromCache;
|
return miscImageFromCache;
|
||||||
|
@ -61,11 +63,12 @@ public:
|
||||||
|
|
||||||
static void loadGlobalEmotes();
|
static void loadGlobalEmotes();
|
||||||
|
|
||||||
static LazyLoadedImage *getCheerImage(long long int amount, bool animated);
|
static messages::LazyLoadedImage *getCheerImage(long long int amount,
|
||||||
static LazyLoadedImage *getCheerBadge(long long int amount);
|
bool animated);
|
||||||
|
static messages::LazyLoadedImage *getCheerBadge(long long int amount);
|
||||||
|
|
||||||
static LazyLoadedImage *getTwitchEmoteById(const QString &name,
|
static messages::LazyLoadedImage *getTwitchEmoteById(const QString &name,
|
||||||
long int id);
|
long int id);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
getGeneration()
|
getGeneration()
|
||||||
|
@ -85,17 +88,22 @@ private:
|
||||||
static QString twitchEmoteTemplate;
|
static QString twitchEmoteTemplate;
|
||||||
|
|
||||||
static ConcurrentMap<QString, TwitchEmoteValue *> twitchEmotes;
|
static ConcurrentMap<QString, TwitchEmoteValue *> twitchEmotes;
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> bttvEmotes;
|
static ConcurrentMap<QString, messages::LazyLoadedImage *> bttvEmotes;
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> ffzEmotes;
|
static ConcurrentMap<QString, messages::LazyLoadedImage *> ffzEmotes;
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> chatterinoEmotes;
|
static ConcurrentMap<QString, messages::LazyLoadedImage *> chatterinoEmotes;
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> bttvChannelEmoteFromCaches;
|
static ConcurrentMap<QString, messages::LazyLoadedImage *>
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> ffzChannelEmoteFromCaches;
|
bttvChannelEmoteFromCaches;
|
||||||
static ConcurrentMap<long, LazyLoadedImage *> twitchEmoteFromCache;
|
static ConcurrentMap<QString, messages::LazyLoadedImage *>
|
||||||
static ConcurrentMap<QString, LazyLoadedImage *> miscImageFromCache;
|
ffzChannelEmoteFromCaches;
|
||||||
|
static ConcurrentMap<long, messages::LazyLoadedImage *>
|
||||||
|
twitchEmoteFromCache;
|
||||||
|
static ConcurrentMap<QString, messages::LazyLoadedImage *>
|
||||||
|
miscImageFromCache;
|
||||||
|
|
||||||
static QString getTwitchEmoteLink(long id, qreal &scale);
|
static QString getTwitchEmoteLink(long id, qreal &scale);
|
||||||
|
|
||||||
static int generation;
|
static int generation;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#endif // EMOTES_H
|
#endif // EMOTES_H
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
#define DEFAULT_FONT "Arial"
|
#define DEFAULT_FONT "Arial"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
QFont *Fonts::medium = new QFont(DEFAULT_FONT, 14);
|
QFont *Fonts::medium = new QFont(DEFAULT_FONT, 14);
|
||||||
QFont *Fonts::mediumBold = new QFont(DEFAULT_FONT, 14);
|
QFont *Fonts::mediumBold = new QFont(DEFAULT_FONT, 14);
|
||||||
QFont *Fonts::mediumItalic = new QFont(DEFAULT_FONT, 14);
|
QFont *Fonts::mediumItalic = new QFont(DEFAULT_FONT, 14);
|
||||||
|
@ -59,3 +61,4 @@ Fonts::getFontMetrics(Type type)
|
||||||
|
|
||||||
return *metricsMedium;
|
return *metricsMedium;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
3
fonts.h
3
fonts.h
|
@ -4,6 +4,8 @@
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
class Fonts
|
class Fonts
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -50,5 +52,6 @@ private:
|
||||||
|
|
||||||
static int generation;
|
static int generation;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#endif // FONTS_H
|
#endif // FONTS_H
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <future>
|
#include <future>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
Account *IrcManager::account = nullptr;
|
Account *IrcManager::account = nullptr;
|
||||||
IrcConnection *IrcManager::connection = NULL;
|
IrcConnection *IrcManager::connection = NULL;
|
||||||
QMutex IrcManager::connectionMutex;
|
QMutex IrcManager::connectionMutex;
|
||||||
|
@ -286,3 +288,4 @@ IrcManager::removeIgnoredUser(QString const &username)
|
||||||
// TODO: Implement IrcManager::removeIgnoredUser
|
// TODO: Implement IrcManager::removeIgnoredUser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#define TWITCH_MAX_MESSAGELENGTH 500
|
#define TWITCH_MAX_MESSAGELENGTH 500
|
||||||
|
|
||||||
#include "account.h"
|
#include "account.h"
|
||||||
#include "message.h"
|
#include "messages/message.h"
|
||||||
|
|
||||||
#include <IrcMessage>
|
#include <IrcMessage>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
@ -12,6 +12,8 @@
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
class IrcManager
|
class IrcManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -55,5 +57,6 @@ private:
|
||||||
static void messageReceived(IrcMessage *message);
|
static void messageReceived(IrcMessage *message);
|
||||||
static void privateMessageReceived(IrcPrivateMessage *message);
|
static void privateMessageReceived(IrcPrivateMessage *message);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#endif // IRCMANAGER_H
|
#endif // IRCMANAGER_H
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
#include "lambdaqrunnable.h"
|
|
||||||
|
|
||||||
LambdaQRunnable::LambdaQRunnable(std::function<void()> action)
|
|
||||||
{
|
|
||||||
this->action = action;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
LambdaQRunnable::run()
|
|
||||||
{
|
|
||||||
this->action();
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
#ifndef LAMBDAQRUNNABLE_H
|
|
||||||
#define LAMBDAQRUNNABLE_H
|
|
||||||
|
|
||||||
#include <QRunnable>
|
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
class LambdaQRunnable : public QRunnable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
LambdaQRunnable(std::function<void()> action);
|
|
||||||
|
|
||||||
void run();
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::function<void()> action;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // LAMBDAQRUNNABLE_H
|
|
5
main.cpp
5
main.cpp
|
@ -2,13 +2,16 @@
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
#include "emojis.h"
|
#include "emojis.h"
|
||||||
#include "ircmanager.h"
|
#include "ircmanager.h"
|
||||||
#include "mainwindow.h"
|
|
||||||
#include "resources.h"
|
#include "resources.h"
|
||||||
|
#include "widgets/mainwindow.h"
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
|
|
||||||
|
using namespace chatterino;
|
||||||
|
using namespace chatterino::widgets;
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
#include "message.h"
|
|
||||||
#include "qcolor.h"
|
|
||||||
#include "colorscheme.h"
|
|
||||||
|
|
||||||
Message::Message(const QString &text)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Message::Message(const IrcPrivateMessage& ircMessage, const Channel& Channel)
|
|
||||||
{
|
|
||||||
m_parseTime = std::chrono::system_clock::now();
|
|
||||||
|
|
||||||
auto words = new QList<Word>();
|
|
||||||
|
|
||||||
// username
|
|
||||||
m_userName = ircMessage.account();
|
|
||||||
|
|
||||||
if (m_userName.isEmpty())
|
|
||||||
{
|
|
||||||
auto iterator = ircMessage.tags().find("login");
|
|
||||||
|
|
||||||
if (iterator != ircMessage.tags().end())
|
|
||||||
{
|
|
||||||
m_userName = iterator.value().toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// highlights
|
|
||||||
#warning "xD"
|
|
||||||
|
|
||||||
// color
|
|
||||||
QColor usernameColor = ColorScheme::SystemMessageColor;
|
|
||||||
|
|
||||||
auto iterator = ircMessage.tags().find("color");
|
|
||||||
if (iterator != ircMessage.tags().end())
|
|
||||||
{
|
|
||||||
usernameColor = QColor(iterator.value().toString());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "lazyloadedimage.h"
|
#include "messages/lazyloadedimage.h"
|
||||||
|
|
||||||
#include "asyncexec.h"
|
#include "asyncexec.h"
|
||||||
#include "emotes.h"
|
#include "emotes.h"
|
||||||
|
@ -10,6 +10,9 @@
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace messages {
|
||||||
|
|
||||||
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)
|
||||||
|
@ -63,3 +66,5 @@ LazyLoadedImage::loadImage()
|
||||||
});
|
});
|
||||||
//}));
|
//}));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,9 @@
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace messages {
|
||||||
|
|
||||||
class LazyLoadedImage
|
class LazyLoadedImage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -104,5 +107,7 @@ private:
|
||||||
|
|
||||||
void loadImage();
|
void loadImage();
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // LAZYLOADEDIMAGE_H
|
#endif // LAZYLOADEDIMAGE_H
|
|
@ -1,4 +1,7 @@
|
||||||
#include "link.h"
|
#include "messages/link.h"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace messages {
|
||||||
|
|
||||||
Link::Link()
|
Link::Link()
|
||||||
: type(None)
|
: type(None)
|
||||||
|
@ -11,3 +14,5 @@ Link::Link(Type type, const QString &value)
|
||||||
, value(value)
|
, value(value)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,9 @@
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace messages {
|
||||||
|
|
||||||
class Link
|
class Link
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -42,5 +45,7 @@ private:
|
||||||
Type type;
|
Type type;
|
||||||
QString value;
|
QString value;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // LINK_H
|
#endif // LINK_H
|
|
@ -1,13 +1,13 @@
|
||||||
#include "message.h"
|
#include "messages/message.h"
|
||||||
#include "appsettings.h"
|
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
#include "emojis.h"
|
#include "emojis.h"
|
||||||
#include "emotes.h"
|
#include "emotes.h"
|
||||||
#include "fonts.h"
|
#include "fonts.h"
|
||||||
#include "ircmanager.h"
|
#include "ircmanager.h"
|
||||||
#include "link.h"
|
#include "messages/link.h"
|
||||||
#include "qcolor.h"
|
#include "qcolor.h"
|
||||||
#include "resources.h"
|
#include "resources.h"
|
||||||
|
#include "settings/settings.h"
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
@ -19,6 +19,9 @@
|
||||||
#define MARGIN_TOP 8
|
#define MARGIN_TOP 8
|
||||||
#define MARGIN_BOTTOM 8
|
#define MARGIN_BOTTOM 8
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace messages {
|
||||||
|
|
||||||
QRegularExpression *Message::cheerRegex =
|
QRegularExpression *Message::cheerRegex =
|
||||||
new QRegularExpression("cheer[1-9][0-9]*");
|
new QRegularExpression("cheer[1-9][0-9]*");
|
||||||
|
|
||||||
|
@ -426,16 +429,16 @@ Message::layout(int width, bool enableEmoteMargins)
|
||||||
qreal w = image.getWidth();
|
qreal w = image.getWidth();
|
||||||
qreal h = image.getHeight();
|
qreal h = image.getHeight();
|
||||||
|
|
||||||
if (AppSettings::getScaleEmotesByLineHeight()) {
|
if (settings::Settings::getScaleEmotesByLineHeight()) {
|
||||||
word.setSize(w * mediumTextLineHeight / h *
|
word.setSize(w * mediumTextLineHeight / h *
|
||||||
AppSettings::getEmoteScale(),
|
settings::Settings::getEmoteScale(),
|
||||||
mediumTextLineHeight *
|
mediumTextLineHeight *
|
||||||
AppSettings::getEmoteScale());
|
settings::Settings::getEmoteScale());
|
||||||
} else {
|
} else {
|
||||||
word.setSize(
|
word.setSize(w * image.getScale() *
|
||||||
w * image.getScale() * AppSettings::getEmoteScale(),
|
settings::Settings::getEmoteScale(),
|
||||||
h * image.getScale() *
|
h * image.getScale() *
|
||||||
AppSettings::getEmoteScale());
|
settings::Settings::getEmoteScale());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -471,7 +474,7 @@ Message::layout(int width, bool enableEmoteMargins)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int flags = AppSettings::getWordTypeMask();
|
int flags = settings::Settings::getWordTypeMask();
|
||||||
|
|
||||||
for (auto it = this->words.begin(); it != this->words.end(); ++it) {
|
for (auto it = this->words.begin(); it != this->words.end(); ++it) {
|
||||||
Word &word = *it;
|
Word &word = *it;
|
||||||
|
@ -598,3 +601,5 @@ Message::matchLink(const QString &string)
|
||||||
// TODO: Implement this xD
|
// TODO: Implement this xD
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,13 +2,16 @@
|
||||||
#define MESSAGE_H
|
#define MESSAGE_H
|
||||||
|
|
||||||
#include "channel.h"
|
#include "channel.h"
|
||||||
#include "word.h"
|
#include "messages/word.h"
|
||||||
#include "wordpart.h"
|
#include "messages/wordpart.h"
|
||||||
|
|
||||||
#include <IrcMessage>
|
#include <IrcMessage>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace messages {
|
||||||
|
|
||||||
class Message
|
class Message
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -129,5 +132,7 @@ private:
|
||||||
const std::pair<long int, LazyLoadedImage *> &a,
|
const std::pair<long int, LazyLoadedImage *> &a,
|
||||||
const std::pair<long int, LazyLoadedImage *> &b);
|
const std::pair<long int, LazyLoadedImage *> &b);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MESSAGE_H
|
#endif // MESSAGE_H
|
|
@ -1,4 +1,7 @@
|
||||||
#include "word.h"
|
#include "messages/word.h"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace messages {
|
||||||
|
|
||||||
// Image word
|
// Image word
|
||||||
Word::Word(LazyLoadedImage *image, Type type, const QString ©text,
|
Word::Word(LazyLoadedImage *image, Type type, const QString ©text,
|
||||||
|
@ -30,3 +33,5 @@ Word::Word(const QString &text, Type type, const QColor &color,
|
||||||
, characterWidthCache()
|
, characterWidthCache()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,13 +2,16 @@
|
||||||
#define WORD_H
|
#define WORD_H
|
||||||
|
|
||||||
#include "fonts.h"
|
#include "fonts.h"
|
||||||
#include "lazyloadedimage.h"
|
#include "messages/lazyloadedimage.h"
|
||||||
#include "link.h"
|
#include "messages/link.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace messages {
|
||||||
|
|
||||||
class Word
|
class Word
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -205,5 +208,7 @@ private:
|
||||||
|
|
||||||
std::vector<short> characterWidthCache;
|
std::vector<short> characterWidthCache;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // WORD_H
|
#endif // WORD_H
|
|
@ -1,5 +1,8 @@
|
||||||
#include "wordpart.h"
|
#include "messages/wordpart.h"
|
||||||
#include "word.h"
|
#include "messages/word.h"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace messages {
|
||||||
|
|
||||||
WordPart::WordPart(Word &word, int x, int y, const QString ©Text,
|
WordPart::WordPart(Word &word, int x, int y, const QString ©Text,
|
||||||
bool allowTrailingSpace)
|
bool allowTrailingSpace)
|
||||||
|
@ -27,3 +30,5 @@ WordPart::WordPart(Word &word, int x, int y, int width, int height,
|
||||||
, _trailingSpace(word.hasTrailingSpace() & allowTrailingSpace)
|
, _trailingSpace(word.hasTrailingSpace() & allowTrailingSpace)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,9 @@
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace messages {
|
||||||
|
|
||||||
class Word;
|
class Word;
|
||||||
|
|
||||||
class WordPart
|
class WordPart
|
||||||
|
@ -96,7 +99,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Word& m_word;
|
Word &m_word;
|
||||||
|
|
||||||
QString copyText;
|
QString copyText;
|
||||||
QString text;
|
QString text;
|
||||||
|
@ -108,5 +111,7 @@ private:
|
||||||
|
|
||||||
bool _trailingSpace;
|
bool _trailingSpace;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // WORDPART_H
|
#endif // WORDPART_H
|
|
@ -2,23 +2,25 @@
|
||||||
|
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
|
||||||
LazyLoadedImage *Resources::badgeStaff(NULL);
|
namespace chatterino {
|
||||||
LazyLoadedImage *Resources::badgeAdmin(NULL);
|
|
||||||
LazyLoadedImage *Resources::badgeModerator(NULL);
|
|
||||||
LazyLoadedImage *Resources::badgeGlobalmod(NULL);
|
|
||||||
LazyLoadedImage *Resources::badgeTurbo(NULL);
|
|
||||||
LazyLoadedImage *Resources::badgeBroadcaster(NULL);
|
|
||||||
LazyLoadedImage *Resources::badgePremium(NULL);
|
|
||||||
|
|
||||||
LazyLoadedImage *Resources::cheerBadge100000(NULL);
|
messages::LazyLoadedImage *Resources::badgeStaff(NULL);
|
||||||
LazyLoadedImage *Resources::cheerBadge10000(NULL);
|
messages::LazyLoadedImage *Resources::badgeAdmin(NULL);
|
||||||
LazyLoadedImage *Resources::cheerBadge5000(NULL);
|
messages::LazyLoadedImage *Resources::badgeModerator(NULL);
|
||||||
LazyLoadedImage *Resources::cheerBadge1000(NULL);
|
messages::LazyLoadedImage *Resources::badgeGlobalmod(NULL);
|
||||||
LazyLoadedImage *Resources::cheerBadge100(NULL);
|
messages::LazyLoadedImage *Resources::badgeTurbo(NULL);
|
||||||
LazyLoadedImage *Resources::cheerBadge1(NULL);
|
messages::LazyLoadedImage *Resources::badgeBroadcaster(NULL);
|
||||||
|
messages::LazyLoadedImage *Resources::badgePremium(NULL);
|
||||||
|
|
||||||
LazyLoadedImage *Resources::buttonBan(NULL);
|
messages::LazyLoadedImage *Resources::cheerBadge100000(NULL);
|
||||||
LazyLoadedImage *Resources::buttonTimeout(NULL);
|
messages::LazyLoadedImage *Resources::cheerBadge10000(NULL);
|
||||||
|
messages::LazyLoadedImage *Resources::cheerBadge5000(NULL);
|
||||||
|
messages::LazyLoadedImage *Resources::cheerBadge1000(NULL);
|
||||||
|
messages::LazyLoadedImage *Resources::cheerBadge100(NULL);
|
||||||
|
messages::LazyLoadedImage *Resources::cheerBadge1(NULL);
|
||||||
|
|
||||||
|
messages::LazyLoadedImage *Resources::buttonBan(NULL);
|
||||||
|
messages::LazyLoadedImage *Resources::buttonTimeout(NULL);
|
||||||
|
|
||||||
Resources::Resources()
|
Resources::Resources()
|
||||||
{
|
{
|
||||||
|
@ -29,37 +31,38 @@ Resources::load()
|
||||||
{
|
{
|
||||||
// badges
|
// badges
|
||||||
Resources::badgeStaff =
|
Resources::badgeStaff =
|
||||||
new LazyLoadedImage(new QPixmap(":/images/staff_bg.png"));
|
new messages::LazyLoadedImage(new QPixmap(":/images/staff_bg.png"));
|
||||||
Resources::badgeAdmin =
|
Resources::badgeAdmin =
|
||||||
new LazyLoadedImage(new QPixmap(":/images/admin_bg.png"));
|
new messages::LazyLoadedImage(new QPixmap(":/images/admin_bg.png"));
|
||||||
Resources::badgeModerator =
|
Resources::badgeModerator =
|
||||||
new LazyLoadedImage(new QPixmap(":/images/moderator_bg.png"));
|
new messages::LazyLoadedImage(new QPixmap(":/images/moderator_bg.png"));
|
||||||
Resources::badgeGlobalmod =
|
Resources::badgeGlobalmod =
|
||||||
new LazyLoadedImage(new QPixmap(":/images/globalmod_bg.png"));
|
new messages::LazyLoadedImage(new QPixmap(":/images/globalmod_bg.png"));
|
||||||
Resources::badgeTurbo =
|
Resources::badgeTurbo =
|
||||||
new LazyLoadedImage(new QPixmap(":/images/turbo_bg.png"));
|
new messages::LazyLoadedImage(new QPixmap(":/images/turbo_bg.png"));
|
||||||
Resources::badgeBroadcaster =
|
Resources::badgeBroadcaster = new messages::LazyLoadedImage(
|
||||||
new LazyLoadedImage(new QPixmap(":/images/broadcaster_bg.png"));
|
new QPixmap(":/images/broadcaster_bg.png"));
|
||||||
Resources::badgePremium =
|
Resources::badgePremium = new messages::LazyLoadedImage(
|
||||||
new LazyLoadedImage(new QPixmap(":/images/twitchprime_bg.png"));
|
new QPixmap(":/images/twitchprime_bg.png"));
|
||||||
|
|
||||||
// cheer badges
|
// cheer badges
|
||||||
Resources::cheerBadge100000 =
|
Resources::cheerBadge100000 =
|
||||||
new LazyLoadedImage(new QPixmap(":/images/cheer100000"));
|
new messages::LazyLoadedImage(new QPixmap(":/images/cheer100000"));
|
||||||
Resources::cheerBadge10000 =
|
Resources::cheerBadge10000 =
|
||||||
new LazyLoadedImage(new QPixmap(":/images/cheer10000"));
|
new messages::LazyLoadedImage(new QPixmap(":/images/cheer10000"));
|
||||||
Resources::cheerBadge5000 =
|
Resources::cheerBadge5000 =
|
||||||
new LazyLoadedImage(new QPixmap(":/images/cheer5000"));
|
new messages::LazyLoadedImage(new QPixmap(":/images/cheer5000"));
|
||||||
Resources::cheerBadge1000 =
|
Resources::cheerBadge1000 =
|
||||||
new LazyLoadedImage(new QPixmap(":/images/cheer1000"));
|
new messages::LazyLoadedImage(new QPixmap(":/images/cheer1000"));
|
||||||
Resources::cheerBadge100 =
|
Resources::cheerBadge100 =
|
||||||
new LazyLoadedImage(new QPixmap(":/images/cheer100"));
|
new messages::LazyLoadedImage(new QPixmap(":/images/cheer100"));
|
||||||
Resources::cheerBadge1 =
|
Resources::cheerBadge1 =
|
||||||
new LazyLoadedImage(new QPixmap(":/images/cheer1"));
|
new messages::LazyLoadedImage(new QPixmap(":/images/cheer1"));
|
||||||
|
|
||||||
// button
|
// button
|
||||||
Resources::buttonBan =
|
Resources::buttonBan = new messages::LazyLoadedImage(
|
||||||
new LazyLoadedImage(new QPixmap(":/images/button_ban.png"), 0.25);
|
new QPixmap(":/images/button_ban.png"), 0.25);
|
||||||
Resources::buttonTimeout =
|
Resources::buttonTimeout = new messages::LazyLoadedImage(
|
||||||
new LazyLoadedImage(new QPixmap(":/images/button_timeout.png"), 0.25);
|
new QPixmap(":/images/button_timeout.png"), 0.25);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
65
resources.h
65
resources.h
|
@ -1,7 +1,9 @@
|
||||||
#ifndef RESOURCES_H
|
#ifndef RESOURCES_H
|
||||||
#define RESOURCES_H
|
#define RESOURCES_H
|
||||||
|
|
||||||
#include "lazyloadedimage.h"
|
#include "messages/lazyloadedimage.h"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
class Resources
|
class Resources
|
||||||
{
|
{
|
||||||
|
@ -9,92 +11,92 @@ public:
|
||||||
static void load();
|
static void load();
|
||||||
|
|
||||||
// badges
|
// badges
|
||||||
static LazyLoadedImage *
|
static messages::LazyLoadedImage *
|
||||||
getBadgeStaff()
|
getBadgeStaff()
|
||||||
{
|
{
|
||||||
return badgeStaff;
|
return badgeStaff;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LazyLoadedImage *
|
static messages::LazyLoadedImage *
|
||||||
getBadgeAdmin()
|
getBadgeAdmin()
|
||||||
{
|
{
|
||||||
return badgeAdmin;
|
return badgeAdmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LazyLoadedImage *
|
static messages::LazyLoadedImage *
|
||||||
getBadgeGlobalmod()
|
getBadgeGlobalmod()
|
||||||
{
|
{
|
||||||
return badgeGlobalmod;
|
return badgeGlobalmod;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LazyLoadedImage *
|
static messages::LazyLoadedImage *
|
||||||
getBadgeModerator()
|
getBadgeModerator()
|
||||||
{
|
{
|
||||||
return badgeModerator;
|
return badgeModerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LazyLoadedImage *
|
static messages::LazyLoadedImage *
|
||||||
getBadgeTurbo()
|
getBadgeTurbo()
|
||||||
{
|
{
|
||||||
return badgeTurbo;
|
return badgeTurbo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LazyLoadedImage *
|
static messages::LazyLoadedImage *
|
||||||
getBadgeBroadcaster()
|
getBadgeBroadcaster()
|
||||||
{
|
{
|
||||||
return badgeBroadcaster;
|
return badgeBroadcaster;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LazyLoadedImage *
|
static messages::LazyLoadedImage *
|
||||||
getBadgePremium()
|
getBadgePremium()
|
||||||
{
|
{
|
||||||
return badgePremium;
|
return badgePremium;
|
||||||
}
|
}
|
||||||
|
|
||||||
// cheer badges
|
// cheer badges
|
||||||
static LazyLoadedImage *
|
static messages::LazyLoadedImage *
|
||||||
getCheerBadge100000()
|
getCheerBadge100000()
|
||||||
{
|
{
|
||||||
return cheerBadge100000;
|
return cheerBadge100000;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LazyLoadedImage *
|
static messages::LazyLoadedImage *
|
||||||
getCheerBadge10000()
|
getCheerBadge10000()
|
||||||
{
|
{
|
||||||
return cheerBadge10000;
|
return cheerBadge10000;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LazyLoadedImage *
|
static messages::LazyLoadedImage *
|
||||||
getCheerBadge5000()
|
getCheerBadge5000()
|
||||||
{
|
{
|
||||||
return cheerBadge5000;
|
return cheerBadge5000;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LazyLoadedImage *
|
static messages::LazyLoadedImage *
|
||||||
getCheerBadge1000()
|
getCheerBadge1000()
|
||||||
{
|
{
|
||||||
return cheerBadge1000;
|
return cheerBadge1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LazyLoadedImage *
|
static messages::LazyLoadedImage *
|
||||||
getCheerBadge100()
|
getCheerBadge100()
|
||||||
{
|
{
|
||||||
return cheerBadge100;
|
return cheerBadge100;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LazyLoadedImage *
|
static messages::LazyLoadedImage *
|
||||||
getCheerBadge1()
|
getCheerBadge1()
|
||||||
{
|
{
|
||||||
return cheerBadge1;
|
return cheerBadge1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LazyLoadedImage *
|
static messages::LazyLoadedImage *
|
||||||
getButtonBan()
|
getButtonBan()
|
||||||
{
|
{
|
||||||
return buttonBan;
|
return buttonBan;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LazyLoadedImage *
|
static messages::LazyLoadedImage *
|
||||||
getButtonTimeout()
|
getButtonTimeout()
|
||||||
{
|
{
|
||||||
return buttonTimeout;
|
return buttonTimeout;
|
||||||
|
@ -103,23 +105,24 @@ public:
|
||||||
private:
|
private:
|
||||||
Resources();
|
Resources();
|
||||||
|
|
||||||
static LazyLoadedImage *badgeStaff;
|
static messages::LazyLoadedImage *badgeStaff;
|
||||||
static LazyLoadedImage *badgeAdmin;
|
static messages::LazyLoadedImage *badgeAdmin;
|
||||||
static LazyLoadedImage *badgeGlobalmod;
|
static messages::LazyLoadedImage *badgeGlobalmod;
|
||||||
static LazyLoadedImage *badgeModerator;
|
static messages::LazyLoadedImage *badgeModerator;
|
||||||
static LazyLoadedImage *badgeTurbo;
|
static messages::LazyLoadedImage *badgeTurbo;
|
||||||
static LazyLoadedImage *badgeBroadcaster;
|
static messages::LazyLoadedImage *badgeBroadcaster;
|
||||||
static LazyLoadedImage *badgePremium;
|
static messages::LazyLoadedImage *badgePremium;
|
||||||
|
|
||||||
static LazyLoadedImage *cheerBadge100000;
|
static messages::LazyLoadedImage *cheerBadge100000;
|
||||||
static LazyLoadedImage *cheerBadge10000;
|
static messages::LazyLoadedImage *cheerBadge10000;
|
||||||
static LazyLoadedImage *cheerBadge5000;
|
static messages::LazyLoadedImage *cheerBadge5000;
|
||||||
static LazyLoadedImage *cheerBadge1000;
|
static messages::LazyLoadedImage *cheerBadge1000;
|
||||||
static LazyLoadedImage *cheerBadge100;
|
static messages::LazyLoadedImage *cheerBadge100;
|
||||||
static LazyLoadedImage *cheerBadge1;
|
static messages::LazyLoadedImage *cheerBadge1;
|
||||||
|
|
||||||
static LazyLoadedImage *buttonBan;
|
static messages::LazyLoadedImage *buttonBan;
|
||||||
static LazyLoadedImage *buttonTimeout;
|
static messages::LazyLoadedImage *buttonTimeout;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#endif // RESOURCES_H
|
#endif // RESOURCES_H
|
||||||
|
|
32
settings/realsetting.h
Normal file
32
settings/realsetting.h
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#ifndef REALSETTING_H
|
||||||
|
#define REALSETTING_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace settings {
|
||||||
|
|
||||||
|
class RealSetting : public Setting
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RealSetting(const QString &name, qreal defaultValue,
|
||||||
|
qreal minValue = std::numeric_limits<qreal>::min(),
|
||||||
|
qreal maxValue = std::numeric_limits<qreal>::max())
|
||||||
|
: Setting(name)
|
||||||
|
, value(defaultValue)
|
||||||
|
, defaultValue(defaultValue)
|
||||||
|
, minValue(minValue)
|
||||||
|
, maxValue(maxValue)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
qreal value;
|
||||||
|
qreal defaultValue;
|
||||||
|
qreal minValue;
|
||||||
|
qreal maxValue;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // REALSETTING_H
|
30
settings/setting.h
Normal file
30
settings/setting.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#ifndef SETTING_H
|
||||||
|
#define SETTING_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace settings {
|
||||||
|
|
||||||
|
class Setting
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit Setting(const QString &name)
|
||||||
|
: name(name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString &
|
||||||
|
getName() const
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual QString toString() = 0;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString name;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // SETTING_H
|
18
settings/settings.cpp
Normal file
18
settings/settings.cpp
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#include "settings/settings.h"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace settings {
|
||||||
|
|
||||||
|
messages::Word::Type Settings::wordTypeMask = messages::Word::Default;
|
||||||
|
|
||||||
|
Settings::Settings()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Settings::isIgnoredEmote(const QString &emote)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +1,15 @@
|
||||||
#ifndef APPSETTINGS_H
|
#ifndef APPSETTINGS_H
|
||||||
#define APPSETTINGS_H
|
#define APPSETTINGS_H
|
||||||
|
|
||||||
#include "word.h"
|
#include "messages/word.h"
|
||||||
|
|
||||||
class AppSettings
|
namespace chatterino {
|
||||||
|
namespace settings {
|
||||||
|
|
||||||
|
class Settings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static Word::Type
|
static messages::Word::Type
|
||||||
getWordTypeMask()
|
getWordTypeMask()
|
||||||
{
|
{
|
||||||
return wordTypeMask;
|
return wordTypeMask;
|
||||||
|
@ -33,8 +36,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AppSettings();
|
Settings();
|
||||||
static Word::Type wordTypeMask;
|
static messages::Word::Type wordTypeMask;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // APPSETTINGS_H
|
#endif // APPSETTINGS_H
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include "QString"
|
#include "QString"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
struct TwitchEmoteValue {
|
struct TwitchEmoteValue {
|
||||||
public:
|
public:
|
||||||
int
|
int
|
||||||
|
@ -28,5 +30,6 @@ private:
|
||||||
int id;
|
int id;
|
||||||
QString channelName;
|
QString channelName;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#endif // TWITCHEMOTEVALUE_H
|
#endif // TWITCHEMOTEVALUE_H
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
#include "chatwidget.h"
|
#include "widgets/chatwidget.h"
|
||||||
#include "channels.h"
|
#include "channels.h"
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
#include "textinputdialog.h"
|
#include "widgets/textinputdialog.h"
|
||||||
|
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
ChatWidget::ChatWidget(QWidget *parent)
|
ChatWidget::ChatWidget(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, channel(NULL)
|
, channel(NULL)
|
||||||
|
@ -76,3 +79,5 @@ ChatWidget::paintEvent(QPaintEvent *)
|
||||||
|
|
||||||
painter.fillRect(this->rect(), ColorScheme::instance().ChatBackground);
|
painter.fillRect(this->rect(), ColorScheme::instance().ChatBackground);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,14 +2,17 @@
|
||||||
#define CHATWIDGET_H
|
#define CHATWIDGET_H
|
||||||
|
|
||||||
#include "channel.h"
|
#include "channel.h"
|
||||||
#include "chatwidgetheader.h"
|
#include "widgets/chatwidgetheader.h"
|
||||||
#include "chatwidgetinput.h"
|
#include "widgets/chatwidgetinput.h"
|
||||||
#include "chatwidgetview.h"
|
#include "widgets/chatwidgetview.h"
|
||||||
|
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
class ChatWidget : public QWidget
|
class ChatWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -53,5 +56,7 @@ private:
|
||||||
ChatWidgetView view;
|
ChatWidgetView view;
|
||||||
ChatWidgetInput input;
|
ChatWidgetInput input;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // CHATWIDGET_H
|
#endif // CHATWIDGET_H
|
|
@ -1,13 +1,16 @@
|
||||||
#include "chatwidgetheader.h"
|
#include "widgets/chatwidgetheader.h"
|
||||||
#include "chatwidget.h"
|
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
#include "notebookpage.h"
|
#include "widgets/chatwidget.h"
|
||||||
|
#include "widgets/notebookpage.h"
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QDrag>
|
#include <QDrag>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
ChatWidgetHeader::ChatWidgetHeader(ChatWidget *parent)
|
ChatWidgetHeader::ChatWidgetHeader(ChatWidget *parent)
|
||||||
: QWidget()
|
: QWidget()
|
||||||
, chatWidget(parent)
|
, chatWidget(parent)
|
||||||
|
@ -65,8 +68,9 @@ ChatWidgetHeader::ChatWidgetHeader(ChatWidget *parent)
|
||||||
* SLOT(mouseDoubleClickEvent));
|
* SLOT(mouseDoubleClickEvent));
|
||||||
* mouseDoubleClickEvent is not a signal, its an event handler
|
* mouseDoubleClickEvent is not a signal, its an event handler
|
||||||
*/
|
*/
|
||||||
connect(&this->middleLabel, &SignalLabel::mouseDoubleClick, this, &ChatWidgetHeader::mouseDoubleClickEvent);
|
connect(&this->middleLabel, &SignalLabel::mouseDoubleClick, this,
|
||||||
|
&ChatWidgetHeader::mouseDoubleClickEvent);
|
||||||
|
|
||||||
// right
|
// right
|
||||||
this->rightLabel.setMinimumWidth(height());
|
this->rightLabel.setMinimumWidth(height());
|
||||||
this->rightLabel.getLabel().setTextFormat(Qt::RichText);
|
this->rightLabel.getLabel().setTextFormat(Qt::RichText);
|
||||||
|
@ -208,3 +212,5 @@ void
|
||||||
ChatWidgetHeader::menuShowChangelog()
|
ChatWidgetHeader::menuShowChangelog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
#ifndef CHATWIDGETHEADER_H
|
#ifndef CHATWIDGETHEADER_H
|
||||||
#define CHATWIDGETHEADER_H
|
#define CHATWIDGETHEADER_H
|
||||||
|
|
||||||
#include "chatwidgetheaderbutton.h"
|
|
||||||
#include "signallabel.h"
|
#include "signallabel.h"
|
||||||
|
#include "widgets/chatwidgetheaderbutton.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
@ -13,6 +13,8 @@
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
class ChatWidget;
|
class ChatWidget;
|
||||||
|
|
||||||
class ChatWidgetHeader : public QWidget
|
class ChatWidgetHeader : public QWidget
|
||||||
|
@ -20,7 +22,7 @@ class ChatWidgetHeader : public QWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ChatWidgetHeader(ChatWidget *parent);
|
explicit ChatWidgetHeader(ChatWidget *parent);
|
||||||
|
|
||||||
ChatWidget *
|
ChatWidget *
|
||||||
getChatWidget()
|
getChatWidget()
|
||||||
|
@ -67,5 +69,7 @@ private slots:
|
||||||
void menuManualReconnect();
|
void menuManualReconnect();
|
||||||
void menuShowChangelog();
|
void menuShowChangelog();
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // CHATWIDGETHEADER_H
|
#endif // CHATWIDGETHEADER_H
|
|
@ -1,9 +1,12 @@
|
||||||
#include "chatwidgetheaderbutton.h"
|
#include "widgets/chatwidgetheaderbutton.h"
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
|
|
||||||
#include <QBrush>
|
#include <QBrush>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
ChatWidgetHeaderButton::ChatWidgetHeaderButton()
|
ChatWidgetHeaderButton::ChatWidgetHeaderButton()
|
||||||
: QWidget()
|
: QWidget()
|
||||||
, hbox()
|
, hbox()
|
||||||
|
@ -97,3 +100,5 @@ ChatWidgetHeaderButton::labelMouseDown()
|
||||||
|
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,13 +1,16 @@
|
||||||
#ifndef CHATWIDGETHEADERBUTTON_H
|
#ifndef CHATWIDGETHEADERBUTTON_H
|
||||||
#define CHATWIDGETHEADERBUTTON_H
|
#define CHATWIDGETHEADERBUTTON_H
|
||||||
|
|
||||||
#include "chatwidgetheaderbuttonlabel.h"
|
#include "widgets/chatwidgetheaderbuttonlabel.h"
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
class ChatWidgetHeaderButton : public QWidget
|
class ChatWidgetHeaderButton : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -43,5 +46,7 @@ private:
|
||||||
void labelMouseUp();
|
void labelMouseUp();
|
||||||
void labelMouseDown();
|
void labelMouseDown();
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // CHATWIDGETHEADERBUTTON_H
|
#endif // CHATWIDGETHEADERBUTTON_H
|
|
@ -1,4 +1,7 @@
|
||||||
#include "chatwidgetheaderbuttonlabel.h"
|
#include "widgets/chatwidgetheaderbuttonlabel.h"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
ChatWidgetHeaderButtonLabel::ChatWidgetHeaderButtonLabel()
|
ChatWidgetHeaderButtonLabel::ChatWidgetHeaderButtonLabel()
|
||||||
{
|
{
|
||||||
|
@ -20,3 +23,5 @@ ChatWidgetHeaderButtonLabel::mouseReleaseEvent(QMouseEvent *event)
|
||||||
emit mouseUp();
|
emit mouseUp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,9 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
class ChatWidgetHeaderButtonLabel : public QLabel
|
class ChatWidgetHeaderButtonLabel : public QLabel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -19,5 +22,7 @@ protected:
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
void mouseReleaseEvent(QMouseEvent *event);
|
void mouseReleaseEvent(QMouseEvent *event);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // CHATWIDGETHEADERBUTTONLABEL_H
|
#endif // CHATWIDGETHEADERBUTTONLABEL_H
|
|
@ -1,8 +1,11 @@
|
||||||
#include "chatwidgetinput.h"
|
#include "widgets/chatwidgetinput.h"
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
ChatWidgetInput::ChatWidgetInput()
|
ChatWidgetInput::ChatWidgetInput()
|
||||||
{
|
{
|
||||||
setFixedHeight(38);
|
setFixedHeight(38);
|
||||||
|
@ -17,3 +20,5 @@ ChatWidgetInput::paintEvent(QPaintEvent *)
|
||||||
painter.setPen(ColorScheme::instance().ChatInputBorder);
|
painter.setPen(ColorScheme::instance().ChatInputBorder);
|
||||||
painter.drawRect(0, 0, width() - 1, height() - 1);
|
painter.drawRect(0, 0, width() - 1, height() - 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,9 @@
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
class ChatWidgetInput : public QWidget
|
class ChatWidgetInput : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -14,5 +17,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *);
|
void paintEvent(QPaintEvent *);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // CHATWIDGETINPUT_H
|
#endif // CHATWIDGETINPUT_H
|
|
@ -1,16 +1,19 @@
|
||||||
#include "chatwidgetview.h"
|
#include "widgets/chatwidgetview.h"
|
||||||
#include "channels.h"
|
#include "channels.h"
|
||||||
#include "chatwidget.h"
|
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
#include "message.h"
|
#include "messages/message.h"
|
||||||
#include "word.h"
|
#include "messages/word.h"
|
||||||
#include "wordpart.h"
|
#include "messages/wordpart.h"
|
||||||
|
#include "widgets/chatwidget.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QScroller>
|
#include <QScroller>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
ChatWidgetView::ChatWidgetView(ChatWidget *parent)
|
ChatWidgetView::ChatWidgetView(ChatWidget *parent)
|
||||||
: QWidget()
|
: QWidget()
|
||||||
, chatWidget(parent)
|
, chatWidget(parent)
|
||||||
|
@ -146,3 +149,5 @@ ChatWidgetView::paintEvent(QPaintEvent *)
|
||||||
y += message->getHeight();
|
y += message->getHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,11 +2,13 @@
|
||||||
#define CHATVIEW_H
|
#define CHATVIEW_H
|
||||||
|
|
||||||
#include "channel.h"
|
#include "channel.h"
|
||||||
#include "scrollbar.h"
|
#include "widgets/scrollbar.h"
|
||||||
|
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
class ChatWidget;
|
class ChatWidget;
|
||||||
|
|
||||||
class ChatWidgetView : public QWidget
|
class ChatWidgetView : public QWidget
|
||||||
|
@ -14,7 +16,7 @@ class ChatWidgetView : public QWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ChatWidgetView(ChatWidget *parent);
|
explicit ChatWidgetView(ChatWidget *parent);
|
||||||
|
|
||||||
bool layoutMessages();
|
bool layoutMessages();
|
||||||
|
|
||||||
|
@ -28,5 +30,7 @@ private:
|
||||||
|
|
||||||
ScrollBar scrollbar;
|
ScrollBar scrollbar;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // CHATVIEW_H
|
#endif // CHATVIEW_H
|
|
@ -1,10 +1,13 @@
|
||||||
#include "mainwindow.h"
|
#include "widgets/mainwindow.h"
|
||||||
#include "chatwidget.h"
|
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
#include "notebook.h"
|
#include "widgets/chatwidget.h"
|
||||||
|
#include "widgets/notebook.h"
|
||||||
|
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, notebook(this)
|
, notebook(this)
|
||||||
|
@ -69,3 +72,5 @@ MainWindow::repaintVisibleChatWidgets(Channel *channel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,13 @@
|
||||||
#ifndef MAINWINDOW_H
|
#ifndef MAINWINDOW_H
|
||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
#include "notebook.h"
|
#include "widgets/notebook.h"
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -17,5 +20,7 @@ public:
|
||||||
void layoutVisibleChatWidgets(Channel *channel = NULL);
|
void layoutVisibleChatWidgets(Channel *channel = NULL);
|
||||||
void repaintVisibleChatWidgets(Channel *channel = NULL);
|
void repaintVisibleChatWidgets(Channel *channel = NULL);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
|
@ -1,16 +1,18 @@
|
||||||
#include "notebook.h"
|
#include "widgets/notebook.h"
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
#include "dialog.h"
|
#include "widgets/notebookbutton.h"
|
||||||
#include "notebookbutton.h"
|
#include "widgets/notebookpage.h"
|
||||||
#include "notebookpage.h"
|
#include "widgets/notebooktab.h"
|
||||||
#include "notebooktab.h"
|
#include "widgets/settingsdialog.h"
|
||||||
#include "settingsdialog.h"
|
|
||||||
|
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QLayout>
|
#include <QLayout>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
Notebook::Notebook(QWidget *parent)
|
Notebook::Notebook(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, addButton(this)
|
, addButton(this)
|
||||||
|
@ -109,3 +111,5 @@ Notebook::resizeEvent(QResizeEvent *)
|
||||||
{
|
{
|
||||||
performLayout();
|
performLayout();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,13 +1,16 @@
|
||||||
#ifndef NOTEBOOK_H
|
#ifndef NOTEBOOK_H
|
||||||
#define NOTEBOOK_H
|
#define NOTEBOOK_H
|
||||||
|
|
||||||
#include "notebookbutton.h"
|
#include "widgets/notebookbutton.h"
|
||||||
#include "notebookpage.h"
|
#include "widgets/notebookpage.h"
|
||||||
#include "notebooktab.h"
|
#include "widgets/notebooktab.h"
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
class Notebook : public QWidget
|
class Notebook : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -46,5 +49,7 @@ private:
|
||||||
|
|
||||||
NotebookPage *selectedPage = nullptr;
|
NotebookPage *selectedPage = nullptr;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // NOTEBOOK_H
|
#endif // NOTEBOOK_H
|
|
@ -1,10 +1,13 @@
|
||||||
#include "notebookbutton.h"
|
#include "widgets/notebookbutton.h"
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
|
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPainterPath>
|
#include <QPainterPath>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
NotebookButton::NotebookButton(QWidget *parent)
|
NotebookButton::NotebookButton(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
|
@ -121,3 +124,5 @@ NotebookButton::leaveEvent(QEvent *)
|
||||||
|
|
||||||
this->repaint();
|
this->repaint();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,9 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
class NotebookButton : public QWidget
|
class NotebookButton : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -28,5 +31,7 @@ private:
|
||||||
bool mouseOver = false;
|
bool mouseOver = false;
|
||||||
bool mouseDown = false;
|
bool mouseDown = false;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // NOTEBOOKBUTTON_H
|
#endif // NOTEBOOKBUTTON_H
|
|
@ -1,7 +1,7 @@
|
||||||
#include "notebookpage.h"
|
#include "widgets/notebookpage.h"
|
||||||
#include "chatwidget.h"
|
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
#include "notebooktab.h"
|
#include "widgets/chatwidget.h"
|
||||||
|
#include "widgets/notebooktab.h"
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
|
@ -9,6 +9,9 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
bool NotebookPage::isDraggingSplit = false;
|
bool NotebookPage::isDraggingSplit = false;
|
||||||
ChatWidget *NotebookPage::draggingSplit = NULL;
|
ChatWidget *NotebookPage::draggingSplit = NULL;
|
||||||
std::pair<int, int> NotebookPage::dropPosition = std::pair<int, int>(-1, -1);
|
std::pair<int, int> NotebookPage::dropPosition = std::pair<int, int>(-1, -1);
|
||||||
|
@ -233,3 +236,5 @@ NotebookPage::paintEvent(QPaintEvent *)
|
||||||
ColorScheme::instance().TabSelectedBackground);
|
ColorScheme::instance().TabSelectedBackground);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
#ifndef NOTEBOOKPAGE_H
|
#ifndef NOTEBOOKPAGE_H
|
||||||
#define NOTEBOOKPAGE_H
|
#define NOTEBOOKPAGE_H
|
||||||
|
|
||||||
#include "chatwidget.h"
|
#include "widgets/chatwidget.h"
|
||||||
#include "notebookpage.h"
|
#include "widgets/notebookpage.h"
|
||||||
#include "notebookpagedroppreview.h"
|
#include "widgets/notebookpagedroppreview.h"
|
||||||
#include "notebooktab.h"
|
#include "widgets/notebooktab.h"
|
||||||
|
|
||||||
#include <QDragEnterEvent>
|
#include <QDragEnterEvent>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
@ -13,6 +13,9 @@
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
class NotebookPage : public QWidget
|
class NotebookPage : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -68,5 +71,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
void setPreviewRect(QPoint mousePos);
|
void setPreviewRect(QPoint mousePos);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // NOTEBOOKPAGE_H
|
#endif // NOTEBOOKPAGE_H
|
|
@ -1,8 +1,11 @@
|
||||||
#include "notebookpagedroppreview.h"
|
#include "widgets/notebookpagedroppreview.h"
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
NotebookPageDropPreview::NotebookPageDropPreview(QWidget *parent)
|
NotebookPageDropPreview::NotebookPageDropPreview(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, positionAnimation(this, "geometry")
|
, positionAnimation(this, "geometry")
|
||||||
|
@ -35,3 +38,5 @@ NotebookPageDropPreview::setBounds(const QRect &rect)
|
||||||
|
|
||||||
this->desiredGeometry = rect;
|
this->desiredGeometry = rect;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,9 @@
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
class NotebookPageDropPreview : public QWidget
|
class NotebookPageDropPreview : public QWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -17,5 +20,7 @@ protected:
|
||||||
QPropertyAnimation positionAnimation;
|
QPropertyAnimation positionAnimation;
|
||||||
QRect desiredGeometry;
|
QRect desiredGeometry;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // NOTEBOOKPAGEDROPPREVIEW_H
|
#endif // NOTEBOOKPAGEDROPPREVIEW_H
|
|
@ -1,9 +1,12 @@
|
||||||
#include "notebooktab.h"
|
#include "widgets/notebooktab.h"
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
#include "notebook.h"
|
#include "widgets/notebook.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
NotebookTab::NotebookTab(Notebook *notebook)
|
NotebookTab::NotebookTab(Notebook *notebook)
|
||||||
: QWidget(notebook)
|
: QWidget(notebook)
|
||||||
, notebook(notebook)
|
, notebook(notebook)
|
||||||
|
@ -93,3 +96,5 @@ NotebookTab::dragEnterEvent(QDragEnterEvent *event)
|
||||||
{
|
{
|
||||||
this->notebook->select(page);
|
this->notebook->select(page);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,9 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
class Notebook;
|
class Notebook;
|
||||||
class NotebookPage;
|
class NotebookPage;
|
||||||
|
|
||||||
|
@ -81,5 +84,7 @@ private:
|
||||||
bool mouseDown;
|
bool mouseDown;
|
||||||
HighlightStyle highlightStyle;
|
HighlightStyle highlightStyle;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // NOTEBOOKTAB_H
|
#endif // NOTEBOOKTAB_H
|
|
@ -1,10 +1,13 @@
|
||||||
#include "scrollbar.h"
|
#include "widgets/scrollbar.h"
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
#define MIN_THUMB_HEIGHT 10
|
#define MIN_THUMB_HEIGHT 10
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
ScrollBar::ScrollBar(QWidget *widget)
|
ScrollBar::ScrollBar(QWidget *widget)
|
||||||
: QWidget(widget)
|
: QWidget(widget)
|
||||||
, mutex()
|
, mutex()
|
||||||
|
@ -112,3 +115,5 @@ ScrollBar::updateScroll()
|
||||||
|
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +1,15 @@
|
||||||
#ifndef SCROLLBAR_H
|
#ifndef SCROLLBAR_H
|
||||||
#define SCROLLBAR_H
|
#define SCROLLBAR_H
|
||||||
|
|
||||||
#include "scrollbarhighlight.h"
|
#include "widgets/scrollbarhighlight.h"
|
||||||
|
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
class ScrollBar : public QWidget
|
class ScrollBar : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -106,5 +109,7 @@ private:
|
||||||
|
|
||||||
void updateScroll();
|
void updateScroll();
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // SCROLLBAR_H
|
#endif // SCROLLBAR_H
|
|
@ -1,6 +1,9 @@
|
||||||
#include "scrollbarhighlight.h"
|
#include "widgets/scrollbarhighlight.h"
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
ScrollBarHighlight::ScrollBarHighlight(float position, int colorIndex,
|
ScrollBarHighlight::ScrollBarHighlight(float position, int colorIndex,
|
||||||
Style style, QString tag)
|
Style style, QString tag)
|
||||||
: position(position)
|
: position(position)
|
||||||
|
@ -11,3 +14,5 @@ ScrollBarHighlight::ScrollBarHighlight(float position, int colorIndex,
|
||||||
, next(NULL)
|
, next(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,9 @@
|
||||||
|
|
||||||
#include "QString"
|
#include "QString"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
class ScrollBarHighlight
|
class ScrollBarHighlight
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -43,5 +46,7 @@ private:
|
||||||
int colorIndex;
|
int colorIndex;
|
||||||
QString tag;
|
QString tag;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // SCROLLBARHIGHLIGHT_H
|
#endif // SCROLLBARHIGHLIGHT_H
|
|
@ -1,5 +1,5 @@
|
||||||
#include "settingsdialog.h"
|
#include "widgets/settingsdialog.h"
|
||||||
#include "settingsdialogtab.h"
|
#include "widgets/settingsdialogtab.h"
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
@ -9,6 +9,9 @@
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
#include <QResource>
|
#include <QResource>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
SettingsDialog::SettingsDialog()
|
SettingsDialog::SettingsDialog()
|
||||||
{
|
{
|
||||||
QFile file(":/qss/settings.qss");
|
QFile file(":/qss/settings.qss");
|
||||||
|
@ -172,3 +175,5 @@ SettingsDialog::select(SettingsDialogTab *tab)
|
||||||
"border-right: none;");
|
"border-right: none;");
|
||||||
selectedTab = tab;
|
selectedTab = tab;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef SETTINGSDIALOG_H
|
#ifndef SETTINGSDIALOG_H
|
||||||
#define SETTINGSDIALOG_H
|
#define SETTINGSDIALOG_H
|
||||||
|
|
||||||
#include "settingsdialogtab.h"
|
#include "widgets/settingsdialogtab.h"
|
||||||
|
|
||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
@ -14,6 +14,9 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
class SettingsDialog : public QWidget
|
class SettingsDialog : public QWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -38,5 +41,7 @@ private:
|
||||||
|
|
||||||
QCheckBox *createCheckbox(QString title, QString settingsId);
|
QCheckBox *createCheckbox(QString title, QString settingsId);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // SETTINGSDIALOG_H
|
#endif // SETTINGSDIALOG_H
|
|
@ -1,7 +1,11 @@
|
||||||
#include "settingsdialogtab.h"
|
#include "widgets/settingsdialogtab.h"
|
||||||
#include "QPainter"
|
#include "widgets/settingsdialog.h"
|
||||||
#include "QStyleOption"
|
|
||||||
#include "settingsdialog.h"
|
#include <QPainter>
|
||||||
|
#include <QStyleOption>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
SettingsDialogTab::SettingsDialogTab(SettingsDialog *dialog, QString label,
|
SettingsDialogTab::SettingsDialogTab(SettingsDialog *dialog, QString label,
|
||||||
QString imageRes)
|
QString imageRes)
|
||||||
|
@ -43,3 +47,5 @@ SettingsDialogTab::mouseReleaseEvent(QMouseEvent *event)
|
||||||
|
|
||||||
dialog->select(this);
|
dialog->select(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,9 @@
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
class SettingsDialog;
|
class SettingsDialog;
|
||||||
|
|
||||||
class SettingsDialogTab : public QWidget
|
class SettingsDialogTab : public QWidget
|
||||||
|
@ -58,5 +61,7 @@ private:
|
||||||
|
|
||||||
bool selected = false;
|
bool selected = false;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // SETTINGSNOTEBOOKTAB_H
|
#endif // SETTINGSNOTEBOOKTAB_H
|
|
@ -1,6 +1,9 @@
|
||||||
#include "textinputdialog.h"
|
#include "widgets/textinputdialog.h"
|
||||||
#include <QSizePolicy>
|
#include <QSizePolicy>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
TextInputDialog::TextInputDialog(QWidget *parent)
|
TextInputDialog::TextInputDialog(QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
, vbox(this)
|
, vbox(this)
|
||||||
|
@ -39,3 +42,5 @@ TextInputDialog::cancelButtonClicked()
|
||||||
reject();
|
reject();
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,9 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
class TextInputDialog : public QDialog
|
class TextInputDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -38,5 +41,7 @@ private slots:
|
||||||
void okButtonClicked();
|
void okButtonClicked();
|
||||||
void cancelButtonClicked();
|
void cancelButtonClicked();
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // TEXTINPUTDIALOG_H
|
#endif // TEXTINPUTDIALOG_H
|
|
@ -1,5 +1,7 @@
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
QMutex Windows::windowMutex;
|
QMutex Windows::windowMutex;
|
||||||
|
|
||||||
MainWindow *Windows::mainWindow(NULL);
|
MainWindow *Windows::mainWindow(NULL);
|
||||||
|
@ -15,3 +17,4 @@ Windows::repaintVisibleChatWidgets(Channel *channel)
|
||||||
{
|
{
|
||||||
Windows::mainWindow->repaintVisibleChatWidgets(channel);
|
Windows::mainWindow->repaintVisibleChatWidgets(channel);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
#ifndef WINDOWS_H
|
#ifndef WINDOWS_H
|
||||||
#define WINDOWS_H
|
#define WINDOWS_H
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "widgets/mainwindow.h"
|
||||||
|
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
|
||||||
|
using namespace chatterino::widgets;
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
class Windows
|
class Windows
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -32,5 +36,6 @@ private:
|
||||||
|
|
||||||
static MainWindow *mainWindow;
|
static MainWindow *mainWindow;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#endif // WINDOWS_H
|
#endif // WINDOWS_H
|
||||||
|
|
Loading…
Reference in a new issue