summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-02-24 11:21:27 +0100
committerGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-04-07 00:13:35 +0200
commit75f37a7d10b4c650552a344770c92a2038e9db34 (patch)
tree824679ff2275ad5fe8b633190c3f81e995c1dc43 /qt-models
parent1f8a45db44d12ced038d72c84d663885043e8663 (diff)
downloadsubsurface-75f37a7d10b4c650552a344770c92a2038e9db34.tar.gz
CylindersModel: don't test for planner-state in remove()
This is only called from the planner. Therefore, the test is redundant. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/cylindermodel.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp
index 3a3f14605..7864da76c 100644
--- a/qt-models/cylindermodel.cpp
+++ b/qt-models/cylindermodel.cpp
@@ -486,6 +486,9 @@ Qt::ItemFlags CylindersModel::flags(const QModelIndex &index) const
return QAbstractItemModel::flags(index) | Qt::ItemIsEditable;
}
+// This function is only invoked from the planner! Therefore, there is
+// no need to check whether we are in the planner. Perhaps move some
+// of this functionality to the planner itself.
void CylindersModel::remove(QModelIndex index)
{
if (!d)
@@ -504,8 +507,7 @@ void CylindersModel::remove(QModelIndex index)
if (index.column() != REMOVE)
return;
- if ((in_planner() && DivePlannerPointsModel::instance()->tankInUse(index.row())) ||
- (!in_planner() && is_cylinder_prot(d, index.row())))
+ if (DivePlannerPointsModel::instance()->tankInUse(index.row()))
return;
beginRemoveRows(QModelIndex(), index.row(), index.row());
@@ -515,8 +517,7 @@ void CylindersModel::remove(QModelIndex index)
std::vector<int> mapping = get_cylinder_map_for_remove(d->cylinders.nr + 1, index.row());
cylinder_renumber(d, &mapping[0]);
- if (in_planner())
- DivePlannerPointsModel::instance()->cylinderRenumber(&mapping[0]);
+ DivePlannerPointsModel::instance()->cylinderRenumber(&mapping[0]);
changed = true;
}