Make categories of settings dialog customizable

This commit is contained in:
Martchus 2017-09-09 21:38:43 +02:00
parent 26056f1511
commit b254905b5a
2 changed files with 19 additions and 5 deletions

View File

@ -899,6 +899,13 @@ void WebViewOptionPage::reset()
#endif #endif
} }
SettingsDialog::SettingsDialog(const QList<OptionCategory *> &categories, QWidget *parent)
: Dialogs::SettingsDialog(parent)
{
categoryModel()->setCategories(categories);
init();
}
SettingsDialog::SettingsDialog(Data::SyncthingConnection *connection, QWidget *parent) SettingsDialog::SettingsDialog(Data::SyncthingConnection *connection, QWidget *parent)
: Dialogs::SettingsDialog(parent) : Dialogs::SettingsDialog(parent)
{ {
@ -932,9 +939,16 @@ SettingsDialog::SettingsDialog(Data::SyncthingConnection *connection, QWidget *p
categories << category; categories << category;
categories << values().qt.category(); categories << values().qt.category();
categoryModel()->setCategories(categories); categoryModel()->setCategories(categories);
init();
}
SettingsDialog::~SettingsDialog()
{
}
void SettingsDialog::init()
{
resize(860, 620); resize(860, 620);
setWindowTitle(tr("Settings") + QStringLiteral(" - " APP_NAME)); setWindowTitle(tr("Settings") + QStringLiteral(" - " APP_NAME));
setWindowIcon( setWindowIcon(
@ -943,10 +957,6 @@ SettingsDialog::SettingsDialog(Data::SyncthingConnection *connection, QWidget *p
// some settings could be applied without restarting the application, good idea? // some settings could be applied without restarting the application, good idea?
//connect(this, &Dialogs::SettingsDialog::applied, bind(&Dialogs::QtSettings::apply, &Settings::qtSettings())); //connect(this, &Dialogs::SettingsDialog::applied, bind(&Dialogs::QtSettings::apply, &Settings::qtSettings()));
} }
SettingsDialog::~SettingsDialog()
{
}
} }
INSTANTIATE_UI_FILE_BASED_OPTION_PAGE_NS(QtGui, ConnectionOptionPage) INSTANTIATE_UI_FILE_BASED_OPTION_PAGE_NS(QtGui, ConnectionOptionPage)

View File

@ -96,7 +96,11 @@ class SYNCTHINGWIDGETS_EXPORT SettingsDialog : public Dialogs::SettingsDialog {
Q_OBJECT Q_OBJECT
public: public:
explicit SettingsDialog(Data::SyncthingConnection *connection, QWidget *parent = nullptr); explicit SettingsDialog(Data::SyncthingConnection *connection, QWidget *parent = nullptr);
explicit SettingsDialog(const QList<Dialogs::OptionCategory *> &categories, QWidget *parent = nullptr);
~SettingsDialog(); ~SettingsDialog();
private:
void init();
}; };
} }