2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2017-01-01 18:43:52 +01:00
|
|
|
|
2018-01-14 21:55:36 +01:00
|
|
|
#include "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>
|
2017-06-11 20:53:43 +02:00
|
|
|
#include <pajlada/settings/setting.hpp>
|
2017-01-18 04:33:30 +01:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace chatterino {
|
|
|
|
namespace widgets {
|
2017-01-18 21:30:23 +01:00
|
|
|
|
2018-01-12 23:33:04 +01:00
|
|
|
namespace settingspages {
|
|
|
|
class SettingsPage;
|
2018-04-03 02:55:32 +02:00
|
|
|
} // namespace settingspages
|
2018-01-12 23:33:04 +01:00
|
|
|
|
|
|
|
class SettingsDialogTab;
|
|
|
|
|
2018-01-14 21:55:36 +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
|
|
|
|
|
2017-12-19 02:16:01 +01:00
|
|
|
enum class PreferredTab {
|
|
|
|
NoPreference,
|
|
|
|
Accounts,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void showDialog(PreferredTab preferredTab = PreferredTab::NoPreference);
|
2017-10-08 16:31:16 +02:00
|
|
|
|
2017-12-18 00:54:17 +01:00
|
|
|
protected:
|
2018-04-18 09:33:05 +02:00
|
|
|
virtual void scaleChangedEvent(float newDpi) override;
|
|
|
|
virtual void themeRefreshEvent() override;
|
2017-12-18 00:54:17 +01:00
|
|
|
|
2017-01-01 18:43:52 +01:00
|
|
|
private:
|
2017-12-19 02:16:01 +01:00
|
|
|
void refresh();
|
2018-01-02 02:15:11 +01:00
|
|
|
static SettingsDialog *handle;
|
2017-12-19 02:16:01 +01:00
|
|
|
|
2017-07-02 12:36:50 +02:00
|
|
|
struct {
|
2018-01-12 23:09:05 +01:00
|
|
|
QWidget *tabContainerContainer;
|
|
|
|
QVBoxLayout *tabContainer;
|
|
|
|
QStackedLayout *pageStack;
|
|
|
|
QPushButton *okButton;
|
|
|
|
QPushButton *cancelButton;
|
2017-07-02 12:36:50 +02:00
|
|
|
} ui;
|
2017-01-02 03:02:32 +01:00
|
|
|
|
2018-01-12 23:09:05 +01:00
|
|
|
std::vector<SettingsDialogTab *> tabs;
|
2017-12-18 00:54:17 +01:00
|
|
|
|
2018-01-12 23:09:05 +01:00
|
|
|
void initUi();
|
|
|
|
void addTabs();
|
|
|
|
void addTab(settingspages::SettingsPage *page, Qt::Alignment alignment = Qt::AlignTop);
|
2017-01-01 18:43:52 +01:00
|
|
|
|
2018-01-12 23:33:04 +01:00
|
|
|
void select(SettingsDialogTab *tab);
|
|
|
|
|
2017-07-02 12:36:50 +02:00
|
|
|
SettingsDialogTab *selectedTab = nullptr;
|
2017-01-03 21:19:33 +01:00
|
|
|
|
2017-01-24 19:51:57 +01:00
|
|
|
void okButtonClicked();
|
|
|
|
void cancelButtonClicked();
|
2017-12-17 03:37:46 +01:00
|
|
|
|
2018-01-12 23:33:04 +01:00
|
|
|
friend class SettingsDialogTab;
|
|
|
|
|
2018-01-12 23:09:05 +01:00
|
|
|
// static void setChildrensFont(QLayout *object, QFont &font, int indent = 0);
|
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 widgets
|
|
|
|
} // namespace chatterino
|