mirror-chatterino2/src/widgets/settingsdialog.hpp

73 lines
2 KiB
C++
Raw Normal View History

#pragma once
2017-01-01 18:43:52 +01:00
2017-06-11 09:31:45 +02:00
#include "settingsmanager.hpp"
#include "settingssnapshot.hpp"
#include "widgets/settingsdialogtab.hpp"
2017-01-01 18:43:52 +01:00
2017-01-18 04:33:30 +01:00
#include <QButtonGroup>
#include <QCheckBox>
#include <QComboBox>
2017-01-18 04:33:30 +01:00
#include <QDialogButtonBox>
#include <QHBoxLayout>
#include <QListView>
#include <QListWidget>
2017-01-18 04:33:30 +01:00
#include <QMainWindow>
#include <QPushButton>
#include <QStackedLayout>
#include <QVBoxLayout>
#include <QWidget>
#include <pajlada/settings/setting.hpp>
2017-01-18 04:33:30 +01:00
2017-04-14 17:52:22 +02:00
namespace chatterino {
2017-04-14 17:52:22 +02:00
namespace widgets {
2017-01-18 21:30:23 +01:00
2017-01-02 03:02:32 +01:00
class SettingsDialog : public QWidget
2017-01-01 18:43:52 +01:00
{
public:
SettingsDialog();
2017-01-11 18:52:09 +01:00
void select(SettingsDialogTab *tab);
2017-01-02 03:02:32 +01:00
static void showDialog();
2017-01-01 18:43:52 +01:00
private:
2017-07-02 12:36:50 +02:00
SettingsSnapshot snapshot;
pajlada::Settings::Setting<int> usernameDisplayMode;
2017-07-02 12:36:50 +02:00
struct {
QVBoxLayout tabs;
QVBoxLayout vbox;
QHBoxLayout hbox;
QStackedLayout pageStack;
QDialogButtonBox buttonBox;
QPushButton okButton;
QPushButton cancelButton;
} ui;
2017-01-02 03:02:32 +01:00
2017-01-11 18:52:09 +01:00
void addTab(QLayout *layout, QString title, QString imageRes);
2017-01-02 03:02:32 +01:00
void addTabs();
2017-01-01 18:43:52 +01:00
2017-07-02 12:36:50 +02:00
SettingsDialogTab *selectedTab = nullptr;
2017-01-03 21:19:33 +01:00
2017-07-31 00:57:42 +02:00
QListWidget *globalHighlights;
/// Widget creation helpers
2017-01-24 19:51:57 +01:00
QCheckBox *createCheckbox(const QString &title, Setting<bool> &setting);
QCheckBox *createCheckbox(const QString &title, pajlada::Settings::Setting<bool> &setting);
QHBoxLayout *createCombobox(const QString &title, pajlada::Settings::Setting<int> &setting,
QStringList items,
std::function<void(QString, pajlada::Settings::Setting<int> &)> cb);
QHBoxLayout *createCombobox(const QString &title, pajlada::Settings::Setting<std::string> &setting,
QStringList items,
std::function<void(QString, pajlada::Settings::Setting<std::string> &)> cb);
QLineEdit *createLineEdit(pajlada::Settings::Setting<std::string> &setting);
2017-01-24 19:51:57 +01:00
void okButtonClicked();
void cancelButtonClicked();
2017-01-01 18:43:52 +01:00
};
2017-04-14 17:52:22 +02:00
} // namespace widgets
} // namespace chatterino