diff options
author | Tomaz Canabrava <tomaz.canabrava@gmail.com> | 2016-08-08 10:30:20 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-08-27 10:46:32 -0700 |
commit | 8f05afcda30556602f452029049cdc010e26b7f5 (patch) | |
tree | 033b0cd2bb37a7ae0ef235d509b31ba8ee84f6c2 /desktop-widgets/preferences/preferences_defaults.cpp | |
parent | a5cf8aaa21842d491c583a17c01340bb61e4d4ed (diff) | |
download | subsurface-8f05afcda30556602f452029049cdc010e26b7f5.tar.gz |
Settings update: Fix "General Settings", "Display", and "Animation"
First commit in the series that will unify the way to use,
save, and update settings in the core. This fixes the usage of
"General Settings", "Display", and "Animation" to use the
SettingsObjectWrapper.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/preferences/preferences_defaults.cpp')
-rw-r--r-- | desktop-widgets/preferences/preferences_defaults.cpp | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/desktop-widgets/preferences/preferences_defaults.cpp b/desktop-widgets/preferences/preferences_defaults.cpp index 62bb3bcb2..12771e04a 100644 --- a/desktop-widgets/preferences/preferences_defaults.cpp +++ b/desktop-widgets/preferences/preferences_defaults.cpp @@ -2,6 +2,7 @@ #include "ui_preferences_defaults.h" #include "core/dive.h" #include "core/prefs-macros.h" +#include "core/subsurface-qt/SettingsObjectWrapper.h" #include <QSettings> #include <QFileDialog> @@ -76,28 +77,24 @@ void PreferencesDefaults::refreshSettings() void PreferencesDefaults::syncSettings() { - QSettings s; - s.beginGroup("GeneralSettings"); - s.setValue("default_filename", ui->defaultfilename->text()); - s.setValue("default_cylinder", ui->default_cylinder->currentText()); - s.setValue("use_default_file", ui->btnUseDefaultFile->isChecked()); + auto general = SettingsObjectWrapper::instance()->general_settings; + general->setDefaultFilename(ui->defaultfilename->text()); + general->setDefaultCylinder(ui->default_cylinder->currentText()); + general->setUseDefaultFile(ui->btnUseDefaultFile->isChecked()); if (ui->noDefaultFile->isChecked()) - s.setValue("default_file_behavior", NO_DEFAULT_FILE); + general->setDefaultFileBehavior(NO_DEFAULT_FILE); else if (ui->localDefaultFile->isChecked()) - s.setValue("default_file_behavior", LOCAL_DEFAULT_FILE); + general->setDefaultFileBehavior(LOCAL_DEFAULT_FILE); else if (ui->cloudDefaultFile->isChecked()) - s.setValue("default_file_behavior", CLOUD_DEFAULT_FILE); - s.endGroup(); + general->setDefaultFileBehavior(CLOUD_DEFAULT_FILE); - s.beginGroup("Display"); - SAVE_OR_REMOVE_SPECIAL("divelist_font", system_divelist_default_font, ui->font->currentFont().toString(), ui->font->currentFont()); - SAVE_OR_REMOVE("font_size", system_divelist_default_font_size, ui->fontsize->value()); - s.setValue("displayinvalid", ui->displayinvalid->isChecked()); - s.endGroup(); - s.sync(); + auto display = SettingsObjectWrapper::instance()->display_settings; - // Animation - s.beginGroup("Animations"); - s.setValue("animation_speed", ui->velocitySlider->value()); - s.endGroup(); + //TODO: Verify the 'save or remove special' feature for the divelist font and the font size. + display->setDivelistFont(ui->font->currentFont().toString()); + display->setFontSize(ui->fontsize->value()); + display->setDisplayInvalidDives(ui->displayinvalid->isChecked()); + + auto animation = SettingsObjectWrapper::instance()->animation_settings; + animation->setAnimationSpeed(ui->velocitySlider->value()); } |