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