removed settings namespace

This commit is contained in:
fourtf
2017-01-23 16:38:06 +01:00
parent 13e7f43278
commit 9041dbf014
13 changed files with 44 additions and 60 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
#include "widgets/chatwidget.h"
#include "channels.h"
#include "colorscheme.h"
#include "settings/settings.h"
#include "settings.h"
#include "widgets/textinputdialog.h"
#include <QFont>
+6 -6
View File
@@ -1,6 +1,6 @@
#include "widgets/chatwidgetinput.h"
#include "colorscheme.h"
#include "settings/settings.h"
#include "settings.h"
#include <QPainter>
@@ -41,11 +41,11 @@ ChatWidgetInput::ChatWidgetInput()
this->refreshTheme();
this->setMessageLengthVisisble(
settings::Settings::getInstance().showMessageLength.get());
Settings::getInstance().showMessageLength.get());
/* XXX(pajlada): FIX THIS
QObject::connect(&settings::Settings::getInstance().showMessageLength,
&settings::BoolSetting::valueChanged, this,
QObject::connect(&Settings::getInstance().showMessageLength,
&BoolSetting::valueChanged, this,
&ChatWidgetInput::setMessageLengthVisisble);
*/
}
@@ -54,8 +54,8 @@ ChatWidgetInput::~ChatWidgetInput()
{
/* XXX(pajlada): FIX THIS
QObject::disconnect(
&settings::Settings::getInstance().getShowMessageLength(),
&settings::BoolSetting::valueChanged, this,
&Settings::getInstance().getShowMessageLength(),
&BoolSetting::valueChanged, this,
&ChatWidgetInput::setMessageLengthVisisble);
*/
}
+5 -6
View File
@@ -3,7 +3,7 @@
#include "colorscheme.h"
#include "messages/message.h"
#include "messages/wordpart.h"
#include "settings/settings.h"
#include "settings.h"
#include "widgets/chatwidget.h"
#include <math.h>
@@ -23,15 +23,14 @@ ChatWidgetView::ChatWidgetView(ChatWidget *parent)
scroll->scrollTo(QPointF(0, 100));
QObject::connect(&settings::Settings::getInstance(),
&settings::Settings::wordTypeMaskChanged, this,
&ChatWidgetView::wordTypeMaskChanged);
QObject::connect(&Settings::getInstance(), &Settings::wordTypeMaskChanged,
this, &ChatWidgetView::wordTypeMaskChanged);
}
ChatWidgetView::~ChatWidgetView()
{
QObject::disconnect(&settings::Settings::getInstance(),
&settings::Settings::wordTypeMaskChanged, this,
QObject::disconnect(&Settings::getInstance(),
&Settings::wordTypeMaskChanged, this,
&ChatWidgetView::wordTypeMaskChanged);
}
+12 -13
View File
@@ -1,6 +1,6 @@
#include "widgets/notebooktab.h"
#include "colorscheme.h"
#include "settings/settings.h"
#include "settings.h"
#include "widgets/notebook.h"
#include <QPainter>
@@ -25,8 +25,8 @@ NotebookTab::NotebookTab(Notebook *notebook)
this->setAcceptDrops(true);
/* XXX(pajlada): Fix this
QObject::connect(&settings::Settings::getInstance().getHideTabX(),
&settings::BoolSetting::valueChanged, this,
QObject::connect(&Settings::getInstance().getHideTabX(),
&BoolSetting::valueChanged, this,
&NotebookTab::hideTabXChanged);
*/
@@ -36,8 +36,8 @@ NotebookTab::NotebookTab(Notebook *notebook)
NotebookTab::~NotebookTab()
{
/* XXX(pajlada): Fix this
QObject::disconnect(&settings::Settings::getInstance().getHideTabX(),
&settings::BoolSetting::valueChanged, this,
QObject::disconnect(&Settings::getInstance().getHideTabX(),
&BoolSetting::valueChanged, this,
&NotebookTab::hideTabXChanged);
*/
}
@@ -45,7 +45,7 @@ NotebookTab::~NotebookTab()
void
NotebookTab::calcSize()
{
if (settings::Settings::getInstance().hideTabX.get()) {
if (Settings::getInstance().hideTabX.get()) {
this->resize(this->fontMetrics().width(this->text) + 8, 24);
} else {
this->resize(this->fontMetrics().width(this->text) + 8 + 24, 24);
@@ -103,14 +103,13 @@ NotebookTab::paintEvent(QPaintEvent *)
painter.setPen(fg);
QRect rect(
0, 0,
width() - (settings::Settings::getInstance().hideTabX.get() ? 0 : 16),
height());
QRect rect(0, 0,
width() - (Settings::getInstance().hideTabX.get() ? 0 : 16),
height());
painter.drawText(rect, this->text, QTextOption(Qt::AlignCenter));
if (!settings::Settings::getInstance().hideTabX.get() &&
if (!Settings::getInstance().hideTabX.get() &&
(this->mouseOver || this->selected)) {
if (this->mouseOverX) {
painter.fillRect(this->getXRect(), QColor(0, 0, 0, 64));
@@ -143,7 +142,7 @@ NotebookTab::mouseReleaseEvent(QMouseEvent *event)
{
this->mouseDown = false;
if (this->mouseDownX) {
if (this->mouseDownX && this->getXRect().contains(event->pos())) {
this->mouseDownX = false;
this->notebook->removePage(this->page);
@@ -169,7 +168,7 @@ NotebookTab::leaveEvent(QEvent *)
}
void
NotebookTab::dragEnterEvent(QDragEnterEvent *event)
NotebookTab::dragEnterEvent(QDragEnterEvent *)
{
this->notebook->select(page);
}
+5 -13
View File
@@ -13,7 +13,8 @@ public:
sizePolicy.setVerticalPolicy(QSizePolicy::Preferred);
this->setSizePolicy(sizePolicy);
QObject::connect(this, &QTextEdit::textChanged, this, &QWidget::updateGeometry);
QObject::connect(this, &QTextEdit::textChanged, this,
&QWidget::updateGeometry);
}
QSize
@@ -30,21 +31,12 @@ public:
protected:
int
heightForWidth(int w) const override
heightForWidth(int) const override
{
auto margins = this->contentsMargins();
int documentWidth;
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;
return margins.top() + document()->size().height() + margins.bottom() +
5;
}
};
+2 -2
View File
@@ -54,7 +54,7 @@ SettingsDialog::SettingsDialog()
void
SettingsDialog::addTabs()
{
settings::Settings &settings = settings::Settings::getInstance();
Settings &settings = Settings::getInstance();
QVBoxLayout *vbox;
@@ -227,7 +227,7 @@ SettingsDialog::select(SettingsDialogTab *tab)
/// Widget creation helpers
QCheckBox *
SettingsDialog::createCheckbox(const QString &title,
settings::Setting<bool> &setting)
Setting<bool> &setting)
{
auto checkbox = new QCheckBox(title);
+2 -2
View File
@@ -1,7 +1,7 @@
#ifndef SETTINGSDIALOG_H
#define SETTINGSDIALOG_H
#include "settings/settings.h"
#include "settings.h"
#include "widgets/settingsdialogtab.h"
#include <QButtonGroup>
@@ -42,7 +42,7 @@ private:
/// Widget creation helpers
QCheckBox *createCheckbox(const QString &title,
settings::Setting<bool> &setting);
Setting<bool> &setting);
};
} // namespace widgets