From b76f2071589d6a7f45ec2845afa8b49110da608b Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 17 Nov 2019 18:13:55 +0100 Subject: Filter: split out filter from model Split out the actual filtering from the MultiFilterSortModel. Create a DiveFilter class that does the actual filtering. Currently, mobile and desktop have their own version of this class, though ultimately we may want to merge them. The idea here is that the trip-model and undo-commands have direct access to the filter-function and thus can take care of keeping track of the number of shown dives, etc. Signed-off-by: Berthold Stoeger --- desktop-widgets/tab-widgets/TabDiveSite.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'desktop-widgets/tab-widgets/TabDiveSite.cpp') diff --git a/desktop-widgets/tab-widgets/TabDiveSite.cpp b/desktop-widgets/tab-widgets/TabDiveSite.cpp index d5591c152..3ff693e59 100644 --- a/desktop-widgets/tab-widgets/TabDiveSite.cpp +++ b/desktop-widgets/tab-widgets/TabDiveSite.cpp @@ -2,8 +2,8 @@ #include "TabDiveSite.h" #include "core/subsurface-qt/DiveListNotifier.h" #include "core/divesite.h" +#include "core/divefilter.h" #include "qt-models/divelocationmodel.h" -#include "qt-models/filtermodels.h" #include "commands/command.h" #include @@ -97,18 +97,18 @@ QVector TabDiveSite::selectedDiveSites() void TabDiveSite::selectionChanged(const QItemSelection &, const QItemSelection &) { - MultiFilterSortModel::instance()->setFilterDiveSite(selectedDiveSites()); + DiveFilter::instance()->setFilterDiveSite(selectedDiveSites()); } void TabDiveSite::showEvent(QShowEvent *) { // If the user switches to the dive site tab and there was already a selection, // filter on that selection. - MultiFilterSortModel::instance()->startFilterDiveSites(selectedDiveSites()); + DiveFilter::instance()->startFilterDiveSites(selectedDiveSites()); } void TabDiveSite::hideEvent(QHideEvent *) { // If the user switches to a different tab, stop the dive site filtering - MultiFilterSortModel::instance()->stopFilterDiveSites(); + DiveFilter::instance()->stopFilterDiveSites(); } -- cgit v1.2.3-70-g09d2