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 <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2014-08-02 23:21:19 +02:00 committed by Dirk Hohndel
parent a7eb316b1f
commit 89622b0b51

View file

@ -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;
}