mirror-chatterino2/src/widgets/dialogs/SettingsDialog.hpp

69 lines
1.5 KiB
C++
Raw Normal View History

#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
2017-01-18 04:33:30 +01:00
#include <QPushButton>
#include <QStackedLayout>
#include <QVBoxLayout>
#include <QWidget>
#include <pajlada/settings/setting.hpp>
2017-01-18 04:33:30 +01: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;
class ModerationPage;
enum class SettingsDialogPreference {
NoPreference,
Accounts,
ModerationActions,
};
2018-01-12 23:33:04 +01:00
class SettingsDialog : public BaseWindow
2017-01-01 18:43:52 +01:00
{
2018-01-12 23:09:05 +01:00
public:
2017-01-01 18:43:52 +01:00
SettingsDialog();
2018-01-02 02:15:11 +01:00
static SettingsDialog *getHandle(); // may be NULL
static void showDialog(SettingsDialogPreference preferredTab =
SettingsDialogPreference::NoPreference);
protected:
2018-04-18 09:33:05 +02:00
virtual void scaleChangedEvent(float newDpi) override;
2018-07-06 17:11:37 +02:00
virtual void themeChangedEvent() override;
2017-01-01 18:43:52 +01:00
private:
2018-01-02 02:15:11 +01:00
static SettingsDialog *handle;
2018-07-06 19:23:47 +02:00
void refresh();
void initUi();
void addTabs();
void addTab(SettingsPage *page, Qt::Alignment alignment = Qt::AlignTop);
void selectTab(SettingsDialogTab *tab);
void selectPage(SettingsPage *page);
2018-07-06 19:23:47 +02:00
void onOkClicked();
void onCancelClicked();
2017-07-02 12:36:50 +02:00
struct {
QWidget *tabContainerContainer{};
QVBoxLayout *tabContainer{};
QStackedLayout *pageStack{};
QPushButton *okButton{};
QPushButton *cancelButton{};
ModerationPage *moderationPage{};
QLineEdit *search{};
2018-06-11 15:04:54 +02:00
} ui_;
2018-07-06 19:23:47 +02:00
std::vector<SettingsDialogTab *> tabs_;
std::vector<SettingsPage *> pages_;
SettingsDialogTab *selectedTab_{};
2018-01-12 23:33:04 +01:00
friend class SettingsDialogTab;
2017-01-01 18:43:52 +01:00
};
2017-04-14 17:52:22 +02:00
} // namespace chatterino