aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2018-06-17 21:30:51 +0200
committerGravatar Robert C. Helling <helling@atdotde.de>2018-06-24 09:35:55 +0200
commit0f77d73df28ff6c8c9f83c30232e6481e181ffae (patch)
treeb562b47ee9b310c2ec80d176aae5ff0ed82d14c3
parentc64e4b159f38ce4e59766a363687ad3170c04cc9 (diff)
downloadsubsurface-0f77d73df28ff6c8c9f83c30232e6481e181ffae.tar.gz
Planner: Change segment setpoint according to divemode
When making a segment non-CCR, its setpoint should be 0. OTOH, when it becomes CCR, use the default setpoint (or should we try to find the last previous setpoint?) Signed-off-by: Robert C. Helling <helling@atdotde.de>
-rw-r--r--qt-models/diveplannermodel.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp
index b5e34a769..800884c12 100644
--- a/qt-models/diveplannermodel.cpp
+++ b/qt-models/diveplannermodel.cpp
@@ -337,8 +337,10 @@ bool DivePlannerPointsModel::setData(const QModelIndex &index, const QVariant &v
CylindersModel::instance()->updateTrashIcon();
break;
case DIVEMODE:
- if (value.toInt() < FREEDIVE) // FIXME: I want to be a combo box and translate strings to enum values
+ if (value.toInt() < FREEDIVE) {
p.divemode = (enum divemode_t) value.toInt();
+ p.setpoint = p.divemode == CCR ? prefs.defaultsetpoint : 0;
+ }
if (index.row() == 0)
displayed_dive.dc.divemode = (enum divemode_t) value.toInt();
break;