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>
This commit is contained in:
jan Iversen 2019-12-23 17:53:31 +01:00 committed by Dirk Hohndel
parent 738ee360ba
commit c976385aed
2 changed files with 5 additions and 29 deletions

View file

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

View file

@ -72,9 +72,6 @@ public
slots:
void settingsChanged();
void printDecoPlan();
void setBottomPo2(double po2);
void setDecoPo2(double po2);
void setBestmixEND(int depth);
void setBackgasBreaks(bool dobreaks);
void disableDecoElements(int mode);
void disableBackgasBreaks(bool enabled);