mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
dive planner: correct bottomsac/decosac calc.
Move conversion cuft <-> liter from desktop-widget/diveplanner.cpp to plannerShared, to facilitate the same results in mobile diveplanner Use Backend for bottomsac/decosac and update to check for switch LITER <-> CUFT Add bottomsac/decosac to QMLinterface. Signed-off-by: jan Iversen <jan@casacondor.com>
This commit is contained in:
parent
5548376776
commit
cd3c2266f9
6 changed files with 49 additions and 18 deletions
|
@ -63,20 +63,42 @@ void plannerShared::set_min_switch_duration(int value)
|
|||
|
||||
double plannerShared::bottomsac()
|
||||
{
|
||||
return qPrefDivePlanner::bottomsac() / 1000.0;
|
||||
return (qPrefUnits::volume() == units::LITER) ?
|
||||
qPrefDivePlanner::bottomsac() / 1000.0 :
|
||||
ml_to_cuft(qPrefDivePlanner::bottomsac()
|
||||
#ifdef SUBSURFACE_MOBILE
|
||||
* 100 // cuft without decimals (0 - 300)
|
||||
#endif
|
||||
);
|
||||
}
|
||||
void plannerShared::set_bottomsac(double value)
|
||||
{
|
||||
#ifdef SUBSURFACE_MOBILE
|
||||
if (qPrefUnits::volume() == units::CUFT)
|
||||
value /= 100; // cuft without decimals (0 - 300)
|
||||
#endif
|
||||
|
||||
// NO conversion, this is done in the planner model.
|
||||
DivePlannerPointsModel::instance()->setBottomSac(value);
|
||||
}
|
||||
|
||||
double plannerShared::decosac()
|
||||
{
|
||||
return qPrefDivePlanner::decosac() / 1000.0;
|
||||
return (qPrefUnits::volume() == units::LITER) ?
|
||||
qPrefDivePlanner::decosac() / 1000.0 :
|
||||
ml_to_cuft(qPrefDivePlanner::decosac()
|
||||
#ifdef SUBSURFACE_MOBILE
|
||||
* 100 // cuft without decimals (0 - 300)
|
||||
#endif
|
||||
);
|
||||
}
|
||||
void plannerShared::set_decosac(double value)
|
||||
{
|
||||
#ifdef SUBSURFACE_MOBILE
|
||||
if (qPrefUnits::volume() == units::CUFT)
|
||||
value /= 100; // cuft without decimals (0 - 300)
|
||||
#endif
|
||||
|
||||
// NO conversion, this is done in the planner model.
|
||||
DivePlannerPointsModel::instance()->setDecoSac(value);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue