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>
This commit is contained in:
Robert C. Helling 2018-06-17 21:30:51 +02:00
parent c64e4b159f
commit 0f77d73df2

View file

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