[PATCH] Make "Save Preferences" button mutate "prefs" struct.

K. "pestophagous" Heller pestophagous at gmail.com
Sun Nov 15 20:55:50 PST 2015


Clicking Save in the preferences dialog will now cause
the GUI to immediately reflect the latest settings (just
as it behaved in 4.5).

Signed-off-by: K. Heller <pestophagous at gmail.com>
---

I know that the new preferencesdialog is a work-in-progress.
But we may as well have the Save button working
in the git master (4.6 dev) branch right away, especially
since all it takes is this one-liner. (i edited
defaultsRequested for symmetry; my main interest right
now is with applyRequested).

Sorry to add another call site for loadPreferences
(since it is apparently slated for refactoring), but
it seemed ok since the other call site is already here
in the same cpp file (in the ctor).

 desktop-widgets/preferences/preferencesdialog.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/desktop-widgets/preferences/preferencesdialog.cpp b/desktop-widgets/preferences/preferencesdialog.cpp
index 141bc1c..34df09b 100644
--- a/desktop-widgets/preferences/preferencesdialog.cpp
+++ b/desktop-widgets/preferences/preferencesdialog.cpp
@@ -124,6 +124,7 @@ void PreferencesDialog::applyRequested(bool closeIt)
 		connect(page, &AbstractPreferencesWidget::settingsChanged, this, &PreferencesDialog::settingsChanged, Qt::UniqueConnection);
 		page->syncSettings();
 	}
+	loadPreferences(); //TODO: Move loadPreferences out of qthelper.cpp
 	emit settingsChanged();
 	if (closeIt)
 		accept();
@@ -143,6 +144,7 @@ void PreferencesDialog::defaultsRequested()
 	Q_FOREACH(AbstractPreferencesWidget *page, pages) {
 		page->refreshSettings();
 	}
+	loadPreferences(); //TODO: Move loadPreferences out of qthelper.cpp
 	emit settingsChanged();
 	accept();
 }
-- 
2.5.0



More information about the subsurface mailing list