summaryrefslogtreecommitdiffstats
path: root/qt-models/filtermodels.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2017-12-23 14:55:59 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-12-24 08:24:11 -0800
commit7eed752ba15bcb152d448868d2d291abde8748aa (patch)
treede02deb7f775f65082a650da37cc9cee195ec8e2 /qt-models/filtermodels.h
parent1a4e7ad0dd29b9eeac2016933cb86bff260dadbb (diff)
downloadsubsurface-7eed752ba15bcb152d448868d2d291abde8748aa.tar.gz
Fold MultiFilterInterface into FilterModelBase
There were two classes, MultiFilterInterface and FiterModelBase. The latter derives from the former and from QStringListModel. The former was not used anywhere else. Moreover, in contradiction to its name, MultiFilterInterface is not an interface (in the Java sense), because it actually has (non-virtual) data members. All in all, the data model is very weird. Merge these two classes, since there seems to be no gain whatsoever from keeping MultiFilterInterface separate. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/filtermodels.h')
-rw-r--r--qt-models/filtermodels.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/qt-models/filtermodels.h b/qt-models/filtermodels.h
index 671ac1d19..b7d65aae2 100644
--- a/qt-models/filtermodels.h
+++ b/qt-models/filtermodels.h
@@ -7,16 +7,12 @@
#include <stdint.h>
#include <vector>
-class MultiFilterInterface {
+class FilterModelBase : public QStringListModel {
public:
- MultiFilterInterface() : anyChecked(false) {}
virtual bool doFilter(struct dive *d, QModelIndex &index0, QAbstractItemModel *sourceModel) const = 0;
virtual void clearFilter() = 0;
std::vector<char> checkState;
bool anyChecked;
-};
-
-class FilterModelBase : public QStringListModel, public MultiFilterInterface {
protected:
explicit FilterModelBase(QObject *parent = 0);
void updateList(const QStringList &new_list);
@@ -97,8 +93,8 @@ class MultiFilterSortModel : public QSortFilterProxyModel {
public:
static MultiFilterSortModel *instance();
virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
- void addFilterModel(MultiFilterInterface *model);
- void removeFilterModel(MultiFilterInterface *model);
+ void addFilterModel(FilterModelBase *model);
+ void removeFilterModel(FilterModelBase *model);
int divesDisplayed;
public
slots:
@@ -111,7 +107,7 @@ signals:
void filterFinished();
private:
MultiFilterSortModel(QObject *parent = 0);
- QList<MultiFilterInterface *> models;
+ QList<FilterModelBase *> models;
bool justCleared;
struct dive_site *curr_dive_site;
};