summaryrefslogtreecommitdiffstats
path: root/qt-models/filtermodels.h
blob: d279470b151496121cf2d06db2f16414a43d61c6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// 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