2019-09-08 22:27:57 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "singletons/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-08 22:27:57 +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); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
// S* widgets are the same as their Q* counterparts,
|
|
|
|
// but they can be greyed out and will be if you search.
|
|
|
|
SETTINGS_PAGE_WIDGET_BOILERPLATE(SCheckBox, QCheckBox)
|
|
|
|
SETTINGS_PAGE_WIDGET_BOILERPLATE(SLabel, QLabel)
|
|
|
|
SETTINGS_PAGE_WIDGET_BOILERPLATE(SComboBox, QComboBox)
|
|
|
|
SETTINGS_PAGE_WIDGET_BOILERPLATE(SPushButton, QPushButton)
|
|
|
|
|
|
|
|
class SettingsDialogTab;
|
|
|
|
|
|
|
|
class SettingsPage : public QFrame
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-02-21 01:59:58 +01:00
|
|
|
SettingsPage();
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
virtual bool filterElements(const QString &query);
|
|
|
|
|
|
|
|
SettingsDialogTab *tab() const;
|
|
|
|
void setTab(SettingsDialogTab *tab);
|
|
|
|
|
|
|
|
void cancel();
|
|
|
|
|
|
|
|
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);
|
|
|
|
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
|
|
|
|
|
|
|
virtual void onShow()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
SettingsDialogTab *tab_;
|
|
|
|
pajlada::Signals::NoArgSignal onCancel_;
|
2021-12-19 15:57:56 +01:00
|
|
|
pajlada::Signals::SignalHolder managedConnections_;
|
2019-09-08 22:27:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|