aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2017-02-11 20:24:18 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-03-11 08:01:35 -0800
commit7f8c3592ce29d5fd4cd177d8e86ede9fdf3ab747 (patch)
tree2c339a577a304a6f58e5518534e31f8d449af229 /desktop-widgets/diveplanner.cpp
parentb8e044dee350076984e998d4d797ec4e7a191f41 (diff)
downloadsubsurface-7f8c3592ce29d5fd4cd177d8e86ede9fdf3ab747.tar.gz
Minimum gas calculation - Calculations and UI parameters
Add minimum gas calculation to planner output. Add the two UI parameters prefs.sacfactor and prefs.problemsolvingtime. Connect UI signals and slots for recalculation of diveplan. Disable minimum gas calculation if there was already a warning before. If minimum gas result is larger then cylinder start pressure give warning message instead of result. Add line break before pO2 warnings but only if warnings exist. Signed-off-by: Joachim Ritter <jritter@bitsenke.de> Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'desktop-widgets/diveplanner.cpp')
-rw-r--r--desktop-widgets/diveplanner.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp
index 1cf0b911f..804ea89e1 100644
--- a/desktop-widgets/diveplanner.cpp
+++ b/desktop-widgets/diveplanner.cpp
@@ -300,6 +300,8 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
ui.display_runtime->setChecked(prefs.display_runtime);
ui.display_transitions->setChecked(prefs.display_transitions);
ui.safetystop->setChecked(prefs.safetystop);
+ ui.sacfactor->setValue(prefs.sacfactor / 100.0);
+ ui.problemsolvingtime->setValue(prefs.problemsolvingtime);
ui.bottompo2->setValue(prefs.bottompo2 / 1000.0);
ui.decopo2->setValue(prefs.decopo2 / 1000.0);
ui.backgasBreaks->setChecked(prefs.doo2breaks);
@@ -362,6 +364,8 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
connect(ui.descRate, SIGNAL(valueChanged(int)), this, SLOT(setDescRate(int)));
connect(ui.ascRateStops, SIGNAL(valueChanged(int)), this, SLOT(setAscRateStops(int)));
connect(ui.ascRateLast6m, SIGNAL(valueChanged(int)), this, SLOT(setAscRateLast6m(int)));
+ connect(ui.sacfactor, SIGNAL(valueChanged(double)), this, SLOT(sacFactorChanged(double)));
+ connect(ui.problemsolvingtime, SIGNAL(valueChanged(int)), this, SLOT(problemSolvingTimeChanged(int)));
connect(ui.bottompo2, SIGNAL(valueChanged(double)), this, SLOT(setBottomPo2(double)));
connect(ui.decopo2, SIGNAL(valueChanged(double)), this, SLOT(setDecoPo2(double)));
connect(ui.bestmixEND, SIGNAL(valueChanged(int)), this, SLOT(setBestmixEND(int)));
@@ -480,6 +484,16 @@ void PlannerSettingsWidget::setDescRate(int rate)
SettingsObjectWrapper::instance()->planner_settings->setDescrate(rate * UNIT_FACTOR);
}
+void PlannerSettingsWidget::sacFactorChanged(const double factor)
+{
+ plannerModel->setSacFactor(factor);
+}
+
+void PlannerSettingsWidget::problemSolvingTimeChanged(const int minutes)
+{
+ plannerModel->setProblemSolvingTime(minutes);
+}
+
void PlannerSettingsWidget::setBottomPo2(double po2)
{
SettingsObjectWrapper::instance()->planner_settings->setBottompo2((int) (po2 * 1000.0));