Make the reserve gas units aware

In the planner, for recreational mode, there is a setting indicating
the pressure at which the diver should be back at the surface. This
pressure was hardcoded to bar.

Fixes #1027

[Dirk Hohndel: small modifications, more reasonable step for psi,
               more reasonable maxima]

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2016-03-22 23:44:59 +01:00 committed by Dirk Hohndel
parent e8f8051efe
commit 48007ebc30
2 changed files with 16 additions and 2 deletions

View file

@ -481,7 +481,10 @@ void DivePlannerPointsModel::setSafetyStop(bool value)
void DivePlannerPointsModel::setReserveGas(int reserve)
{
prefs.reserve_gas = reserve * 1000;
if (prefs.units.pressure == units::BAR)
prefs.reserve_gas = reserve * 1000;
else
prefs.reserve_gas = psi_to_mbar(reserve);
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
}