mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
diveplanner: move mobile specific calc to diveplannermodel
setBottomSac, setDecoSac and setFactor in diveplannermodel receives display value which are then converted. subsurface-mobile have slightly different values, move the correction of these from plannershared to diveplannermodel, in order to keep the whole convert in one place. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
14931db0a9
commit
74d13b0554
2 changed files with 12 additions and 13 deletions
|
@ -83,11 +83,6 @@ double plannerShared::bottomsac()
|
||||||
}
|
}
|
||||||
void plannerShared::set_bottomsac(double value)
|
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.
|
// NO conversion, this is done in the planner model.
|
||||||
DivePlannerPointsModel::instance()->setBottomSac(value);
|
DivePlannerPointsModel::instance()->setBottomSac(value);
|
||||||
}
|
}
|
||||||
|
@ -104,11 +99,6 @@ double plannerShared::decosac()
|
||||||
}
|
}
|
||||||
void plannerShared::set_decosac(double value)
|
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.
|
// NO conversion, this is done in the planner model.
|
||||||
DivePlannerPointsModel::instance()->setDecoSac(value);
|
DivePlannerPointsModel::instance()->setDecoSac(value);
|
||||||
}
|
}
|
||||||
|
@ -124,9 +114,6 @@ double plannerShared::sacfactor()
|
||||||
}
|
}
|
||||||
void plannerShared::set_sacfactor(double value)
|
void plannerShared::set_sacfactor(double value)
|
||||||
{
|
{
|
||||||
#ifdef SUBSURFACE_MOBILE
|
|
||||||
value /= 10.0;
|
|
||||||
#endif
|
|
||||||
// NO conversion, this is done in the planner model.
|
// NO conversion, this is done in the planner model.
|
||||||
DivePlannerPointsModel::instance()->setSacFactor(value);
|
DivePlannerPointsModel::instance()->setSacFactor(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "core/device.h"
|
#include "core/device.h"
|
||||||
#include "core/qthelper.h"
|
#include "core/qthelper.h"
|
||||||
#include "core/settings/qPrefDivePlanner.h"
|
#include "core/settings/qPrefDivePlanner.h"
|
||||||
|
#include "core/settings/qPrefUnit.h"
|
||||||
#if not defined(SUBSURFACE_MOBILE) && not defined(SUBSURFACE_TESTING)
|
#if not defined(SUBSURFACE_MOBILE) && not defined(SUBSURFACE_TESTING)
|
||||||
#include "commands/command.h"
|
#include "commands/command.h"
|
||||||
#endif // SUBSURFACE_MOBILE SUBSURFACE_TESTING
|
#endif // SUBSURFACE_MOBILE SUBSURFACE_TESTING
|
||||||
|
@ -433,6 +434,10 @@ void DivePlannerPointsModel::emitDataChanged()
|
||||||
|
|
||||||
void DivePlannerPointsModel::setBottomSac(double sac)
|
void DivePlannerPointsModel::setBottomSac(double sac)
|
||||||
{
|
{
|
||||||
|
#ifdef SUBSURFACE_MOBILE
|
||||||
|
if (qPrefUnits::volume() == units::CUFT)
|
||||||
|
sac /= 100; // cuft without decimals (0 - 300)
|
||||||
|
#endif
|
||||||
diveplan.bottomsac = units_to_sac(sac);
|
diveplan.bottomsac = units_to_sac(sac);
|
||||||
qPrefDivePlanner::set_bottomsac(diveplan.bottomsac);
|
qPrefDivePlanner::set_bottomsac(diveplan.bottomsac);
|
||||||
emitDataChanged();
|
emitDataChanged();
|
||||||
|
@ -440,6 +445,10 @@ void DivePlannerPointsModel::setBottomSac(double sac)
|
||||||
|
|
||||||
void DivePlannerPointsModel::setDecoSac(double sac)
|
void DivePlannerPointsModel::setDecoSac(double sac)
|
||||||
{
|
{
|
||||||
|
#ifdef SUBSURFACE_MOBILE
|
||||||
|
if (qPrefUnits::volume() == units::CUFT)
|
||||||
|
sac /= 100; // cuft without decimals (0 - 300)
|
||||||
|
#endif
|
||||||
diveplan.decosac = units_to_sac(sac);
|
diveplan.decosac = units_to_sac(sac);
|
||||||
qPrefDivePlanner::set_decosac(diveplan.decosac);
|
qPrefDivePlanner::set_decosac(diveplan.decosac);
|
||||||
emitDataChanged();
|
emitDataChanged();
|
||||||
|
@ -447,6 +456,9 @@ void DivePlannerPointsModel::setDecoSac(double sac)
|
||||||
|
|
||||||
void DivePlannerPointsModel::setSacFactor(double factor)
|
void DivePlannerPointsModel::setSacFactor(double factor)
|
||||||
{
|
{
|
||||||
|
#ifdef SUBSURFACE_MOBILE
|
||||||
|
factor /= 10.0;
|
||||||
|
#endif
|
||||||
qPrefDivePlanner::set_sacfactor((int) round(factor * 100));
|
qPrefDivePlanner::set_sacfactor((int) round(factor * 100));
|
||||||
emitDataChanged();
|
emitDataChanged();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue