summaryrefslogtreecommitdiffstats
path: root/qt-models/mobilelistmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models/mobilelistmodel.cpp')
-rw-r--r--qt-models/mobilelistmodel.cpp48
1 files changed, 27 insertions, 21 deletions
diff --git a/qt-models/mobilelistmodel.cpp b/qt-models/mobilelistmodel.cpp
index 87248ce3f..e679c72c6 100644
--- a/qt-models/mobilelistmodel.cpp
+++ b/qt-models/mobilelistmodel.cpp
@@ -2,21 +2,10 @@
#include "mobilelistmodel.h"
#include "core/divelist.h" // for shown_dives
-MobileListModel::MobileListModel(DiveTripModelBase *sourceIn) : source(sourceIn),
+MobileListModel::MobileListModel(DiveTripModelBase *sourceIn) :
+ source(sourceIn),
expandedRow(-1)
{
- connectSignals();
-}
-
-MobileListModel *MobileListModel::instance()
-{
- static DiveTripModelTree source;
- static MobileListModel self(&source);
- return &self;
-}
-
-void MobileListModel::connectSignals()
-{
connect(source, &DiveTripModelBase::modelAboutToBeReset, this, &MobileListModel::beginResetModel);
connect(source, &DiveTripModelBase::modelReset, this, &MobileListModel::endResetModel);
connect(source, &DiveTripModelBase::rowsAboutToBeRemoved, this, &MobileListModel::prepareRemove);
@@ -246,14 +235,6 @@ QVariant MobileListModel::data(const QModelIndex &index, int role) const
return source->data(mapToSource(index), role);
}
-void MobileListModel::resetModel()
-{
- beginResetModel();
- source->reset();
- connectSignals();
- endResetModel();
-}
-
// Trivial helper to return and erase the last element of a stack
template<typename T>
static T pop(std::vector<T> &v)
@@ -544,3 +525,28 @@ void MobileListModel::toggle(int row)
else
expand(row);
}
+MobileModels *MobileModels::instance()
+{
+ static MobileModels self;
+ return &self;
+}
+
+MobileModels::MobileModels() :
+ lm(&source)
+{
+}
+
+MobileListModel *MobileModels::listModel()
+{
+ return &lm;
+}
+
+void MobileModels::clear()
+{
+ source.clear();
+}
+
+void MobileModels::reset()
+{
+ source.reset();
+}