summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-02-03 18:59:12 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-02-11 20:37:09 -0800
commit1336ea755b7ad2ef18cb869ca6219a1a6e237ff9 (patch)
treeb5ecb061f62d98bcae4c7180c6ee777a2e604726 /qt-models
parent190a2a876e3fe3148c6cfce87ac630f251833066 (diff)
downloadsubsurface-1336ea755b7ad2ef18cb869ca6219a1a6e237ff9.tar.gz
Planner: don't filter cylinders
In the planner we used to filter out "unused" cylinders as in the equipment tab. It is unclear whether that makes sense or can even easily be reproduced, since such cylinders have to come from an imported dive. To be on the save side, let's not do this. Replace the CylindersFilteredModel introduced recently by a plain CylindersModel. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/diveplannermodel.cpp18
-rw-r--r--qt-models/diveplannermodel.h4
2 files changed, 11 insertions, 11 deletions
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp
index cf7dd0361..26d78bcb6 100644
--- a/qt-models/diveplannermodel.cpp
+++ b/qt-models/diveplannermodel.cpp
@@ -21,7 +21,7 @@
#define UNIT_FACTOR ((prefs.units.length == units::METERS) ? 1000.0 / 60.0 : feet_to_mm(1.0) / 60.0)
-CylindersModelFiltered *DivePlannerPointsModel::cylindersModel()
+CylindersModel *DivePlannerPointsModel::cylindersModel()
{
return &cylinders;
}
@@ -42,7 +42,7 @@ void DivePlannerPointsModel::removeSelectedPoints(const QVector<int> &rows)
divepoints.remove(v2[i]);
}
endRemoveRows();
- cylinders.model()->updateTrashIcon();
+ cylinders.updateTrashIcon();
}
void DivePlannerPointsModel::createSimpleDive()
@@ -320,7 +320,7 @@ bool DivePlannerPointsModel::setData(const QModelIndex &index, const QVariant &v
if (value.toInt() >= 0) {
p.depth = units_to_depth(value.toInt());
if (updateMaxDepth())
- cylinders.model()->updateBestMixes();
+ cylinders.updateBestMixes();
}
break;
case RUNTIME:
@@ -346,8 +346,8 @@ bool DivePlannerPointsModel::setData(const QModelIndex &index, const QVariant &v
p.cylinderid = value.toInt();
/* Did we change the start (dp 0) cylinder to another cylinderid than 0? */
if (value.toInt() != 0 && index.row() == 0)
- cylinders.model()->moveAtFirst(value.toInt());
- cylinders.model()->updateTrashIcon();
+ cylinders.moveAtFirst(value.toInt());
+ cylinders.updateTrashIcon();
break;
case DIVEMODE:
if (value.toInt() < FREEDIVE) {
@@ -802,9 +802,9 @@ void DivePlannerPointsModel::editStop(int row, divedatapoint newData)
divepoints[row] = newData;
std::sort(divepoints.begin(), divepoints.end(), divePointsLessThan);
if (updateMaxDepth())
- cylinders.model()->updateBestMixes();
+ cylinders.updateBestMixes();
if (divepoints[0].cylinderid != old_first_cylid)
- cylinders.model()->moveAtFirst(divepoints[0].cylinderid);
+ cylinders.moveAtFirst(divepoints[0].cylinderid);
emitDataChanged();
}
@@ -853,9 +853,9 @@ void DivePlannerPointsModel::remove(const QModelIndex &index)
divepoints.remove(index.row());
}
endRemoveRows();
- cylinders.model()->updateTrashIcon();
+ cylinders.updateTrashIcon();
if (divepoints[0].cylinderid != old_first_cylid)
- cylinders.model()->moveAtFirst(divepoints[0].cylinderid);
+ cylinders.moveAtFirst(divepoints[0].cylinderid);
}
struct diveplan &DivePlannerPointsModel::getDiveplan()
diff --git a/qt-models/diveplannermodel.h b/qt-models/diveplannermodel.h
index 4dda5cc6e..4d0967a26 100644
--- a/qt-models/diveplannermodel.h
+++ b/qt-models/diveplannermodel.h
@@ -48,7 +48,7 @@ public:
bool tankInUse(int cylinderid);
void setupCylinders();
bool updateMaxDepth();
- CylindersModelFiltered *cylindersModel();
+ CylindersModel *cylindersModel();
int ascrate75Display();
int ascrate50Display();
@@ -129,7 +129,7 @@ private:
void computeVariations(struct diveplan *diveplan, const struct deco_state *ds);
void computeVariationsFreeDeco(struct diveplan *diveplan, struct deco_state *ds);
int analyzeVariations(struct decostop *min, struct decostop *mid, struct decostop *max, const char *unit);
- CylindersModelFiltered cylinders;
+ CylindersModel cylinders;
Mode mode;
bool recalc;
QVector<divedatapoint> divepoints;