diff options
author | Michael Andreen <harv@ruin.nu> | 2014-02-08 18:07:06 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-02-08 09:08:48 -0800 |
commit | 753ebc8ed49579bd79824cc5043fe26029dbd65f (patch) | |
tree | ff7aa19cab01d50ed0f38edf08acaca372b2f968 /qt-ui/preferences.cpp | |
parent | 2a3a1c1b412ea3da896c21840e07662002197dd0 (diff) | |
download | subsurface-753ebc8ed49579bd79824cc5043fe26029dbd65f.tar.gz |
Load preferences before they are saved.
Load all the settings in the PreferenceDialog constructor. Previously
all the settings were overwritten with default values the first time
PreferencesDialog::syncSettings() was called.
Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/preferences.cpp')
-rw-r--r-- | qt-ui/preferences.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp index cb8dde83b..2a49a43dc 100644 --- a/qt-ui/preferences.cpp +++ b/qt-ui/preferences.cpp @@ -20,6 +20,7 @@ PreferencesDialog::PreferencesDialog(QWidget* parent, Qt::WindowFlags f) : QDial connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*))); connect(ui.gflow, SIGNAL(valueChanged(int)), this, SLOT(gflowChanged(int))); connect(ui.gfhigh, SIGNAL(valueChanged(int)), this, SLOT(gfhighChanged(int))); + loadSettings(); setUiFromPrefs(); rememberPrefs(); } @@ -245,10 +246,18 @@ void PreferencesDialog::syncSettings() s.setValue("UseSystemLanguage", ui.languageSystemDefault->isChecked()); s.setValue("UiLanguage", ui.languageView->currentIndex().data(Qt::UserRole)); s.endGroup(); + + loadSettings(); + emit settingsChanged(); +} + +void PreferencesDialog::loadSettings() +{ // This code was on the mainwindow, it should belong nowhere, but since we dind't // correctly fixed this code yet ( too much stuff on the code calling preferences ) // force this here. + QSettings s; QVariant v; s.beginGroup("Units"); if (s.value("unit_system").toString() == "metric") { @@ -304,7 +313,6 @@ void PreferencesDialog::syncSettings() GET_INT("font_size", font_size); GET_INT("displayinvalid", display_invalid_dives); s.endGroup(); - emit settingsChanged(); } void PreferencesDialog::buttonClicked(QAbstractButton* button) |