subsurface/qt-models/filtermodels.h
Berthold Stoeger b76f207158 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 <bstoeger@mail.tuwien.ac.at>
2019-11-19 21:13:40 -08:00

34 lines
847 B
C++

// SPDX-License-Identifier: GPL-2.0
#ifndef FILTERMODELS_H
#define FILTERMODELS_H
#include "divetripmodel.h"
#include <QStringListModel>
#include <QSortFilterProxyModel>
#include <QDateTime>
#include <stdint.h>
#include <vector>
class MultiFilterSortModel : public QSortFilterProxyModel {
Q_OBJECT
public:
static MultiFilterSortModel *instance();
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
bool updateDive(struct dive *d); // returns true if visibility status changed
bool lessThan(const QModelIndex &, const QModelIndex &) const override;
void resetModel(DiveTripModelBase::Layout layout);
void myInvalidate();
signals:
void filterFinished();
private:
MultiFilterSortModel(QObject *parent = 0);
// Dive site filtering has priority over other filters
void countsChanged();
};
#endif