Merge global settings and accounts into a pagedialog
Also split external tools into it's own page
This commit is contained in:

committed by
Petr Mrázek

parent
c91adfb3d1
commit
e178284172
@ -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()
|
||||
|
Reference in New Issue
Block a user