diff options
author | Rick Walsh <rickmwalsh@gmail.com> | 2016-05-21 19:32:09 +1000 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-05-21 07:03:38 -0700 |
commit | 9b29173363861861949814191861fa46e255c349 (patch) | |
tree | 9fdb002a18d775a75b7d9264a81f11d7d8a43118 /desktop-widgets | |
parent | 67dda48c884b7413e46acde4e890c0fa19640f67 (diff) | |
download | subsurface-9b29173363861861949814191861fa46e255c349.tar.gz |
Planner: add best mix EAD preference
Add best mix EAD preference and UI, along with a tooltip describing what it
does
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/diveplanner.cpp | 11 | ||||
-rw-r--r-- | desktop-widgets/diveplanner.h | 1 | ||||
-rw-r--r-- | desktop-widgets/plannerSettings.ui | 31 |
3 files changed, 41 insertions, 2 deletions
diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index 3a2436c6c..ac322d200 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -288,6 +288,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) prefs.descrate = s.value("descrate", prefs.descrate).toInt(); prefs.bottompo2 = s.value("bottompo2", prefs.bottompo2).toInt(); prefs.decopo2 = s.value("decopo2", prefs.decopo2).toInt(); + prefs.bestmixead = s.value("bestmixead", prefs.bestmixead).toInt(); prefs.doo2breaks = s.value("doo2breaks", prefs.doo2breaks).toBool(); prefs.switch_at_req_stop = s.value("switch_at_req_stop", prefs.switch_at_req_stop).toBool(); prefs.min_switch_duration = s.value("min_switch_duration", prefs.min_switch_duration).toInt(); @@ -351,6 +352,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) connect(ui.descRate, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged())); connect(ui.bottompo2, SIGNAL(valueChanged(double)), this, SLOT(setBottomPo2(double))); connect(ui.decopo2, SIGNAL(valueChanged(double)), this, SLOT(setDecoPo2(double))); + connect(ui.bestmixEAD, SIGNAL(valueChanged(int)), this, SLOT(setBestmixEAD(int))); connect(ui.drop_stone_mode, SIGNAL(toggled(bool)), plannerModel, SLOT(setDropStoneMode(bool))); connect(ui.bottomSAC, SIGNAL(valueChanged(double)), this, SLOT(bottomSacChanged(double))); connect(ui.decoStopSAC, SIGNAL(valueChanged(double)), this, SLOT(decoSacChanged(double))); @@ -380,6 +382,7 @@ void PlannerSettingsWidget::updateUnitsUI() ui.ascRateStops->setValue(rint(prefs.ascratestops / UNIT_FACTOR)); ui.ascRateLast6m->setValue(rint(prefs.ascratelast6m / UNIT_FACTOR)); ui.descRate->setValue(rint(prefs.descrate / UNIT_FACTOR)); + ui.bestmixEAD->setValue(rint(get_depth_units(prefs.bestmixead, NULL, NULL))); } PlannerSettingsWidget::~PlannerSettingsWidget() @@ -400,6 +403,7 @@ PlannerSettingsWidget::~PlannerSettingsWidget() s.setValue("descrate", prefs.descrate); s.setValue("bottompo2", prefs.bottompo2); s.setValue("decopo2", prefs.decopo2); + s.setValue("bestmixead", prefs.bestmixead); s.setValue("doo2breaks", prefs.doo2breaks); s.setValue("drop_stone_mode", prefs.drop_stone_mode); s.setValue("switch_at_req_stop", prefs.switch_at_req_stop); @@ -422,11 +426,13 @@ void PlannerSettingsWidget::settingsChanged() ui.lastStop->setText(tr("Last stop at 20ft")); ui.asc50to6->setText(tr("50% avg. depth to 20ft")); ui.asc6toSurf->setText(tr("20ft to surface")); + ui.bestmixEAD->setSuffix(tr("ft")); } else { vs.append(tr("m/min")); ui.lastStop->setText(tr("Last stop at 6m")); ui.asc50to6->setText(tr("50% avg. depth to 6m")); ui.asc6toSurf->setText(tr("6m to surface")); + ui.bestmixEAD->setSuffix(tr("m")); } if(get_units()->volume == units::CUFT) { ui.bottomSAC->setSuffix(tr("cuft/min")); @@ -508,6 +514,11 @@ void PlannerSettingsWidget::setDecoPo2(double po2) prefs.decopo2 = (int) (po2 * 1000.0); } +void PlannerSettingsWidget::setBestmixEAD(int depth) +{ + prefs.bestmixead = units_to_depth(depth); +} + void PlannerSettingsWidget::setBackgasBreaks(bool dobreaks) { prefs.doo2breaks = dobreaks; diff --git a/desktop-widgets/diveplanner.h b/desktop-widgets/diveplanner.h index 03014cb9c..69f993824 100644 --- a/desktop-widgets/diveplanner.h +++ b/desktop-widgets/diveplanner.h @@ -78,6 +78,7 @@ slots: void setDescRate(int rate); void setBottomPo2(double po2); void setDecoPo2(double po2); + void setBestmixEAD(int depth); void setBackgasBreaks(bool dobreaks); void disableDecoElements(int mode); diff --git a/desktop-widgets/plannerSettings.ui b/desktop-widgets/plannerSettings.ui index 4db69f883..2ec8d4ab3 100644 --- a/desktop-widgets/plannerSettings.ui +++ b/desktop-widgets/plannerSettings.ui @@ -530,7 +530,7 @@ <property name="spacing"> <number>2</number> </property> - <item row="4" column="0"> + <item row="5" column="0"> <spacer name="verticalSpacer_3"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -588,6 +588,25 @@ </property> </widget> </item> + <item row="4" column="1"> + <widget class="QSpinBox" name="bestmixEAD"> + <property name="suffix"> + <string>m</string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + <property name="value"> + <number>30</number> + </property> + <property name="toolTip"> + <string>Used to calculate best mix. Select best mix depth in 'Available gases' table by entering gas depth, followed by "B" (best trimix mix) or "BN" (best nitrox mix)</string> + </property> + </widget> + </item> <item row="0" column="0"> <widget class="QLabel" name="bottomsac"> <property name="text"> @@ -602,7 +621,14 @@ </property> </widget> </item> - <item row="5" column="0" colspan="2"> + <item row="4" column="0"> + <widget class="QLabel" name="bestEAD"> + <property name="text"> + <string>Best mix EAD</string> + </property> + </widget> + </item> + <item row="6" column="0" colspan="2"> <widget class="QGroupBox" name="Notes"> <property name="title"> <string>Notes</string> @@ -739,6 +765,7 @@ <tabstop>decoStopSAC</tabstop> <tabstop>bottompo2</tabstop> <tabstop>decopo2</tabstop> + <tabstop>bestmixEAD</tabstop> <tabstop>display_runtime</tabstop> <tabstop>display_duration</tabstop> <tabstop>display_transitions</tabstop> |