diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-05-26 10:49:05 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-26 10:49:05 -0700 |
commit | 96f74d9939c3394bb8ece0888b473cdf4bc88b1a (patch) | |
tree | 8ed98c2c81fa2e9e376ed5aa42caf3580c5a3bce /qt-ui | |
parent | 43892e36fd58e23c5bd2b1dc400d34afc7d8c9ae (diff) | |
download | subsurface-96f74d9939c3394bb8ece0888b473cdf4bc88b1a.tar.gz |
Repair the saving and loading of units
This way it should work...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/mainwindow.cpp | 10 | ||||
-rw-r--r-- | qt-ui/preferences.cpp | 19 |
2 files changed, 17 insertions, 12 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 4d0299d7e..0c042cae5 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -355,11 +355,11 @@ void MainWindow::readSettings() settings.endGroup(); settings.beginGroup("Units"); - GET_UNIT(v, "feet", length, units::METERS, units::FEET); - GET_UNIT(v, "psi", pressure, units::BAR, units::PSI); - GET_UNIT(v, "cuft", volume, units::LITER, units::CUFT); - GET_UNIT(v, "fahrenheit", temperature, units::CELSIUS, units::FAHRENHEIT); - GET_UNIT(v, "lbs", weight, units::KG, units::LBS); + GET_UNIT(v, "feet", length, units::FEET, units::METERS); + GET_UNIT(v, "psi", pressure, units::PSI, units::BAR); + GET_UNIT(v, "cuft", volume, units::CUFT, units::LITER); + GET_UNIT(v, "fahrenheit", temperature, units::FAHRENHEIT, units::CELSIUS); + GET_UNIT(v, "lbs", weight, units::LBS, units::KG); settings.endGroup(); settings.beginGroup("DisplayListColumns"); GET_BOOL(v, "CYLINDER", prefs.visible_cols.cylinder); diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp index f9165c750..1c38fe317 100644 --- a/qt-ui/preferences.cpp +++ b/qt-ui/preferences.cpp @@ -1,5 +1,6 @@ #include "preferences.h" #include "ui_preferences.h" +#include "../dive.h" #include <QSettings> PreferencesDialog* PreferencesDialog::instance() @@ -75,6 +76,7 @@ void PreferencesDialog::syncSettings() QSettings s; // Graph + s.beginGroup("TecDetails"); s.setValue("show_calculated_ceiling", ui->calculated_ceiling->isChecked()); s.setValue("show_phe", ui->phe->isChecked()); s.setValue("show_po2", ui->po2->isChecked()); @@ -89,20 +91,23 @@ void PreferencesDialog::syncSettings() s.setValue("show_3m_increments", ui->increment_3m->isChecked()); s.setValue("gflow", ui->gflow->value()); s.setValue("gfhigh", ui->gfhigh->value()); - + s.endGroup(); // Units + s.beginGroup("Units"); s.setValue("units_metric", ui->metric->isChecked()); - s.setValue("units_celcius", ui->celsius->isChecked()); - s.setValue("units_meter", ui->meter->isChecked()); - s.setValue("units_bar", ui->bar->isChecked()); - s.setValue("units_liter", ui->liter->isChecked()); - s.setValue("units_kgs", ui->liter->isChecked()); - + s.setValue("fahrenheit", ui->fahrenheit->isChecked() ? units::FAHRENHEIT : units::CELSIUS); + s.setValue("feet", ui->feet->isChecked() ? units::FEET : units::METERS); + s.setValue("psi", ui->psi->isChecked() ? units::PSI : units::BAR); + s.setValue("cuft", ui->cuft->isChecked() ? units::CUFT : units::LITER); + s.setValue("lbs", ui->lbs->isChecked() ? units::LBS : units::KG); + s.endGroup(); // Defaults + s.beginGroup("GeneralSettings"); s.value("table_fonts", ui->font->font().family()); s.value("font_size", ui->fontsize->value()); s.value("default_file", ui->defaultfilename->text()); s.value("displayinvalid", ui->displayinvalid->isChecked()); + s.endGroup(); s.sync(); emit settingsChanged(); |