mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
diveplanner: add comments explaining different scaling
In some case the scaling (real value <-> UI value) is different for mobile and desktop. In order to make the difference understandable comments are added to each function. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4066a65592
commit
d8b035ffe7
2 changed files with 17 additions and 0 deletions
|
@ -89,6 +89,9 @@ void plannerShared::set_bottomsac(double value)
|
|||
|
||||
double plannerShared::decosac()
|
||||
{
|
||||
// Mobile and desktop use the same values when using units::LITER,
|
||||
// however when using units::CUFT desktop want 0.00 - 3.00 while
|
||||
// mobile wants 0 - 300, therefore multiply by 100 for mobile
|
||||
return (qPrefUnits::volume() == units::LITER) ?
|
||||
qPrefDivePlanner::decosac() / 1000.0 :
|
||||
ml_to_cuft(qPrefDivePlanner::decosac()
|
||||
|
@ -105,6 +108,9 @@ void plannerShared::set_decosac(double value)
|
|||
|
||||
double plannerShared::sacfactor()
|
||||
{
|
||||
// mobile want 0 - 100 which are shown with 1 decimal as 0.0 - 10.0
|
||||
// whereas desktop wants 0.0 - 10.0
|
||||
// as a consequence divide by 10 or 100
|
||||
return qPrefDivePlanner::sacfactor() /
|
||||
#ifdef SUBSURFACE_MOBILE
|
||||
10.0;
|
||||
|
|
|
@ -434,6 +434,10 @@ void DivePlannerPointsModel::emitDataChanged()
|
|||
|
||||
void DivePlannerPointsModel::setBottomSac(double sac)
|
||||
{
|
||||
// mobile delivers the same value as desktop when using
|
||||
// units:METERS
|
||||
// however when using units:CUFT mobile deliver 0-300 which
|
||||
// are really 0.00 - 3.00 so start be correcting that
|
||||
#ifdef SUBSURFACE_MOBILE
|
||||
if (qPrefUnits::volume() == units::CUFT)
|
||||
sac /= 100; // cuft without decimals (0 - 300)
|
||||
|
@ -445,6 +449,10 @@ void DivePlannerPointsModel::setBottomSac(double sac)
|
|||
|
||||
void DivePlannerPointsModel::setDecoSac(double sac)
|
||||
{
|
||||
// mobile delivers the same value as desktop when using
|
||||
// units:METERS
|
||||
// however when using units:CUFT mobile deliver 0-300 which
|
||||
// are really 0.00 - 3.00 so start be correcting that
|
||||
#ifdef SUBSURFACE_MOBILE
|
||||
if (qPrefUnits::volume() == units::CUFT)
|
||||
sac /= 100; // cuft without decimals (0 - 300)
|
||||
|
@ -456,6 +464,9 @@ void DivePlannerPointsModel::setDecoSac(double sac)
|
|||
|
||||
void DivePlannerPointsModel::setSacFactor(double factor)
|
||||
{
|
||||
// sacfactor is normal x.y (one decimal), however mobile
|
||||
// delivers 0 - 100 so adjust that to 0.0 - 10.0, to have
|
||||
// the same value as desktop
|
||||
#ifdef SUBSURFACE_MOBILE
|
||||
factor /= 10.0;
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue