diff options
author | Jan Darowski <jan.darowski@gmail.com> | 2015-07-03 23:07:58 +0200 |
---|---|---|
committer | Jan Darowski <jan.darowski@gmail.com> | 2015-07-03 23:07:58 +0200 |
commit | 500fbe499411bfa96192626c8a6213916190aaae (patch) | |
tree | 2d10ae563e3f39173a622aa63054512175a7050b /qt-ui | |
parent | 2435d79c0e6e4e30ace3b23765005c90181ddae5 (diff) | |
download | subsurface-500fbe499411bfa96192626c8a6213916190aaae.tar.gz |
VPM-B: add deco choice to the ui.
Removed recreational mode from ui and pref and replaced it with
new deco_mode enum.
Added radio button ui selection.
Set default deco_mode to Buehlmann algorithm.
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/diveplanner.cpp | 20 | ||||
-rw-r--r-- | qt-ui/diveplanner.h | 2 | ||||
-rw-r--r-- | qt-ui/plannerSettings.ui | 23 |
3 files changed, 38 insertions, 7 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 8b0e93cd8..684ef44aa 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -243,7 +243,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) prefs.display_duration = s.value("display_duration", prefs.display_duration).toBool(); prefs.display_runtime = s.value("display_runtime", prefs.display_runtime).toBool(); prefs.display_transitions = s.value("display_transitions", prefs.display_transitions).toBool(); - prefs.recreational_mode = s.value("recreational_mode", prefs.recreational_mode).toBool(); + prefs.deco_mode = deco_mode(s.value("deco_mode", prefs.deco_mode).toInt()); prefs.safetystop = s.value("safetystop", prefs.safetystop).toBool(); prefs.reserve_gas = s.value("reserve_gas", prefs.reserve_gas).toInt(); prefs.ascrate75 = s.value("ascrate75", prefs.ascrate75).toInt(); @@ -269,7 +269,6 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) ui.display_duration->setChecked(prefs.display_duration); ui.display_runtime->setChecked(prefs.display_runtime); ui.display_transitions->setChecked(prefs.display_transitions); - ui.recreational_mode->setChecked(prefs.recreational_mode); ui.safetystop->setChecked(prefs.safetystop); ui.reserve_gas->setValue(prefs.reserve_gas / 1000); ui.bottompo2->setValue(prefs.bottompo2 / 1000.0); @@ -278,17 +277,30 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) ui.drop_stone_mode->setChecked(prefs.drop_stone_mode); ui.switch_at_req_stop->setChecked(prefs.switch_at_req_stop); ui.min_switch_duration->setValue(prefs.min_switch_duration / 60); + ui.recreational_deco->setChecked(prefs.deco_mode == RECREATIONAL); + ui.buehlmann_deco->setChecked(prefs.deco_mode == BUEHLMANN); + ui.vpmb_deco->setChecked(prefs.deco_mode == VPMB); + // should be the same order as in dive_comp_type! rebreater_modes << tr("Open circuit") << tr("CCR") << tr("pSCR"); ui.rebreathermode->insertItems(0, rebreater_modes); + modeMapper = new QSignalMapper(this); + connect(modeMapper, SIGNAL(mapped(int)) , plannerModel, SLOT(setDecoMode(int))); + modeMapper->setMapping(ui.recreational_deco, int(RECREATIONAL)); + modeMapper->setMapping(ui.buehlmann_deco, int(BUEHLMANN)); + modeMapper->setMapping(ui.vpmb_deco, int(VPMB)); + + connect(ui.recreational_deco, SIGNAL(clicked()), modeMapper, SLOT(map())); + connect(ui.buehlmann_deco, SIGNAL(clicked()), modeMapper, SLOT(map())); + connect(ui.vpmb_deco, SIGNAL(clicked()), modeMapper, SLOT(map())); + connect(ui.lastStop, SIGNAL(toggled(bool)), plannerModel, SLOT(setLastStop6m(bool))); connect(ui.verbatim_plan, SIGNAL(toggled(bool)), plannerModel, SLOT(setVerbatim(bool))); connect(ui.display_duration, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayDuration(bool))); connect(ui.display_runtime, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayRuntime(bool))); connect(ui.display_transitions, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayTransitions(bool))); connect(ui.safetystop, SIGNAL(toggled(bool)), plannerModel, SLOT(setSafetyStop(bool))); - connect(ui.recreational_mode, SIGNAL(toggled(bool)), plannerModel, SLOT(setRecreationalMode(bool))); connect(ui.reserve_gas, SIGNAL(valueChanged(int)), plannerModel, SLOT(setReserveGas(int))); connect(ui.ascRate75, SIGNAL(valueChanged(int)), this, SLOT(setAscRate75(int))); connect(ui.ascRate75, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged())); @@ -341,7 +353,6 @@ PlannerSettingsWidget::~PlannerSettingsWidget() s.setValue("display_duration", prefs.display_duration); s.setValue("display_runtime", prefs.display_runtime); s.setValue("display_transitions", prefs.display_transitions); - s.setValue("recreational_mode", prefs.recreational_mode); s.setValue("safetystop", prefs.safetystop); s.setValue("reserve_gas", prefs.reserve_gas); s.setValue("ascrate75", prefs.ascrate75); @@ -357,6 +368,7 @@ PlannerSettingsWidget::~PlannerSettingsWidget() s.setValue("min_switch_duration", prefs.min_switch_duration); s.setValue("bottomsac", prefs.bottomsac); s.setValue("decosac", prefs.decosac); + s.setValue("deco_mode", int(prefs.deco_mode)); s.endGroup(); } diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index 8c7ff9c46..c4210aadf 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -5,6 +5,7 @@ #include <QAbstractTableModel> #include <QAbstractButton> #include <QDateTime> +#include <QSignalMapper> #include "dive.h" @@ -84,6 +85,7 @@ slots: private: Ui::plannerSettingsWidget ui; void updateUnitsUI(); + QSignalMapper *modeMapper; }; #include "ui_plannerDetails.h" diff --git a/qt-ui/plannerSettings.ui b/qt-ui/plannerSettings.ui index 55ca83a9b..5916b2777 100644 --- a/qt-ui/plannerSettings.ui +++ b/qt-ui/plannerSettings.ui @@ -359,13 +359,30 @@ </widget> </item> <item row="0" column="1"> - <widget class="QCheckBox" name="recreational_mode"> + <widget class="QRadioButton" name="recreational_deco"> <property name="text"> <string>Recreational mode</string> </property> </widget> </item> <item row="1" column="1"> + <widget class="QRadioButton" name="buehlmann_deco"> + <property name="text"> + <string>Buehlmann deco</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QRadioButton" name="vpmb_deco"> + <property name="text"> + <string>VPM-B deco</string> + </property> + </widget> + </item> + <item row="3" column="1"> <widget class="QCheckBox" name="safetystop"> <property name="text"> <string>Safety stop</string> @@ -375,14 +392,14 @@ </property> </widget> </item> - <item row="2" column="1"> + <item row="4" column="1"> <widget class="QLabel" name="label_3"> <property name="text"> <string>Reserve gas</string> </property> </widget> </item> - <item row="2" column="2"> + <item row="4" column="2"> <widget class="QSpinBox" name="reserve_gas"> <property name="suffix"> <string>bar</string> |