From 89622b0b5151c4841398efce6433a72a62a109f2 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Sat, 2 Aug 2014 23:21:19 +0200 Subject: [PATCH] Enforce end pressures to be not above starting pressures. We don't blow into our cylinders under water. Negative pressures should be allowed as they might arise from dive planning without taking care of gas consumption. fixes #644 Signed-off-by: Robert C. Helling Signed-off-by: Dirk Hohndel --- qt-ui/models.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index 9d43da624..8963c1287 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -235,13 +235,13 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in } break; case START: - if (CHANGED()) { + if (CHANGED() && (!cyl->end.mbar || string_to_pressure(vString.toUtf8().data()).mbar >= cyl->end.mbar)) { cyl->start = string_to_pressure(vString.toUtf8().data()); changed = true; } break; case END: - if (CHANGED()) { + if (CHANGED() && (!cyl->start.mbar || string_to_pressure(vString.toUtf8().data()).mbar <= cyl->start.mbar)) { cyl->end = string_to_pressure(vString.toUtf8().data()); changed = true; }