mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
9a65798daf
commit
a98a7a1351
3 changed files with 51 additions and 9 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue