diff options
author | jan Iversen <jan@casacondor.com> | 2019-12-23 15:41:58 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-12-26 08:45:40 -0800 |
commit | 413501bc61689e552de5764db69933a237e7af56 (patch) | |
tree | 7a5d51b82ee5f859ae191761f95c126c33d9d0cc | |
parent | d8780fdd89ca6e315e7524ab5ec7eb6bf8fc1e68 (diff) | |
download | subsurface-413501bc61689e552de5764db69933a237e7af56.tar.gz |
desktop-widgets: replace variables from plannerModel to plannerShared
variables
bottomsac
decosac
problemsolvingtime
sacfactor
are not set in diveplanner.cpp, but instead
signals a slot in plannerModel.
change signals to slots in plannerShared
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | desktop-widgets/diveplanner.cpp | 38 | ||||
-rw-r--r-- | desktop-widgets/diveplanner.h | 4 |
2 files changed, 9 insertions, 33 deletions
diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index dc6ae9a6e..8eea0bad8 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -288,16 +288,6 @@ void DivePlannerWidget::customSalinityChanged(double density) } } -void PlannerSettingsWidget::bottomSacChanged(const double bottomSac) -{ - plannerModel->setBottomSac(bottomSac); -} - -void PlannerSettingsWidget::decoSacChanged(const double decosac) -{ - plannerModel->setDecoSac(decosac); -} - void PlannerSettingsWidget::disableDecoElements(int mode) { if (mode == RECREATIONAL) { @@ -366,7 +356,7 @@ void PlannerSettingsWidget::disableDecoElements(int mode) ui.label_min_switch_duration->setDisabled(false); ui.sacfactor->setDisabled(false); ui.problemsolvingtime->setDisabled(false); - ui.sacfactor->setValue(prefs.sacfactor / 100.0); + ui.sacfactor->setValue(plannerShared::sacfactor()); ui.problemsolvingtime->setValue(prefs.problemsolvingtime); ui.display_variations->setDisabled(false); } @@ -401,7 +391,7 @@ void PlannerSettingsWidget::disableDecoElements(int mode) ui.label_min_switch_duration->setDisabled(false); ui.sacfactor->setDisabled(false); ui.problemsolvingtime->setDisabled(false); - ui.sacfactor->setValue(prefs.sacfactor / 100.0); + ui.sacfactor->setValue(plannerShared::sacfactor()); ui.problemsolvingtime->setValue(prefs.problemsolvingtime); ui.display_variations->setDisabled(false); } @@ -445,7 +435,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) ui.display_transitions->setChecked(prefs.display_transitions); ui.display_variations->setChecked(prefs.display_variations); ui.safetystop->setChecked(prefs.safetystop); - ui.sacfactor->setValue(prefs.sacfactor / 100.0); + ui.sacfactor->setValue(plannerShared::sacfactor()); ui.problemsolvingtime->setValue(prefs.problemsolvingtime); ui.bottompo2->setValue(prefs.bottompo2 / 1000.0); ui.decopo2->setValue(prefs.decopo2 / 1000.0); @@ -515,13 +505,13 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) connect(ui.descRate, SIGNAL(valueChanged(int)), plannerShared::instance(), SLOT(set_descrate(int))); connect(ui.ascRateStops, SIGNAL(valueChanged(int)), plannerShared::instance(), SLOT(set_ascratestops(int))); connect(ui.ascRateLast6m, SIGNAL(valueChanged(int)), plannerShared::instance(), SLOT(set_ascratelast6m(int))); - connect(ui.sacfactor, SIGNAL(valueChanged(double)), this, SLOT(sacFactorChanged(double))); - connect(ui.problemsolvingtime, SIGNAL(valueChanged(int)), this, SLOT(problemSolvingTimeChanged(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.bottomSAC, SIGNAL(valueChanged(double)), this, SLOT(bottomSacChanged(double))); - connect(ui.decoStopSAC, SIGNAL(valueChanged(double)), this, SLOT(decoSacChanged(double))); + connect(ui.bottomSAC, SIGNAL(valueChanged(double)), plannerShared::instance(), SLOT(sec_bottomsac(double))); + connect(ui.decoStopSAC, SIGNAL(valueChanged(double)), plannerShared::instance(), SLOT(set_decosac(double))); settingsChanged(); ui.gflow->setValue(prefs.gflow); @@ -589,8 +579,8 @@ void PlannerSettingsWidget::settingsChanged() ui.bottomSAC->setSingleStep(1); ui.decoStopSAC->setDecimals(0); ui.decoStopSAC->setSingleStep(1); - ui.bottomSAC->setValue((double) prefs.bottomsac / 1000.0); - ui.decoStopSAC->setValue((double) prefs.decosac / 1000.0); + ui.bottomSAC->setValue(plannerShared::bottomsac()); + ui.decoStopSAC->setValue(plannerShared::decosac()); } if(get_units()->pressure == units::BAR) { ui.reserve_gas->setSuffix(tr("bar")); @@ -618,16 +608,6 @@ void PlannerSettingsWidget::printDecoPlan() { } -void PlannerSettingsWidget::sacFactorChanged(const double factor) -{ - plannerModel->setSacFactor(factor); -} - -void PlannerSettingsWidget::problemSolvingTimeChanged(const int minutes) -{ - plannerModel->setProblemSolvingTime(minutes); -} - void PlannerSettingsWidget::setBottomPo2(double po2) { qPrefDivePlanner::instance()->set_bottompo2((int) (po2 * 1000.0)); diff --git a/desktop-widgets/diveplanner.h b/desktop-widgets/diveplanner.h index 1dcad1a46..f8ad5dfba 100644 --- a/desktop-widgets/diveplanner.h +++ b/desktop-widgets/diveplanner.h @@ -71,11 +71,7 @@ public: public slots: void settingsChanged(); - void bottomSacChanged(const double bottomSac); - void decoSacChanged(const double decosac); void printDecoPlan(); - void sacFactorChanged(const double factor); - void problemSolvingTimeChanged(const int min); void setBottomPo2(double po2); void setDecoPo2(double po2); void setBestmixEND(int depth); |