From 2c794348c1060c8f6ce55c598c0a20690c4967f2 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Thu, 10 Jan 2019 21:18:53 +0100 Subject: Planner: Add checkbox to force OC bailout This adds a checkbox for rebreather modes of the planner that force the ascent to be in OC mode. Before, one had to add a one minute last segment with the mode change but this is not practical when manually searching for the maximal bottom time given gas reserves. Signed-off-by: Robert C. Helling --- desktop-widgets/diveplanner.cpp | 22 +++++ desktop-widgets/diveplanner.h | 2 + desktop-widgets/mainwindow.cpp | 1 + desktop-widgets/plannerSettings.ui | 197 +++++++++++++++++++------------------ 4 files changed, 127 insertions(+), 95 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index bda612431..c5467aa08 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -123,6 +123,7 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg ui.waterType->setItemData(1, SEAWATER_SALINITY); ui.waterType->setItemData(2, EN13319_SALINITY); waterTypeUpdateTexts(); + QTableView *view = ui.cylinderTableWidget->view(); view->setColumnHidden(CylindersModel::START, true); view->setColumnHidden(CylindersModel::END, true); @@ -307,6 +308,10 @@ void PlannerSettingsWidget::disableDecoElements(int mode) ui.backgasBreaks->blockSignals(true); ui.backgasBreaks->setChecked(false); ui.backgasBreaks->blockSignals(false); + ui.bailout->setDisabled(true); + ui.bailout->blockSignals(true); + ui.bailout->setChecked(false); + ui.bailout->blockSignals(false); ui.bottompo2->setDisabled(false); ui.decopo2->setDisabled(true); ui.safetystop->setDisabled(false); @@ -344,6 +349,7 @@ void PlannerSettingsWidget::disableDecoElements(int mode) ui.backgasBreaks->setChecked(false); ui.backgasBreaks->blockSignals(false); } + ui.bailout->setDisabled(!(displayed_dive.dc.divemode == CCR || displayed_dive.dc.divemode == PSCR)); ui.bottompo2->setDisabled(false); ui.decopo2->setDisabled(false); ui.safetystop->setDisabled(true); @@ -377,6 +383,7 @@ void PlannerSettingsWidget::disableDecoElements(int mode) ui.backgasBreaks->setChecked(false); ui.backgasBreaks->blockSignals(false); } + ui.bailout->setDisabled(!(displayed_dive.dc.divemode == CCR || displayed_dive.dc.divemode == PSCR)); ui.bottompo2->setDisabled(false); ui.decopo2->setDisabled(false); ui.safetystop->setDisabled(true); @@ -438,6 +445,8 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) ui.bottompo2->setValue(prefs.bottompo2 / 1000.0); ui.decopo2->setValue(prefs.decopo2 / 1000.0); ui.backgasBreaks->setChecked(prefs.doo2breaks); + setBailout(false); + setBailoutVisibility(false); 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); @@ -481,9 +490,11 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int))); connect(ui.vpmb_conservatism, SIGNAL(valueChanged(int)), plannerModel, SLOT(setVpmbConservatism(int))); connect(ui.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool))); + connect(ui.bailout, SIGNAL(toggled(bool)), this, SLOT(setBailout(bool))); connect(ui.switch_at_req_stop, SIGNAL(toggled(bool)), plannerModel, SLOT(setSwitchAtReqStop(bool))); connect(ui.min_switch_duration, SIGNAL(valueChanged(int)), plannerModel, SLOT(setMinSwitchDuration(int))); connect(ui.rebreathermode, SIGNAL(currentIndexChanged(int)), plannerModel, SLOT(setRebreatherMode(int))); + connect(ui.rebreathermode, SIGNAL(currentIndexChanged(int)), this, SLOT(setBailoutVisibility(int))); connect(ui.bottompo2, SIGNAL(valueChanged(double)), CylindersModel::instance(), SLOT(updateBestMixes())); connect(ui.bestmixEND, SIGNAL(valueChanged(int)), CylindersModel::instance(), SLOT(updateBestMixes())); @@ -656,6 +667,17 @@ void PlannerSettingsWidget::setBackgasBreaks(bool dobreaks) plannerModel->emitDataChanged(); } +void PlannerSettingsWidget::setBailout(bool dobailout) +{ + qPrefDivePlanner::instance()->set_dobailout(dobailout); + plannerModel->emitDataChanged(); +} + +void PlannerSettingsWidget::setBailoutVisibility(int mode) +{ + ui.bailout->setDisabled(!(mode == CCR || mode == PSCR)); +} + PlannerDetails::PlannerDetails(QWidget *parent) : QWidget(parent) { ui.setupUi(this); diff --git a/desktop-widgets/diveplanner.h b/desktop-widgets/diveplanner.h index bf35ed7ec..6d17c956b 100644 --- a/desktop-widgets/diveplanner.h +++ b/desktop-widgets/diveplanner.h @@ -85,9 +85,11 @@ slots: void setDecoPo2(double po2); void setBestmixEND(int depth); void setBackgasBreaks(bool dobreaks); + void setBailout(bool dobailout); void disableDecoElements(int mode); void disableBackgasBreaks(bool enabled); void setDiveMode(int mode); + void setBailoutVisibility(int mode); private: Ui::plannerSettingsWidget ui; diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 2e4342511..64cdc6cb3 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -1005,6 +1005,7 @@ void MainWindow::on_actionDivePlanner_triggered() // plan the dive in the same mode as the currently selected one if (current_dive) { divePlannerSettingsWidget->setDiveMode(current_dive->dc.divemode); + divePlannerSettingsWidget->setBailoutVisibility(current_dive->dc.divemode); if (current_dive->salinity) divePlannerWidget->setSalinity(current_dive->salinity); } diff --git a/desktop-widgets/plannerSettings.ui b/desktop-widgets/plannerSettings.ui index 81d6d4a4b..72aec7c55 100644 --- a/desktop-widgets/plannerSettings.ui +++ b/desktop-widgets/plannerSettings.ui @@ -255,7 +255,7 @@ 2 - + bar @@ -274,7 +274,7 @@ - + Qt::Vertical @@ -287,7 +287,7 @@ - + Postpone gas change if a stop is not required @@ -297,54 +297,63 @@ - - + + - GFHigh - - - 25 + Last stop at 6m - - - - GFLow + + + + + - - 26 + + 4 - - + + % - 10 + 40 150 - - - - Drop to first depth + + + + min + + + + + + 0 + + + 9 + + + 1 - - + + - Min. switch duration O₂% below 100% + Plan backgas breaks - + Qt::Vertical @@ -357,40 +366,54 @@ + + + + Min. switch duration O₂% below 100% + + + - + - Plan backgas breaks + Drop to first depth - - + + - min - - - + % - 0 + 10 - 9 + 150 - - 1 + + + + + + GFLow + + + 26 - - + + - Last stop at 6m + GFHigh + + + 25 - + Maximize bottom time allowed by gas and no decompression limits @@ -400,47 +423,24 @@ - - - - % - - - 40 + + + + Conservatism level - - 150 + + 25 - + VPM-B deco - - - - Bühlmann deco - - - true - - - - - - - Reserve gas - - - 26 - - - - + Qt::LeftToRight @@ -453,7 +453,7 @@ - + Qt::Vertical @@ -466,7 +466,7 @@ - + Qt::Vertical @@ -479,26 +479,6 @@ - - - - Conservatism level - - - 25 - - - - - - - + - - - 4 - - - @@ -516,6 +496,33 @@ + + + + Bühlmann deco + + + true + + + + + + + Reserve gas + + + 26 + + + + + + + Bailout: Deco on OC + + + -- cgit v1.2.3-70-g09d2