diff options
author | Jan Dalheimer <jan@dalheimer.de> | 2014-07-16 00:13:40 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-07-20 15:01:02 +0200 |
commit | e178284172396ee51acb77c2daa8135b4855c12b (patch) | |
tree | d37c3d95355073997b023c6bdf34072d3bb468b0 /gui/MainWindow.cpp | |
parent | c91adfb3d18b124b36cf19bcb89973a66c9ef1c9 (diff) | |
download | MultiMC-e178284172396ee51acb77c2daa8135b4855c12b.tar MultiMC-e178284172396ee51acb77c2daa8135b4855c12b.tar.gz MultiMC-e178284172396ee51acb77c2daa8135b4855c12b.tar.lz MultiMC-e178284172396ee51acb77c2daa8135b4855c12b.tar.xz MultiMC-e178284172396ee51acb77c2daa8135b4855c12b.zip |
Merge global settings and accounts into a pagedialog
Also split external tools into it's own page
Diffstat (limited to 'gui/MainWindow.cpp')
-rw-r--r-- | gui/MainWindow.cpp | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp index 1a92139c..81ee466b 100644 --- a/gui/MainWindow.cpp +++ b/gui/MainWindow.cpp @@ -49,7 +49,6 @@ #include "gui/widgets/LabeledToolButton.h" #include "widgets/ServerStatus.h" -#include "gui/dialogs/SettingsDialog.h" #include "gui/dialogs/NewInstanceDialog.h" #include "gui/dialogs/ProgressDialog.h" #include "gui/dialogs/AboutDialog.h" @@ -58,12 +57,15 @@ #include "gui/dialogs/LwjglSelectDialog.h" #include "gui/dialogs/IconPickerDialog.h" #include "gui/dialogs/CopyInstanceDialog.h" -#include "gui/dialogs/AccountListDialog.h" #include "gui/dialogs/AccountSelectDialog.h" #include "gui/dialogs/UpdateDialog.h" #include "gui/dialogs/EditAccountDialog.h" #include "gui/dialogs/NotificationDialog.h" +#include "gui/pages/global/SettingsPage.h" +#include "gui/pages/global/ExternalToolsPage.h" +#include "gui/pages/global/AccountListPage.h" + #include "gui/ConsoleWindow.h" #include "pagedialog/PageDialog.h" @@ -245,6 +247,14 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi ui->mainToolBar->addAction(accountMenuButtonAction); + // set up global pages dialog + { + m_globalSettingsProvider = std::make_shared<GenericPageProvider>(tr("Settings")); + m_globalSettingsProvider->addPage<AccountListPage>(); + m_globalSettingsProvider->addPage<SettingsPage>(); + m_globalSettingsProvider->addPage<ExternalToolsPage>(); + } + // Update the menu when the active account changes. // Shouldn't have to use lambdas here like this, but if I don't, the compiler throws a fit. // Template hell sucks... @@ -937,16 +947,6 @@ void MainWindow::on_actionCheckUpdate_triggered() updater->checkForUpdate(true); } -void MainWindow::on_actionSettings_triggered() -{ - SettingsDialog dialog(this); - dialog.exec(); - // FIXME: quick HACK to make this work. improve, optimize. - proxymodel->invalidate(); - proxymodel->sort(0); - updateToolsMenu(); -} - template <typename T> void ShowPageDialog(T raw_provider, QWidget * parent, QString open_page = QString()) { @@ -957,6 +957,15 @@ void ShowPageDialog(T raw_provider, QWidget * parent, QString open_page = QStrin dlg.exec(); } +void MainWindow::on_actionSettings_triggered() +{ + ShowPageDialog(m_globalSettingsProvider, this, "global-settings"); + // FIXME: quick HACK to make this work. improve, optimize. + proxymodel->invalidate(); + proxymodel->sort(0); + updateToolsMenu(); +} + void MainWindow::on_actionInstanceSettings_triggered() { ShowPageDialog(m_selectedInstance, this, "settings"); @@ -980,8 +989,7 @@ void MainWindow::on_actionScreenshots_triggered() void MainWindow::on_actionManageAccounts_triggered() { - AccountListDialog dialog(this); - dialog.exec(); + ShowPageDialog(m_globalSettingsProvider, this, "accounts"); } void MainWindow::on_actionReportBug_triggered() |