Planner: make cylinder-model subobject of planner-model

The cylinder-model had an instance() function, but actually
there were two cylinder models: one used by the equipment tab,
one used by the planner.

This is misleading. Therefore, remove the instance() function
and make the cylinder-model a subobject of the planner-model.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-02-03 18:52:17 +01:00 committed by Dirk Hohndel
parent 6622f42aab
commit 190a2a876e
7 changed files with 39 additions and 38 deletions

View file

@ -126,7 +126,7 @@ void PlannerShared::set_o2narcotic(bool value)
{
qPrefDivePlanner::set_o2narcotic(value);
DivePlannerPointsModel::instance()->emitDataChanged();
CylindersModelFiltered::instance()->model()->updateBestMixes();
DivePlannerPointsModel::instance()->cylindersModel()->model()->updateBestMixes();
}
double PlannerShared::bottompo2()
@ -136,7 +136,7 @@ double PlannerShared::bottompo2()
void PlannerShared::set_bottompo2(double value)
{
qPrefDivePlanner::set_bottompo2((int) (value * 1000.0));
CylindersModelFiltered::instance()->model()->updateBestMixes();
DivePlannerPointsModel::instance()->cylindersModel()->model()->updateBestMixes();
}
double PlannerShared::decopo2()
@ -148,8 +148,8 @@ void PlannerShared::set_decopo2(double value)
pressure_t olddecopo2;
olddecopo2.mbar = prefs.decopo2;
qPrefDivePlanner::instance()->set_decopo2((int) (value * 1000.0));
CylindersModelFiltered::instance()->model()->updateDecoDepths(olddecopo2);
CylindersModelFiltered::instance()->model()->updateBestMixes();
DivePlannerPointsModel::instance()->cylindersModel()->model()->updateDecoDepths(olddecopo2);
DivePlannerPointsModel::instance()->cylindersModel()->model()->updateBestMixes();
}
int PlannerShared::bestmixend()
@ -159,5 +159,5 @@ int PlannerShared::bestmixend()
void PlannerShared::set_bestmixend(int value)
{
qPrefDivePlanner::set_bestmixend(units_to_depth(value).mm);
CylindersModelFiltered::instance()->model()->updateBestMixes();
DivePlannerPointsModel::instance()->cylindersModel()->model()->updateBestMixes();
}