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 --- commands/command_divelist.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'commands') diff --git a/commands/command_divelist.cpp b/commands/command_divelist.cpp index 9943651eb..4fabac9fc 100644 --- a/commands/command_divelist.cpp +++ b/commands/command_divelist.cpp @@ -8,6 +8,7 @@ #include "core/subsurface-qt/DiveListNotifier.h" #include "qt-models/filtermodels.h" #include "../profile-widget/profilewidget2.h" +#include "core/divefilter.h" #include @@ -68,7 +69,7 @@ dive *DiveListBase::addDive(DiveToAdd &d) dive *res = d.dive.release(); // Give up ownership of dive // Set the filter flag according to current filter settings - bool show = MultiFilterSortModel::instance()->showDive(res); + bool show = DiveFilter::instance()->showDive(res); res->hidden_by_filter = !show; if (show) ++shown_dives; -- cgit v1.2.3-70-g09d2