2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2017-01-01 18:43:52 +01:00
|
|
|
|
2018-06-26 15:11:45 +02:00
|
|
|
#include "widgets/BaseWindow.hpp"
|
2018-01-12 23:33:04 +01:00
|
|
|
|
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/settings/setting.hpp>
|
|
|
|
#include <QFrame>
|
2017-01-18 04:33:30 +01:00
|
|
|
#include <QPushButton>
|
|
|
|
#include <QStackedLayout>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QWidget>
|
|
|
|
|
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 <functional>
|
2021-05-08 15:57:00 +02:00
|
|
|
|
2019-09-01 23:23:20 +02:00
|
|
|
class QLineEdit;
|
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace chatterino {
|
2017-01-18 21:30:23 +01:00
|
|
|
|
2018-01-12 23:33:04 +01:00
|
|
|
class SettingsPage;
|
|
|
|
class SettingsDialogTab;
|
2018-10-21 15:32:28 +02:00
|
|
|
class ModerationPage;
|
2022-12-31 15:41:01 +01:00
|
|
|
enum class SettingsTabId;
|
2018-10-21 15:32:28 +02:00
|
|
|
|
2019-09-02 18:59:37 +02:00
|
|
|
class PageHeader : public QFrame
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
};
|
|
|
|
|
2018-10-21 15:32:28 +02:00
|
|
|
enum class SettingsDialogPreference {
|
|
|
|
NoPreference,
|
2023-05-27 12:38:25 +02:00
|
|
|
StreamerMode,
|
2018-10-21 15:32:28 +02:00
|
|
|
Accounts,
|
|
|
|
ModerationActions,
|
|
|
|
};
|
2018-01-12 23:33:04 +01:00
|
|
|
|
2018-01-14 21:55:36 +01:00
|
|
|
class SettingsDialog : public BaseWindow
|
2017-01-01 18:43:52 +01:00
|
|
|
{
|
2020-10-31 16:42:48 +01:00
|
|
|
SettingsDialog(QWidget *parent);
|
2017-01-01 18:43:52 +01:00
|
|
|
|
2020-07-18 15:56:33 +02:00
|
|
|
public:
|
2020-10-31 16:42:48 +01:00
|
|
|
static void showDialog(QWidget *parent,
|
|
|
|
SettingsDialogPreference preferredTab =
|
2018-10-21 15:32:28 +02:00
|
|
|
SettingsDialogPreference::NoPreference);
|
2017-10-08 16:31:16 +02:00
|
|
|
|
2017-12-18 00:54:17 +01:00
|
|
|
protected:
|
2023-10-25 18:13:48 +02:00
|
|
|
void scaleChangedEvent(float newDpi) override;
|
|
|
|
void themeChangedEvent() override;
|
|
|
|
void showEvent(QShowEvent *) override;
|
2017-12-18 00:54:17 +01:00
|
|
|
|
2017-01-01 18:43:52 +01:00
|
|
|
private:
|
2018-07-06 19:23:47 +02:00
|
|
|
void refresh();
|
|
|
|
|
|
|
|
void initUi();
|
2020-02-28 19:12:22 +01:00
|
|
|
SettingsDialogTab *tab(SettingsTabId id);
|
2018-07-06 19:23:47 +02:00
|
|
|
void addTabs();
|
2020-02-21 01:59:58 +01:00
|
|
|
void addTab(std::function<SettingsPage *()> page, const QString &name,
|
2020-02-28 19:05:50 +01:00
|
|
|
const QString &iconPath, SettingsTabId id = {},
|
2020-02-21 01:22:50 +01:00
|
|
|
Qt::Alignment alignment = Qt::AlignTop);
|
|
|
|
void selectTab(SettingsDialogTab *tab, const bool byUser = true);
|
2020-02-21 01:17:22 +01:00
|
|
|
void selectTab(SettingsTabId id);
|
2019-09-03 11:15:38 +02:00
|
|
|
void filterElements(const QString &query);
|
2023-05-27 12:38:25 +02:00
|
|
|
void setElementFilter(const QString &query);
|
2023-12-16 14:40:05 +01:00
|
|
|
bool eventFilter(QObject *object, QEvent *event) override;
|
2018-07-06 19:23:47 +02:00
|
|
|
|
|
|
|
void onOkClicked();
|
|
|
|
void onCancelClicked();
|
2021-11-21 18:46:21 +01:00
|
|
|
void addShortcuts() override;
|
2022-10-09 17:20:44 +02:00
|
|
|
void setSearchPlaceholderText();
|
2018-07-06 19:23:47 +02:00
|
|
|
|
2017-07-02 12:36:50 +02:00
|
|
|
struct {
|
2018-10-21 15:32:28 +02:00
|
|
|
QWidget *tabContainerContainer{};
|
|
|
|
QVBoxLayout *tabContainer{};
|
|
|
|
QStackedLayout *pageStack{};
|
|
|
|
QPushButton *okButton{};
|
|
|
|
QPushButton *cancelButton{};
|
2019-09-01 23:23:20 +02:00
|
|
|
QLineEdit *search{};
|
2018-06-11 15:04:54 +02:00
|
|
|
} ui_;
|
2018-07-06 19:23:47 +02:00
|
|
|
std::vector<SettingsDialogTab *> tabs_;
|
2018-10-21 15:32:28 +02:00
|
|
|
SettingsDialogTab *selectedTab_{};
|
2019-09-02 17:22:14 +02:00
|
|
|
SettingsDialogTab *lastSelectedByUser_{};
|
2024-01-06 12:28:06 +01:00
|
|
|
float dpi_ = 1.0F;
|
2017-12-17 03:37:46 +01:00
|
|
|
|
2018-01-12 23:33:04 +01:00
|
|
|
friend class SettingsDialogTab;
|
2017-01-01 18:43:52 +01:00
|
|
|
};
|
2017-01-22 23:00:35 +01:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
} // namespace chatterino
|