summaryrefslogtreecommitdiffstats
path: root/qt-ui/preferences.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-06-02 19:52:18 +0900
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-06-02 19:52:18 +0900
commita98a7a135199bbe3dc25290da47c1915861b2300 (patch)
tree269eeb5fce2a6b04d8e66d2da240b6aa187c0fbd /qt-ui/preferences.cpp
parent9a65798daf3dc0e7991305ce759d42d40d2dc98c (diff)
downloadsubsurface-a98a7a135199bbe3dc25290da47c1915861b2300.tar.gz
Correctly implement Metric / Imperial / Personalize preference
The code so far had completely ignored Metric / Imperial. Turning this into a three way radio box seemed to make much more sense. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/preferences.cpp')
-rw-r--r--qt-ui/preferences.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
index dd484b6e8..551d7965a 100644
--- a/qt-ui/preferences.cpp
+++ b/qt-ui/preferences.cpp
@@ -1,6 +1,7 @@
#include "preferences.h"
#include "ui_preferences.h"
#include <QSettings>
+#include <QDebug>
PreferencesDialog* PreferencesDialog::instance()
{
@@ -43,6 +44,7 @@ PreferencesDialog::PreferencesDialog(QWidget* parent, Qt::WindowFlags f) : QDial
ui->increment_3m->setChecked(B(calcceiling3m, calc_ceiling_3m_incr));
ui->all_tissues->setEnabled(ui->calculated_ceiling->isChecked());
ui->all_tissues->setChecked(B(calcalltissues, calc_all_tissues));
+ ui->groupBox->setEnabled(ui->personalize->isChecked());
ui->gflow->setValue((int)(I(gflow, gflow)));
ui->gfhigh->setValue((int)(I(gfhigh, gfhigh)));
@@ -121,7 +123,8 @@ void PreferencesDialog::syncSettings()
// Units
s.beginGroup("Units");
- s.setValue("units_metric", ui->metric->isChecked());
+ QString unitSystem = ui->metric->isChecked() ? "metric" : (ui->imperial->isChecked() ? "imperial" : "personal");
+ s.setValue("unit_system", unitSystem);
s.setValue("temperature", ui->fahrenheit->isChecked() ? units::FAHRENHEIT : units::CELSIUS);
s.setValue("length", ui->feet->isChecked() ? units::FEET : units::METERS);
s.setValue("pressure", ui->psi->isChecked() ? units::PSI : units::BAR);