aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-11-17 19:53:18 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-11-19 21:13:40 -0800
commit3003c6e1eed330978193d6859eca2f79ee68aa54 (patch)
tree1baeb54aeca0eda10d273779cf3704095a170d2e /core
parent9ffafbc326b38bd2d0bb870fa4721b6c94280c28 (diff)
downloadsubsurface-3003c6e1eed330978193d6859eca2f79ee68aa54.tar.gz
Filter: move recalculation of filter from FilterModel to TripModel
The way this was accessed via Qt's model semantics was horrible. This gives arguably more readable code, since we don't have to shoehorn things through QVariants. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core')
-rw-r--r--core/divefilter.cpp8
-rw-r--r--core/subsurface-qt/DiveListNotifier.h1
2 files changed, 5 insertions, 4 deletions
diff --git a/core/divefilter.cpp b/core/divefilter.cpp
index 0b0e446d0..230e8347d 100644
--- a/core/divefilter.cpp
+++ b/core/divefilter.cpp
@@ -193,7 +193,7 @@ void DiveFilter::startFilterDiveSites(QVector<dive_site *> ds)
// When switching into dive site mode, reload the dive sites.
// We won't do this in myInvalidate() once we are in dive site mode.
MapWidget::instance()->reload();
- MultiFilterSortModel::instance()->myInvalidate();
+ DiveTripModelBase::instance()->recalculateFilter();
}
}
@@ -202,7 +202,7 @@ void DiveFilter::stopFilterDiveSites()
if (--diveSiteRefCount > 0)
return;
dive_sites.clear();
- MultiFilterSortModel::instance()->myInvalidate();
+ DiveTripModelBase::instance()->recalculateFilter();
MapWidget::instance()->reload();
}
@@ -215,7 +215,7 @@ void DiveFilter::setFilterDiveSite(QVector<dive_site *> ds)
return;
dive_sites = ds;
- MultiFilterSortModel::instance()->myInvalidate();
+ DiveTripModelBase::instance()->recalculateFilter();
MapWidget::instance()->setSelected(dive_sites);
MainWindow::instance()->diveList->expandAll();
}
@@ -233,6 +233,6 @@ bool DiveFilter::diveSiteMode() const
void DiveFilter::setFilter(const FilterData &data)
{
filterData = data;
- MultiFilterSortModel::instance()->myInvalidate();
+ DiveTripModelBase::instance()->recalculateFilter();
}
#endif // SUBSURFACE_MOBILE
diff --git a/core/subsurface-qt/DiveListNotifier.h b/core/subsurface-qt/DiveListNotifier.h
index 475f2ddbe..e63738512 100644
--- a/core/subsurface-qt/DiveListNotifier.h
+++ b/core/subsurface-qt/DiveListNotifier.h
@@ -94,6 +94,7 @@ signals:
// Filter-related signals
void numShownChanged();
+ void filterReset();
// This signal is emited every time a command is executed.
// This is used to hide an old multi-dives-edited warning message.