]>
Commit | Line | Data |
---|---|---|
ceb6d4e1 WL |
1 | #ifndef TRANSACTIONFILTERPROXY_H |
2 | #define TRANSACTIONFILTERPROXY_H | |
3 | ||
4 | #include <QSortFilterProxyModel> | |
5 | #include <QDateTime> | |
6 | ||
af836ad5 | 7 | /** Filter the transaction list according to pre-specified rules. */ |
ceb6d4e1 WL |
8 | class TransactionFilterProxy : public QSortFilterProxyModel |
9 | { | |
10 | Q_OBJECT | |
11 | public: | |
12 | explicit TransactionFilterProxy(QObject *parent = 0); | |
13 | ||
af836ad5 | 14 | /** Earliest date that can be represented (far in the past) */ |
ceb6d4e1 | 15 | static const QDateTime MIN_DATE; |
af836ad5 | 16 | /** Last date that can be represented (far in the future) */ |
ceb6d4e1 | 17 | static const QDateTime MAX_DATE; |
af836ad5 | 18 | /** Type filter bit field (all types) */ |
ceb6d4e1 WL |
19 | static const quint32 ALL_TYPES = 0xFFFFFFFF; |
20 | ||
21 | static quint32 TYPE(int type) { return 1<<type; } | |
22 | ||
23 | void setDateRange(const QDateTime &from, const QDateTime &to); | |
24 | void setAddressPrefix(const QString &addrPrefix); | |
af836ad5 | 25 | /** |
814efd6f | 26 | @note Type filter takes a bit field created with TYPE() or ALL_TYPES |
af836ad5 | 27 | */ |
ceb6d4e1 WL |
28 | void setTypeFilter(quint32 modes); |
29 | void setMinAmount(qint64 minimum); | |
30 | ||
af836ad5 | 31 | /** Set maximum number of rows returned, -1 if unlimited. */ |
a99ac8d3 WL |
32 | void setLimit(int limit); |
33 | ||
b985efaa | 34 | int rowCount(const QModelIndex &parent = QModelIndex()) const; |
ceb6d4e1 WL |
35 | protected: |
36 | bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const; | |
37 | ||
38 | private: | |
39 | QDateTime dateFrom; | |
40 | QDateTime dateTo; | |
41 | QString addrPrefix; | |
42 | quint32 typeFilter; | |
43 | qint64 minAmount; | |
a99ac8d3 | 44 | int limitRows; |
ceb6d4e1 WL |
45 | |
46 | signals: | |
47 | ||
48 | public slots: | |
49 | ||
50 | }; | |
51 | ||
52 | #endif // TRANSACTIONFILTERPROXY_H |