From 6d6d10f03a92a9bac5394fc226c398af61f29d66 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 17 Nov 2019 17:41:23 +0100 Subject: Filter: move calculation of shown dives to undo command The filter-model was catching dives-added / dives-deleted signals from the models to keep track of the number of shown dives. To simplify the data flow, do this directly in the undo-command. Signed-off-by: Berthold Stoeger --- qt-models/filtermodels.cpp | 21 --------------------- qt-models/filtermodels.h | 2 -- 2 files changed, 23 deletions(-) (limited to 'qt-models') diff --git a/qt-models/filtermodels.cpp b/qt-models/filtermodels.cpp index 7a1a8af7d..9736d3335 100644 --- a/qt-models/filtermodels.cpp +++ b/qt-models/filtermodels.cpp @@ -111,9 +111,6 @@ MultiFilterSortModel::MultiFilterSortModel(QObject *parent) : QSortFilterProxyMo { setFilterKeyColumn(-1); // filter all columns setFilterCaseSensitivity(Qt::CaseInsensitive); - - connect(&diveListNotifier, &DiveListNotifier::divesAdded, this, &MultiFilterSortModel::divesAdded); - connect(&diveListNotifier, &DiveListNotifier::divesDeleted, this, &MultiFilterSortModel::divesDeleted); } void MultiFilterSortModel::resetModel(DiveTripModelBase::Layout layout) @@ -343,24 +340,6 @@ void MultiFilterSortModel::filterDataChanged(const FilterData &data) myInvalidate(); } -void MultiFilterSortModel::divesAdded(dive_trip *, bool, const QVector &dives) -{ - for (dive *d: dives) { - if (!d->hidden_by_filter) - ++shown_dives; - } - countsChanged(); -} - -void MultiFilterSortModel::divesDeleted(dive_trip *, bool, const QVector &dives) -{ - for (dive *d: dives) { - if (!d->hidden_by_filter) - --shown_dives; - } - countsChanged(); -} - void MultiFilterSortModel::countsChanged() { updateWindowTitle(); diff --git a/qt-models/filtermodels.h b/qt-models/filtermodels.h index a3397dde6..d4a03d134 100644 --- a/qt-models/filtermodels.h +++ b/qt-models/filtermodels.h @@ -72,8 +72,6 @@ slots: void stopFilterDiveSites(); void resetModel(DiveTripModelBase::Layout layout); void filterDataChanged(const FilterData &data); - void divesAdded(struct dive_trip *, bool, const QVector &dives); - void divesDeleted(struct dive_trip *, bool, const QVector &dives); signals: void filterFinished(); -- cgit v1.2.3-70-g09d2