summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2016-03-22 23:44:59 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-03-22 16:16:38 -0700
commit48007ebc3039525d2ff96dbcf944444009b67537 (patch)
treed089c4eb8f4bdd3b0b5b931e209874872cb5dc8b /qt-models
parente8f8051efe9aba8d5d5a463f13dcd3cfe29ec14b (diff)
downloadsubsurface-48007ebc3039525d2ff96dbcf944444009b67537.tar.gz
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>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/diveplannermodel.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp
index f7570fd55..c3996d077 100644
--- a/qt-models/diveplannermodel.cpp
+++ b/qt-models/diveplannermodel.cpp
@@ -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));
}