Updated strategy for removing cylinders

Change the strategy when to allow cylinder removal from a dive:
- Not remove when cylinder has gas switch events, in any other cases
  allow removal
- Remove this whole "cylinder with same gas" thing being a criteria
  for cylinder removal

When removing a cylinder which has corresponding pressure info in
samples, also remove this pressure info from the samples.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
Stefan Fuchs 2017-11-29 10:16:00 +01:00 committed by Jan Mulder
parent cd5e17cf79
commit 4cbf8b87a3
5 changed files with 42 additions and 37 deletions

View file

@ -346,8 +346,10 @@ void DivePlannerPointsModel::gasChange(const QModelIndex &index, int newcylinder
void DivePlannerPointsModel::cylinderRenumber(int mapping[])
{
for (int i = 0; i < rowCount(); i++)
divepoints[i].cylinderid = mapping[divepoints[i].cylinderid];
for (int i = 0; i < rowCount(); i++) {
if (mapping[divepoints[i].cylinderid] >= 0)
divepoints[i].cylinderid = mapping[divepoints[i].cylinderid];
}
emitDataChanged();
}