2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2017-01-01 18:43:52 +01:00
|
|
|
|
2017-12-31 00:50:07 +01:00
|
|
|
#include "singletons/settingsmanager.hpp"
|
2017-12-19 02:16:01 +01:00
|
|
|
#include "widgets/accountswitchwidget.hpp"
|
2017-11-12 17:21:50 +01:00
|
|
|
#include "widgets/helper/settingsdialogtab.hpp"
|
2017-01-01 18:43:52 +01:00
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
#include <QButtonGroup>
|
|
|
|
#include <QCheckBox>
|
2017-07-23 11:59:05 +02:00
|
|
|
#include <QComboBox>
|
2017-01-18 04:33:30 +01:00
|
|
|
#include <QDialogButtonBox>
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QListView>
|
2017-07-31 00:37:22 +02:00
|
|
|
#include <QListWidget>
|
2017-01-18 04:33:30 +01:00
|
|
|
#include <QMainWindow>
|
|
|
|
#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-12-17 16:45:15 +01:00
|
|
|
#include "basewidget.hpp"
|
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace chatterino {
|
2017-06-13 21:13:58 +02:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace widgets {
|
2017-01-18 21:30:23 +01:00
|
|
|
|
2017-12-17 16:45:15 +01:00
|
|
|
class SettingsDialog : public BaseWidget
|
2017-01-01 18:43:52 +01:00
|
|
|
{
|
|
|
|
SettingsDialog();
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
void select(SettingsDialogTab *tab);
|
2017-01-02 03:02:32 +01:00
|
|
|
|
2017-12-28 19:03:52 +01:00
|
|
|
friend class SettingsDialogTab;
|
|
|
|
|
|
|
|
public:
|
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:
|
2017-12-18 02:47:01 +01:00
|
|
|
virtual void dpiMultiplierChanged(float oldDpi, float newDpi) 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-12-18 00:54:17 +01:00
|
|
|
std::vector<SettingsDialogTab *> tabs;
|
2017-07-02 12:36:50 +02:00
|
|
|
|
2017-07-23 11:59:05 +02:00
|
|
|
pajlada::Settings::Setting<int> usernameDisplayMode;
|
|
|
|
|
2017-07-02 12:36:50 +02:00
|
|
|
struct {
|
|
|
|
QVBoxLayout tabs;
|
|
|
|
QVBoxLayout vbox;
|
|
|
|
QHBoxLayout hbox;
|
2017-12-18 00:54:17 +01:00
|
|
|
QWidget tabWidget;
|
2017-07-02 12:36:50 +02:00
|
|
|
QStackedLayout pageStack;
|
|
|
|
QDialogButtonBox buttonBox;
|
|
|
|
QPushButton okButton;
|
|
|
|
QPushButton cancelButton;
|
2017-12-19 02:16:01 +01:00
|
|
|
|
|
|
|
AccountSwitchWidget *accountSwitchWidget = nullptr;
|
2017-07-02 12:36:50 +02:00
|
|
|
} ui;
|
2017-01-02 03:02:32 +01:00
|
|
|
|
2017-10-08 16:31:16 +02:00
|
|
|
void addTab(QBoxLayout *layout, QString title, QString imageRes);
|
2017-01-02 03:02:32 +01:00
|
|
|
void addTabs();
|
2017-12-18 00:54:17 +01:00
|
|
|
|
2017-10-08 16:31:16 +02:00
|
|
|
QVBoxLayout *createAccountsTab();
|
|
|
|
QVBoxLayout *createAppearanceTab();
|
|
|
|
QVBoxLayout *createMessagesTab();
|
|
|
|
QVBoxLayout *createBehaviourTab();
|
|
|
|
QVBoxLayout *createCommandsTab();
|
|
|
|
QVBoxLayout *createEmotesTab();
|
|
|
|
QVBoxLayout *createIgnoredUsersTab();
|
|
|
|
QVBoxLayout *createIgnoredMessagesTab();
|
|
|
|
QVBoxLayout *createLinksTab();
|
|
|
|
QVBoxLayout *createLogsTab();
|
|
|
|
QVBoxLayout *createHighlightingTab();
|
|
|
|
QVBoxLayout *createWhispersTab();
|
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;
|
2017-07-31 00:37:22 +02:00
|
|
|
|
2017-01-22 23:00:35 +01:00
|
|
|
/// Widget creation helpers
|
2017-10-08 16:31:16 +02:00
|
|
|
QVBoxLayout *createTabLayout();
|
2017-06-11 20:53:43 +02:00
|
|
|
QCheckBox *createCheckbox(const QString &title, pajlada::Settings::Setting<bool> &setting);
|
2017-07-23 11:59:05 +02:00
|
|
|
QHBoxLayout *createCombobox(const QString &title, pajlada::Settings::Setting<int> &setting,
|
|
|
|
QStringList items,
|
|
|
|
std::function<void(QString, pajlada::Settings::Setting<int> &)> cb);
|
2017-10-08 16:31:16 +02:00
|
|
|
QHBoxLayout *createCombobox(
|
|
|
|
const QString &title, pajlada::Settings::Setting<std::string> &setting, QStringList items,
|
|
|
|
std::function<void(QString, pajlada::Settings::Setting<std::string> &)> cb);
|
2017-08-12 14:44:27 +02:00
|
|
|
QLineEdit *createLineEdit(pajlada::Settings::Setting<std::string> &setting);
|
2017-01-24 19:51:57 +01:00
|
|
|
|
|
|
|
void okButtonClicked();
|
|
|
|
void cancelButtonClicked();
|
2017-12-17 03:37:46 +01:00
|
|
|
|
|
|
|
std::vector<pajlada::Signals::ScopedConnection> managedConnections;
|
2017-12-18 00:54:17 +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
|