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>
This commit is contained in:
jan Iversen 2019-12-23 15:41:58 +01:00 committed by Dirk Hohndel
parent d8780fdd89
commit 413501bc61
2 changed files with 9 additions and 33 deletions

View file

@ -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));

View file

@ -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);