changeset 15274:c5d09a57ceb2

provide buttons for the settings dialog (bug #36981) * settings-dialog.ui: Add Ok and Cancel buttons. * settings-dialog.h, settings-dialog.cc (settings_dialog::write_changed_settings): New method. * main-window.cc: Call it.
author Torsten <ttl@justmail.de>
date Sun, 02 Sep 2012 22:39:56 +0200
parents 535bb601e7db
children ecdb1463bff4
files libgui/src/main-window.cc libgui/src/settings-dialog.cc libgui/src/settings-dialog.h libgui/src/settings-dialog.ui
diffstat 4 files changed, 52 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/main-window.cc	Sat Sep 01 11:50:12 2012 -0400
+++ b/libgui/src/main-window.cc	Sun Sep 02 22:39:56 2012 +0200
@@ -164,9 +164,13 @@
 main_window::process_settings_dialog_request ()
 {
   settings_dialog *settingsDialog = new settings_dialog (this);
-  settingsDialog->exec ();
+  int change_settings = settingsDialog->exec ();
+  if (change_settings == QDialog::Accepted)
+    {
+      settingsDialog->write_changed_settings ();
+      emit settings_changed ();
+    }
   delete settingsDialog;
-  emit settings_changed ();
 }
 
 void
--- a/libgui/src/settings-dialog.cc	Sat Sep 01 11:50:12 2012 -0400
+++ b/libgui/src/settings-dialog.cc	Sun Sep 02 22:39:56 2012 +0200
@@ -85,6 +85,12 @@
 
 settings_dialog::~settings_dialog ()
 {
+  delete ui;
+}
+
+void
+settings_dialog::write_changed_settings ()
+{
   QSettings *settings = resource_manager::get_settings ();
 
   // FIXME -- what should happen if settings is 0?
@@ -122,5 +128,4 @@
     }
   settings->setValue ("terminal/cursorType", cursorType);
   settings->sync ();
-  delete ui;
 }
--- a/libgui/src/settings-dialog.h	Sat Sep 01 11:50:12 2012 -0400
+++ b/libgui/src/settings-dialog.h	Sun Sep 02 22:39:56 2012 +0200
@@ -35,6 +35,7 @@
 Q_OBJECT public:
   explicit settings_dialog (QWidget * parent);
   ~settings_dialog ();
+  void write_changed_settings ();
 
 private:
   Ui::settings_dialog * ui;
--- a/libgui/src/settings-dialog.ui	Sat Sep 01 11:50:12 2012 -0400
+++ b/libgui/src/settings-dialog.ui	Sun Sep 02 22:39:56 2012 +0200
@@ -487,6 +487,13 @@
      </widget>
     </widget>
    </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
  <resources/>
@@ -715,5 +722,37 @@
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>settings_dialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>299</x>
+     <y>366</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>299</x>
+     <y>199</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>settings_dialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>299</x>
+     <y>366</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>299</x>
+     <y>199</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
 </ui>