From 48007ebc3039525d2ff96dbcf944444009b67537 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Tue, 22 Mar 2016 23:44:59 +0100 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-models/diveplannermodel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'qt-models') 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)); } -- cgit v1.2.3-70-g09d2