removed settings namespace
This commit is contained in:
+3
-3
@@ -51,7 +51,7 @@ SOURCES += main.cpp\
|
|||||||
messages/word.cpp \
|
messages/word.cpp \
|
||||||
messages/wordpart.cpp \
|
messages/wordpart.cpp \
|
||||||
resources.cpp \
|
resources.cpp \
|
||||||
settings/settings.cpp \
|
settings.cpp \
|
||||||
widgets/chatwidget.cpp \
|
widgets/chatwidget.cpp \
|
||||||
widgets/chatwidgetheader.cpp \
|
widgets/chatwidgetheader.cpp \
|
||||||
widgets/chatwidgetheaderbutton.cpp \
|
widgets/chatwidgetheaderbutton.cpp \
|
||||||
@@ -87,8 +87,8 @@ HEADERS += account.h \
|
|||||||
messages/word.h \
|
messages/word.h \
|
||||||
messages/wordpart.h \
|
messages/wordpart.h \
|
||||||
resources.h \
|
resources.h \
|
||||||
settings/setting.h \
|
setting.h \
|
||||||
settings/settings.h \
|
settings.h \
|
||||||
twitchemotevalue.h \
|
twitchemotevalue.h \
|
||||||
widgets/chatwidget.h \
|
widgets/chatwidget.h \
|
||||||
widgets/chatwidgetheader.h \
|
widgets/chatwidgetheader.h \
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "emojis.h"
|
#include "emojis.h"
|
||||||
#include "ircmanager.h"
|
#include "ircmanager.h"
|
||||||
#include "resources.h"
|
#include "resources.h"
|
||||||
#include "settings/settings.h"
|
#include "settings.h"
|
||||||
#include "widgets/mainwindow.h"
|
#include "widgets/mainwindow.h"
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
settings::Settings::getInstance().load();
|
Settings::getInstance().load();
|
||||||
Resources::load();
|
Resources::load();
|
||||||
Emojis::loadEmojis();
|
Emojis::loadEmojis();
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
int ret = a.exec();
|
int ret = a.exec();
|
||||||
|
|
||||||
settings::Settings::getInstance().save();
|
Settings::getInstance().save();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include "messages/link.h"
|
#include "messages/link.h"
|
||||||
#include "qcolor.h"
|
#include "qcolor.h"
|
||||||
#include "resources.h"
|
#include "resources.h"
|
||||||
#include "settings/settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
@@ -405,7 +405,7 @@ Message::Message(const IrcPrivateMessage &ircMessage, const Channel &channel,
|
|||||||
bool
|
bool
|
||||||
Message::layout(int width, bool enableEmoteMargins)
|
Message::layout(int width, bool enableEmoteMargins)
|
||||||
{
|
{
|
||||||
auto &settings = settings::Settings::getInstance();
|
auto &settings = Settings::getInstance();
|
||||||
|
|
||||||
width = width - (width % 2);
|
width = width - (width % 2);
|
||||||
|
|
||||||
@@ -475,7 +475,7 @@ Message::layout(int width, bool enableEmoteMargins)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t flags = settings::Settings::getInstance().getWordTypeMask();
|
uint32_t flags = Settings::getInstance().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;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include <boost/signals2.hpp>
|
#include <boost/signals2.hpp>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace settings {
|
|
||||||
|
|
||||||
class BaseSetting
|
class BaseSetting
|
||||||
{
|
{
|
||||||
@@ -79,7 +78,6 @@ private:
|
|||||||
T value;
|
T value;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace settings
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
||||||
#endif // SETTING_H
|
#endif // SETTING_H
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
#include "settings/settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace settings {
|
|
||||||
|
|
||||||
Settings Settings::instance;
|
Settings Settings::instance;
|
||||||
|
|
||||||
@@ -120,5 +119,4 @@ Settings::updateWordTypeMask()
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace settings
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
@@ -2,12 +2,11 @@
|
|||||||
#define APPSETTINGS_H
|
#define APPSETTINGS_H
|
||||||
|
|
||||||
#include "messages/word.h"
|
#include "messages/word.h"
|
||||||
#include "settings/setting.h"
|
#include "setting.h"
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace settings {
|
|
||||||
|
|
||||||
class Settings : public QObject
|
class Settings : public QObject
|
||||||
{
|
{
|
||||||
@@ -98,7 +97,6 @@ public:
|
|||||||
Setting<bool> hideTabX;
|
Setting<bool> hideTabX;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace settings
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
||||||
#endif // APPSETTINGS_H
|
#endif // APPSETTINGS_H
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "widgets/chatwidget.h"
|
#include "widgets/chatwidget.h"
|
||||||
#include "channels.h"
|
#include "channels.h"
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
#include "settings/settings.h"
|
#include "settings.h"
|
||||||
#include "widgets/textinputdialog.h"
|
#include "widgets/textinputdialog.h"
|
||||||
|
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "widgets/chatwidgetinput.h"
|
#include "widgets/chatwidgetinput.h"
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
#include "settings/settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
@@ -41,11 +41,11 @@ ChatWidgetInput::ChatWidgetInput()
|
|||||||
this->refreshTheme();
|
this->refreshTheme();
|
||||||
|
|
||||||
this->setMessageLengthVisisble(
|
this->setMessageLengthVisisble(
|
||||||
settings::Settings::getInstance().showMessageLength.get());
|
Settings::getInstance().showMessageLength.get());
|
||||||
|
|
||||||
/* XXX(pajlada): FIX THIS
|
/* XXX(pajlada): FIX THIS
|
||||||
QObject::connect(&settings::Settings::getInstance().showMessageLength,
|
QObject::connect(&Settings::getInstance().showMessageLength,
|
||||||
&settings::BoolSetting::valueChanged, this,
|
&BoolSetting::valueChanged, this,
|
||||||
&ChatWidgetInput::setMessageLengthVisisble);
|
&ChatWidgetInput::setMessageLengthVisisble);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
@@ -54,8 +54,8 @@ ChatWidgetInput::~ChatWidgetInput()
|
|||||||
{
|
{
|
||||||
/* XXX(pajlada): FIX THIS
|
/* XXX(pajlada): FIX THIS
|
||||||
QObject::disconnect(
|
QObject::disconnect(
|
||||||
&settings::Settings::getInstance().getShowMessageLength(),
|
&Settings::getInstance().getShowMessageLength(),
|
||||||
&settings::BoolSetting::valueChanged, this,
|
&BoolSetting::valueChanged, this,
|
||||||
&ChatWidgetInput::setMessageLengthVisisble);
|
&ChatWidgetInput::setMessageLengthVisisble);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
#include "messages/message.h"
|
#include "messages/message.h"
|
||||||
#include "messages/wordpart.h"
|
#include "messages/wordpart.h"
|
||||||
#include "settings/settings.h"
|
#include "settings.h"
|
||||||
#include "widgets/chatwidget.h"
|
#include "widgets/chatwidget.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@@ -23,15 +23,14 @@ ChatWidgetView::ChatWidgetView(ChatWidget *parent)
|
|||||||
|
|
||||||
scroll->scrollTo(QPointF(0, 100));
|
scroll->scrollTo(QPointF(0, 100));
|
||||||
|
|
||||||
QObject::connect(&settings::Settings::getInstance(),
|
QObject::connect(&Settings::getInstance(), &Settings::wordTypeMaskChanged,
|
||||||
&settings::Settings::wordTypeMaskChanged, this,
|
this, &ChatWidgetView::wordTypeMaskChanged);
|
||||||
&ChatWidgetView::wordTypeMaskChanged);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatWidgetView::~ChatWidgetView()
|
ChatWidgetView::~ChatWidgetView()
|
||||||
{
|
{
|
||||||
QObject::disconnect(&settings::Settings::getInstance(),
|
QObject::disconnect(&Settings::getInstance(),
|
||||||
&settings::Settings::wordTypeMaskChanged, this,
|
&Settings::wordTypeMaskChanged, this,
|
||||||
&ChatWidgetView::wordTypeMaskChanged);
|
&ChatWidgetView::wordTypeMaskChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-13
@@ -1,6 +1,6 @@
|
|||||||
#include "widgets/notebooktab.h"
|
#include "widgets/notebooktab.h"
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
#include "settings/settings.h"
|
#include "settings.h"
|
||||||
#include "widgets/notebook.h"
|
#include "widgets/notebook.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
@@ -25,8 +25,8 @@ NotebookTab::NotebookTab(Notebook *notebook)
|
|||||||
this->setAcceptDrops(true);
|
this->setAcceptDrops(true);
|
||||||
|
|
||||||
/* XXX(pajlada): Fix this
|
/* XXX(pajlada): Fix this
|
||||||
QObject::connect(&settings::Settings::getInstance().getHideTabX(),
|
QObject::connect(&Settings::getInstance().getHideTabX(),
|
||||||
&settings::BoolSetting::valueChanged, this,
|
&BoolSetting::valueChanged, this,
|
||||||
&NotebookTab::hideTabXChanged);
|
&NotebookTab::hideTabXChanged);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -36,8 +36,8 @@ NotebookTab::NotebookTab(Notebook *notebook)
|
|||||||
NotebookTab::~NotebookTab()
|
NotebookTab::~NotebookTab()
|
||||||
{
|
{
|
||||||
/* XXX(pajlada): Fix this
|
/* XXX(pajlada): Fix this
|
||||||
QObject::disconnect(&settings::Settings::getInstance().getHideTabX(),
|
QObject::disconnect(&Settings::getInstance().getHideTabX(),
|
||||||
&settings::BoolSetting::valueChanged, this,
|
&BoolSetting::valueChanged, this,
|
||||||
&NotebookTab::hideTabXChanged);
|
&NotebookTab::hideTabXChanged);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ NotebookTab::~NotebookTab()
|
|||||||
void
|
void
|
||||||
NotebookTab::calcSize()
|
NotebookTab::calcSize()
|
||||||
{
|
{
|
||||||
if (settings::Settings::getInstance().hideTabX.get()) {
|
if (Settings::getInstance().hideTabX.get()) {
|
||||||
this->resize(this->fontMetrics().width(this->text) + 8, 24);
|
this->resize(this->fontMetrics().width(this->text) + 8, 24);
|
||||||
} else {
|
} else {
|
||||||
this->resize(this->fontMetrics().width(this->text) + 8 + 24, 24);
|
this->resize(this->fontMetrics().width(this->text) + 8 + 24, 24);
|
||||||
@@ -103,14 +103,13 @@ NotebookTab::paintEvent(QPaintEvent *)
|
|||||||
|
|
||||||
painter.setPen(fg);
|
painter.setPen(fg);
|
||||||
|
|
||||||
QRect rect(
|
QRect rect(0, 0,
|
||||||
0, 0,
|
width() - (Settings::getInstance().hideTabX.get() ? 0 : 16),
|
||||||
width() - (settings::Settings::getInstance().hideTabX.get() ? 0 : 16),
|
height());
|
||||||
height());
|
|
||||||
|
|
||||||
painter.drawText(rect, this->text, QTextOption(Qt::AlignCenter));
|
painter.drawText(rect, this->text, QTextOption(Qt::AlignCenter));
|
||||||
|
|
||||||
if (!settings::Settings::getInstance().hideTabX.get() &&
|
if (!Settings::getInstance().hideTabX.get() &&
|
||||||
(this->mouseOver || this->selected)) {
|
(this->mouseOver || this->selected)) {
|
||||||
if (this->mouseOverX) {
|
if (this->mouseOverX) {
|
||||||
painter.fillRect(this->getXRect(), QColor(0, 0, 0, 64));
|
painter.fillRect(this->getXRect(), QColor(0, 0, 0, 64));
|
||||||
@@ -143,7 +142,7 @@ NotebookTab::mouseReleaseEvent(QMouseEvent *event)
|
|||||||
{
|
{
|
||||||
this->mouseDown = false;
|
this->mouseDown = false;
|
||||||
|
|
||||||
if (this->mouseDownX) {
|
if (this->mouseDownX && this->getXRect().contains(event->pos())) {
|
||||||
this->mouseDownX = false;
|
this->mouseDownX = false;
|
||||||
|
|
||||||
this->notebook->removePage(this->page);
|
this->notebook->removePage(this->page);
|
||||||
@@ -169,7 +168,7 @@ NotebookTab::leaveEvent(QEvent *)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NotebookTab::dragEnterEvent(QDragEnterEvent *event)
|
NotebookTab::dragEnterEvent(QDragEnterEvent *)
|
||||||
{
|
{
|
||||||
this->notebook->select(page);
|
this->notebook->select(page);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ public:
|
|||||||
sizePolicy.setVerticalPolicy(QSizePolicy::Preferred);
|
sizePolicy.setVerticalPolicy(QSizePolicy::Preferred);
|
||||||
this->setSizePolicy(sizePolicy);
|
this->setSizePolicy(sizePolicy);
|
||||||
|
|
||||||
QObject::connect(this, &QTextEdit::textChanged, this, &QWidget::updateGeometry);
|
QObject::connect(this, &QTextEdit::textChanged, this,
|
||||||
|
&QWidget::updateGeometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize
|
QSize
|
||||||
@@ -30,21 +31,12 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
int
|
int
|
||||||
heightForWidth(int w) const override
|
heightForWidth(int) const override
|
||||||
{
|
{
|
||||||
auto margins = this->contentsMargins();
|
auto margins = this->contentsMargins();
|
||||||
|
|
||||||
int documentWidth;
|
return margins.top() + document()->size().height() + margins.bottom() +
|
||||||
|
5;
|
||||||
if (w >= margins.left() + margins.right()) {
|
|
||||||
documentWidth = w - margins.left() - margins.right();
|
|
||||||
} else {
|
|
||||||
documentWidth = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto document = this->document()->clone();
|
|
||||||
|
|
||||||
return margins.top() + document->size().height() + margins.bottom() + 5;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ SettingsDialog::SettingsDialog()
|
|||||||
void
|
void
|
||||||
SettingsDialog::addTabs()
|
SettingsDialog::addTabs()
|
||||||
{
|
{
|
||||||
settings::Settings &settings = settings::Settings::getInstance();
|
Settings &settings = Settings::getInstance();
|
||||||
|
|
||||||
QVBoxLayout *vbox;
|
QVBoxLayout *vbox;
|
||||||
|
|
||||||
@@ -227,7 +227,7 @@ SettingsDialog::select(SettingsDialogTab *tab)
|
|||||||
/// Widget creation helpers
|
/// Widget creation helpers
|
||||||
QCheckBox *
|
QCheckBox *
|
||||||
SettingsDialog::createCheckbox(const QString &title,
|
SettingsDialog::createCheckbox(const QString &title,
|
||||||
settings::Setting<bool> &setting)
|
Setting<bool> &setting)
|
||||||
{
|
{
|
||||||
auto checkbox = new QCheckBox(title);
|
auto checkbox = new QCheckBox(title);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef SETTINGSDIALOG_H
|
#ifndef SETTINGSDIALOG_H
|
||||||
#define SETTINGSDIALOG_H
|
#define SETTINGSDIALOG_H
|
||||||
|
|
||||||
#include "settings/settings.h"
|
#include "settings.h"
|
||||||
#include "widgets/settingsdialogtab.h"
|
#include "widgets/settingsdialogtab.h"
|
||||||
|
|
||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
@@ -42,7 +42,7 @@ private:
|
|||||||
|
|
||||||
/// Widget creation helpers
|
/// Widget creation helpers
|
||||||
QCheckBox *createCheckbox(const QString &title,
|
QCheckBox *createCheckbox(const QString &title,
|
||||||
settings::Setting<bool> &setting);
|
Setting<bool> &setting);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace widgets
|
} // namespace widgets
|
||||||
|
|||||||
Reference in New Issue
Block a user