diff libgui/src/main-window.cc @ 19631:4e85ca0b4887 gui-release

add apply button to the settings dialog (bug #44081) * main-window.cc (process_settings_dialog_request) connect signal for applying the changes, settings dialog is non modal now; (request_reload_settings): new slot for siganl from settings dialog when when apply button was clicked * main-window .h: new slot request_reload_settings * settings-dialog.cc (constructor): connect signal when button box is clicked to the new slot button_clicked; (button_clicked): new slot * settings-dialog.h: new signal and related slot * settings-dialog.ui: new applay button
author Torsten <ttl@justmail.de>
date Sun, 25 Jan 2015 12:22:48 +0100
parents 4fe86a372f10
children 101ce4eaa56c
line wrap: on
line diff
--- a/libgui/src/main-window.cc	Sat Jan 24 22:46:20 2015 +0100
+++ b/libgui/src/main-window.cc	Sun Jan 25 12:22:48 2015 +0100
@@ -669,17 +669,23 @@
 main_window::process_settings_dialog_request (const QString& desired_tab)
 {
   settings_dialog *settingsDialog = new settings_dialog (this, desired_tab);
-  int change_settings = settingsDialog->exec ();
-  if (change_settings == QDialog::Accepted)
-    {
-      settingsDialog->write_changed_settings ();
-      QSettings *settings = resource_manager::get_settings ();
-      if (settings)
-        emit settings_changed (settings);
-    }
-  delete settingsDialog;
+
+  connect (settingsDialog, SIGNAL (apply_new_settings ()),
+           this, SLOT (request_reload_settings ()));
+
+  settingsDialog->setModal (false);
+  settingsDialog->setAttribute (Qt::WA_DeleteOnClose);
+  settingsDialog->show ();
 }
 
+void
+main_window::request_reload_settings ()
+{
+  QSettings *settings = resource_manager::get_settings ();
+
+  if (settings)
+    emit settings_changed (settings);
+}
 
 void
 main_window::notice_settings (const QSettings *settings)