Added a SettingsDialog with a "Server" tab to configure the server settings.
This commit is contained in:
@ -12,6 +12,7 @@
|
||||
#include "../../ApplicationConfig.h"
|
||||
#include "dialogs/edititemdialog.h"
|
||||
#include "dialogs/newitemdialog.h"
|
||||
#include "dialogs/settingsdialog.h"
|
||||
#include "genericcore.h"
|
||||
#include "model/generalsortfiltermodel.h"
|
||||
#include "model/tablemodel.h"
|
||||
@ -315,12 +316,37 @@ void MainWindow::deleteItem() {
|
||||
emit m_core->deleteItemFromServer(currentId);
|
||||
}
|
||||
|
||||
void MainWindow::execSettingsDialog() {
|
||||
showStatusMessage(tr("Invoked 'Tools|Settings'"));
|
||||
QVariantMap oldSettings = m_core->getSettings("Server");
|
||||
// SettingsDialog* settingsDialog = new SettingsDialog(settingMap, this);
|
||||
SettingsDialog* settingsDialog = new SettingsDialog(this);
|
||||
settingsDialog->createContent();
|
||||
settingsDialog->fillContent(oldSettings);
|
||||
|
||||
int returnCode = settingsDialog->exec();
|
||||
if (returnCode == QDialog::Accepted) {
|
||||
qDebug() << "Settings dialog accepted, writing settings...";
|
||||
const QVariantMap settings = settingsDialog->getSettings();
|
||||
|
||||
m_core->applySettings(settings, "Server");
|
||||
// TODO use signal-slot connection Core::syncServerSetupChanged(bool enabled) ->
|
||||
// MainWindow::onSyncServerSetupChanged(bool enabled)
|
||||
|
||||
// enableDisableServerActions();
|
||||
} else {
|
||||
qDebug() << "Settings dialog rejected";
|
||||
}
|
||||
delete settingsDialog;
|
||||
}
|
||||
|
||||
void MainWindow::createActions() {
|
||||
// TODO add generic menu actions (file/new, edit/cut, ...)
|
||||
createFileActions();
|
||||
createUndoActions();
|
||||
createEditActions();
|
||||
createServerActions();
|
||||
createToolsActions();
|
||||
}
|
||||
|
||||
void MainWindow::createFileActions() {
|
||||
@ -489,6 +515,12 @@ void MainWindow::createServerActions() {
|
||||
ui->menu_Server->addAction(m_deleteItemsAct.get());
|
||||
}
|
||||
|
||||
void MainWindow::createToolsActions() {
|
||||
QMenu* menu = ui->menu_Tools;
|
||||
QAction* settingsAct = menu->addAction(tr("&Settings"), this, &MainWindow::execSettingsDialog);
|
||||
settingsAct->setStatusTip(tr("Opens a dialog to configure applications settings."));
|
||||
}
|
||||
|
||||
void MainWindow::createHelpMenu() {
|
||||
QMenu* helpMenu = ui->menu_Help;
|
||||
helpMenu->addSeparator();
|
||||
|
||||
Reference in New Issue
Block a user