Planner: don't allow negative depths

This patch allows only non-negative depths in the divepoints table as
negative depths confuse the planenr/deco algortihm. The spinbox appearing
in the table should get a setMinimum(0) but I was not able to find the
correct way to implement that.

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-07-07 13:51:20 +02:00 committed by Dirk Hohndel
parent 3d511fe26b
commit a7969d1083

View file

@ -545,7 +545,8 @@ bool DivePlannerPointsModel::setData(const QModelIndex &index, const QVariant &v
divedatapoint &p = divepoints[index.row()];
switch (index.column()) {
case DEPTH:
p.depth = units_to_depth(value.toInt());
if (value.toInt() >= 0)
p.depth = units_to_depth(value.toInt());
break;
case RUNTIME:
p.time = value.toInt() * 60;