From 358fddd24e03d8f4522b108b28931a1227749831 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 9 Dec 2019 15:13:53 +0100 Subject: Filter: send filterReset via signal The old code called directly into the DiveListModel. Instead, send a signal and hook into the signal from the model. This will allow us to remove the DiveListModel::instance() function. This, in turn, is a step towards supporting multiple models at the same time. However, currently the model manually sets the hidden_by_filter flag in the core and therefore only one active model is supported at a time. Signed-off-by: Berthold Stoeger --- core/divefilter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core') diff --git a/core/divefilter.cpp b/core/divefilter.cpp index 230e8347d..bf9ce1046 100644 --- a/core/divefilter.cpp +++ b/core/divefilter.cpp @@ -193,7 +193,7 @@ void DiveFilter::startFilterDiveSites(QVector 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(); - DiveTripModelBase::instance()->recalculateFilter(); + emit diveListNotifier.filterReset(); } } @@ -202,7 +202,7 @@ void DiveFilter::stopFilterDiveSites() if (--diveSiteRefCount > 0) return; dive_sites.clear(); - DiveTripModelBase::instance()->recalculateFilter(); + emit diveListNotifier.filterReset(); MapWidget::instance()->reload(); } @@ -215,7 +215,7 @@ void DiveFilter::setFilterDiveSite(QVector ds) return; dive_sites = ds; - DiveTripModelBase::instance()->recalculateFilter(); + emit diveListNotifier.filterReset(); 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; - DiveTripModelBase::instance()->recalculateFilter(); + emit diveListNotifier.filterReset(); } #endif // SUBSURFACE_MOBILE -- cgit v1.2.3-70-g09d2