summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar jan Iversen <jan@casacondor.com>2019-12-23 17:53:31 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-26 09:58:47 -0800
commitc976385aed32421dc6df92e8d47c832d692966cd (patch)
treedf6cdc45d98a74a7adbb13f74418fa5511ce3841 /desktop-widgets/diveplanner.cpp
parent738ee360ba1b22c2be22fd7021205dd9dfae1f3d (diff)
downloadsubsurface-c976385aed32421dc6df92e8d47c832d692966cd.tar.gz
desktop-widgets: replace variables to plannerShared
Use plannerShared setter to update the variables in qPref. This will also signal the cylindermodel to calculate a new bestmix. variables: bottompo2 decopo2 bestmixend Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/diveplanner.cpp')
-rw-r--r--desktop-widgets/diveplanner.cpp31
1 files changed, 5 insertions, 26 deletions
diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp
index b83fa0fa6..927e31613 100644
--- a/desktop-widgets/diveplanner.cpp
+++ b/desktop-widgets/diveplanner.cpp
@@ -437,8 +437,8 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
ui.safetystop->setChecked(prefs.safetystop);
ui.sacfactor->setValue(plannerShared::sacfactor());
ui.problemsolvingtime->setValue(prefs.problemsolvingtime);
- ui.bottompo2->setValue(prefs.bottompo2 / 1000.0);
- ui.decopo2->setValue(prefs.decopo2 / 1000.0);
+ ui.bottompo2->setValue(plannerShared::bottompo2());
+ ui.decopo2->setValue(plannerShared::decopo2());
ui.backgasBreaks->setChecked(prefs.doo2breaks);
plannerShared::set_dobailout(false);
setBailoutVisibility(false);
@@ -495,9 +495,6 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
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()));
-
connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(disableDecoElements(int)));
connect(ui.ascRate75, SIGNAL(valueChanged(int)), plannerShared::instance(), SLOT(set_ascrate75(int)));
connect(ui.ascRate50, SIGNAL(valueChanged(int)), plannerShared::instance(), SLOT(set_ascrate50(int)));
@@ -506,9 +503,9 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
connect(ui.ascRateLast6m, SIGNAL(valueChanged(int)), plannerShared::instance(), SLOT(set_ascratelast6m(int)));
connect(ui.sacfactor, SIGNAL(valueChanged(double)), plannerShared::instance(), SLOT(set_sacfactor(double)));
connect(ui.problemsolvingtime, SIGNAL(valueChanged(int)), plannerShared::instance(), SLOT(set_problemsolvingtime(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)));
+ connect(ui.bottompo2, SIGNAL(valueChanged(double)), plannerShared::instance(), SLOT(set_bottompo2(double)));
+ connect(ui.decopo2, SIGNAL(valueChanged(double)), plannerShared::instance(), SLOT(set_decopo2(double)));
+ connect(ui.bestmixEND, SIGNAL(valueChanged(int)), plannerShared::instance(), SLOT(set_bestmixend(int)));
connect(ui.bottomSAC, SIGNAL(valueChanged(double)), plannerShared::instance(), SLOT(sec_bottomsac(double)));
connect(ui.decoStopSAC, SIGNAL(valueChanged(double)), plannerShared::instance(), SLOT(set_decosac(double)));
@@ -607,24 +604,6 @@ void PlannerSettingsWidget::printDecoPlan()
{
}
-void PlannerSettingsWidget::setBottomPo2(double po2)
-{
- qPrefDivePlanner::instance()->set_bottompo2((int) (po2 * 1000.0));
-}
-
-void PlannerSettingsWidget::setDecoPo2(double po2)
-{
- pressure_t olddecopo2;
- olddecopo2.mbar = prefs.decopo2;
- qPrefDivePlanner::instance()->set_decopo2((int) (po2 * 1000.0));
- CylindersModel::instance()->updateDecoDepths(olddecopo2);
-}
-
-void PlannerSettingsWidget::setBestmixEND(int depth)
-{
- qPrefDivePlanner::instance()->set_bestmixend(units_to_depth(depth).mm);
-}
-
void PlannerSettingsWidget::setBackgasBreaks(bool dobreaks)
{
plannerShared::set_doo2breaks(dobreaks);