summaryrefslogtreecommitdiffstats
path: root/qt-models/divetripmodel.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-12-09 15:37:26 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-10 18:45:30 -0800
commit6ec82a3c80e0f362abc59a6df8ea793013f01c65 (patch)
treef381e928ccbc788b8302b0404f14bcb04af40de9 /qt-models/divetripmodel.cpp
parent0f417a3bc1f282b34509df1c9295197522344a55 (diff)
downloadsubsurface-6ec82a3c80e0f362abc59a6df8ea793013f01c65.tar.gz
Dive list: remove global pointer to DiveTrip model
This part of the code had that horrible pattern, where reseting the model would invalidate all pointers to the DiveTrip model. Internalize these complexities in the MultiFilterSortModel. All accesses are now performed via that proxy model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/divetripmodel.cpp')
-rw-r--r--qt-models/divetripmodel.cpp16
1 files changed, 0 insertions, 16 deletions
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp
index ae6dfe651..64bb28533 100644
--- a/qt-models/divetripmodel.cpp
+++ b/qt-models/divetripmodel.cpp
@@ -357,22 +357,6 @@ QVariant DiveTripModelBase::headerData(int section, Qt::Orientation orientation,
return QVariant();
}
-static std::unique_ptr<DiveTripModelBase> currentModel;
-DiveTripModelBase *DiveTripModelBase::instance()
-{
- if (!currentModel)
- resetModel(TREE);
- return currentModel.get();
-}
-
-void DiveTripModelBase::resetModel(DiveTripModelBase::Layout layout)
-{
- if (layout == TREE)
- currentModel.reset(new DiveTripModelTree);
- else
- currentModel.reset(new DiveTripModelList);
-}
-
// After resetting the model, the higher up model or view may call this
// function to get informed on the current selection.
// TODO: Currently, this reads and resets the selection. Make this more