From 0f77d73df28ff6c8c9f83c30232e6481e181ffae Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Sun, 17 Jun 2018 21:30:51 +0200 Subject: [PATCH] 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 --- qt-models/diveplannermodel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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;