summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2017-10-08 17:37:15 +0200
committerGravatar Robert C. Helling <helling@atdotde.de>2017-10-16 17:14:17 +0200
commit8fd1c72f040cd2b3163de31c4f48659366979a39 (patch)
tree27ce79ad1316d30aff37c5f52ed8e739fc039226 /qt-models
parentcbf5d788e07ace3896a50e7d57da7d1f2a9b44ab (diff)
downloadsubsurface-8fd1c72f040cd2b3163de31c4f48659366979a39.tar.gz
Removing cylinders in planner: Be more restrictive
Be even more restrictive regarding which cylinders can be removed from the cylinder table in the planner. Only if a cyliner is not used in the planned part of the dive it can be removed. It doesn't matter if there is another cylinder with same gasmix. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/cylindermodel.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp
index 594df658c..d0675ed8a 100644
--- a/qt-models/cylindermodel.cpp
+++ b/qt-models/cylindermodel.cpp
@@ -242,7 +242,7 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const
if (gasmix_distance(mygas, gas2) == 0 && is_cylinder_used(&displayed_dive, i))
same_gas = i;
}
- if (same_gas == -1 &&
+ if ((in_planner() || same_gas == -1) &&
((DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING &&
DivePlannerPointsModel::instance()->tankInUse(index.row())) ||
(DivePlannerPointsModel::instance()->currentMode() == DivePlannerPointsModel::NOTHING &&
@@ -265,7 +265,7 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const
if (gasmix_distance(mygas, gas2) == 0 && is_cylinder_used(&displayed_dive, i))
same_gas = i;
}
- if (same_gas == -1 &&
+ if ((in_planner() || same_gas == -1) &&
((DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING &&
DivePlannerPointsModel::instance()->tankInUse(index.row())) ||
(DivePlannerPointsModel::instance()->currentMode() == DivePlannerPointsModel::NOTHING &&
@@ -569,7 +569,7 @@ void CylindersModel::remove(const QModelIndex &index)
if (gasmix_distance(mygas, gas2) == 0 && is_cylinder_used(&displayed_dive, i))
same_gas = i;
}
- if (same_gas == -1 &&
+ if ((in_planner() || same_gas == -1) &&
((DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING &&
DivePlannerPointsModel::instance()->tankInUse(index.row())) ||
(DivePlannerPointsModel::instance()->currentMode() == DivePlannerPointsModel::NOTHING &&