2018-01-12 23:09:05 +01:00
|
|
|
#pragma once
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2022-12-31 15:41:01 +01:00
|
|
|
#include <pajlada/settings.hpp>
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include <pajlada/signals/signal.hpp>
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QComboBox>
|
2021-05-08 15:57:00 +02:00
|
|
|
#include <QLabel>
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include <QLineEdit>
|
2021-05-08 15:57:00 +02:00
|
|
|
#include <QPainter>
|
|
|
|
#include <QPushButton>
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include <QSpinBox>
|
2021-05-08 15:57:00 +02:00
|
|
|
|
2019-09-01 23:23:20 +02:00
|
|
|
#define SETTINGS_PAGE_WIDGET_BOILERPLATE(type, parent) \
|
|
|
|
class type : public parent \
|
|
|
|
{ \
|
|
|
|
using parent::parent; \
|
|
|
|
\
|
|
|
|
public: \
|
|
|
|
bool greyedOut{}; \
|
|
|
|
\
|
|
|
|
protected: \
|
|
|
|
void paintEvent(QPaintEvent *e) override \
|
|
|
|
{ \
|
|
|
|
parent::paintEvent(e); \
|
|
|
|
\
|
|
|
|
if (this->greyedOut) \
|
|
|
|
{ \
|
|
|
|
QPainter painter(this); \
|
|
|
|
QColor color = QColor("#222222"); \
|
|
|
|
color.setAlphaF(0.7); \
|
|
|
|
painter.fillRect(this->rect(), color); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
};
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-01-12 23:09:05 +01:00
|
|
|
namespace chatterino {
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2019-09-03 11:15:38 +02:00
|
|
|
// S* widgets are the same as their Q* counterparts,
|
|
|
|
// but they can be greyed out and will be if you search.
|
2019-09-01 23:23:20 +02:00
|
|
|
SETTINGS_PAGE_WIDGET_BOILERPLATE(SCheckBox, QCheckBox)
|
|
|
|
SETTINGS_PAGE_WIDGET_BOILERPLATE(SLabel, QLabel)
|
|
|
|
SETTINGS_PAGE_WIDGET_BOILERPLATE(SComboBox, QComboBox)
|
2019-09-03 11:15:38 +02:00
|
|
|
SETTINGS_PAGE_WIDGET_BOILERPLATE(SPushButton, QPushButton)
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-10-21 15:32:28 +02:00
|
|
|
class SettingsDialogTab;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-10-31 19:45:51 +01:00
|
|
|
class SettingsPage : public QFrame
|
2018-01-12 23:09:05 +01:00
|
|
|
{
|
2018-10-31 19:45:51 +01:00
|
|
|
Q_OBJECT
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-01-12 23:09:05 +01:00
|
|
|
public:
|
2020-02-21 01:59:58 +01:00
|
|
|
SettingsPage();
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2019-09-02 16:39:21 +02:00
|
|
|
virtual bool filterElements(const QString &query);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-10-21 15:32:28 +02:00
|
|
|
SettingsDialogTab *tab() const;
|
|
|
|
void setTab(SettingsDialogTab *tab);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-01-12 23:09:05 +01:00
|
|
|
void cancel();
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-01-12 23:09:05 +01:00
|
|
|
QCheckBox *createCheckBox(const QString &text,
|
|
|
|
pajlada::Settings::Setting<bool> &setting);
|
|
|
|
QComboBox *createComboBox(const QStringList &items,
|
|
|
|
pajlada::Settings::Setting<QString> &setting);
|
|
|
|
QLineEdit *createLineEdit(pajlada::Settings::Setting<QString> &setting);
|
2018-03-30 15:42:59 +02:00
|
|
|
QSpinBox *createSpinBox(pajlada::Settings::Setting<int> &setting,
|
|
|
|
int min = 0, int max = 2500);
|
2022-12-03 17:01:49 +01:00
|
|
|
template <typename T>
|
|
|
|
SLabel *createLabel(const std::function<QString(const T &)> &makeText,
|
|
|
|
pajlada::Settings::Setting<T> &setting)
|
|
|
|
{
|
|
|
|
auto *label = new SLabel();
|
|
|
|
|
|
|
|
setting.connect(
|
|
|
|
[label, makeText](const T &value, auto) {
|
|
|
|
label->setText(makeText(value));
|
|
|
|
},
|
|
|
|
this->managedConnections_);
|
|
|
|
|
|
|
|
return label;
|
|
|
|
}
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-05-12 20:34:13 +02:00
|
|
|
virtual void onShow()
|
|
|
|
{
|
|
|
|
}
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-01-12 23:09:05 +01:00
|
|
|
protected:
|
2018-10-21 15:32:28 +02:00
|
|
|
SettingsDialogTab *tab_;
|
2018-07-06 19:23:47 +02:00
|
|
|
pajlada::Signals::NoArgSignal onCancel_;
|
2021-12-19 15:57:56 +01:00
|
|
|
pajlada::Signals::SignalHolder managedConnections_;
|
2018-01-12 23:09:05 +01:00
|
|
|
};
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-01-12 23:09:05 +01:00
|
|
|
} // namespace chatterino
|