summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/diveplanner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/diveplanner.cpp')
-rw-r--r--desktop-widgets/diveplanner.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp
index e4ea71445..4fc38cd2a 100644
--- a/desktop-widgets/diveplanner.cpp
+++ b/desktop-widgets/diveplanner.cpp
@@ -113,6 +113,7 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg
plannerModel->setRecalc(true);
ui.tableWidget->view()->setItemDelegateForColumn(DivePlannerPointsModel::GAS, new AirTypesDelegate(this));
ui.cylinderTableWidget->setTitle(tr("Available gases"));
+ ui.cylinderTableWidget->setBtnToolTip(tr("Add cylinder"));
ui.cylinderTableWidget->setModel(CylindersModel::instance());
QTableView *view = ui.cylinderTableWidget->view();
view->setColumnHidden(CylindersModel::START, true);
@@ -217,7 +218,7 @@ void DivePlannerWidget::atmPressureChanged(const int pressure)
void DivePlannerWidget::heightChanged(const int height)
{
- int pressure = (int) (1013.0 * exp(- (double) units_to_depth((double) height) / 7800000.0));
+ int pressure = (int) (1013.0 * exp(- (double) units_to_depth((double) height).mm / 7800000.0));
ui.ATMPressure->blockSignals(true);
ui.ATMPressure->setValue(pressure);
ui.ATMPressure->blockSignals(false);
@@ -253,6 +254,14 @@ void PlannerSettingsWidget::disableDecoElements(int mode)
ui.vpmb_conservatism->setDisabled(true);
ui.switch_at_req_stop->setDisabled(true);
ui.min_switch_duration->setDisabled(true);
+ ui.sacfactor->setDisabled(true);
+ ui.problemsolvingtime->setDisabled(true);
+ ui.sacfactor->blockSignals(true);
+ ui.problemsolvingtime->blockSignals(true);
+ ui.sacfactor->setValue(2.0);
+ ui.problemsolvingtime->setValue(0);
+ ui.sacfactor->blockSignals(false);
+ ui.problemsolvingtime->blockSignals(false);
}
else if (mode == VPMB) {
ui.gflow->setDisabled(true);
@@ -265,6 +274,10 @@ void PlannerSettingsWidget::disableDecoElements(int mode)
ui.vpmb_conservatism->setDisabled(false);
ui.switch_at_req_stop->setDisabled(false);
ui.min_switch_duration->setDisabled(false);
+ ui.sacfactor->setDisabled(false);
+ ui.problemsolvingtime->setDisabled(false);
+ ui.sacfactor->setValue(prefs.sacfactor / 100.0);
+ ui.problemsolvingtime->setValue(prefs.problemsolvingtime);
}
else if (mode == BUEHLMANN) {
ui.gflow->setDisabled(false);
@@ -277,6 +290,10 @@ void PlannerSettingsWidget::disableDecoElements(int mode)
ui.vpmb_conservatism->setDisabled(true);
ui.switch_at_req_stop->setDisabled(false);
ui.min_switch_duration->setDisabled(false);
+ ui.sacfactor->setDisabled(false);
+ ui.problemsolvingtime->setDisabled(false);
+ ui.sacfactor->setValue(prefs.sacfactor / 100.0);
+ ui.problemsolvingtime->setValue(prefs.problemsolvingtime);
}
}
@@ -300,6 +317,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 +381,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 +501,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));
@@ -495,7 +526,7 @@ void PlannerSettingsWidget::setDecoPo2(double po2)
void PlannerSettingsWidget::setBestmixEND(int depth)
{
- SettingsObjectWrapper::instance()->planner_settings->setBestmixend(units_to_depth(depth));
+ SettingsObjectWrapper::instance()->planner_settings->setBestmixend(units_to_depth(depth).mm);
}
void PlannerSettingsWidget::setBackgasBreaks(bool dobreaks)