Implement filter row instead of tabs, allows for more expressive filters
[novacoin.git] / src / qt / transactionfilterproxy.h
1 #ifndef TRANSACTIONFILTERPROXY_H
2 #define TRANSACTIONFILTERPROXY_H
3
4 #include <QSortFilterProxyModel>
5 #include <QDateTime>
6
7 // Filter transaction list according to pre-specified rules
8 class TransactionFilterProxy : public QSortFilterProxyModel
9 {
10     Q_OBJECT
11 public:
12     explicit TransactionFilterProxy(QObject *parent = 0);
13
14     // Earliest date that can be represented (far in the past)
15     static const QDateTime MIN_DATE;
16     // Last date that can be represented (far in the future)
17     static const QDateTime MAX_DATE;
18     // Type filter bit field (all types)
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);
25     // Type filter takes a bitfield created with TYPE() or ALL_TYPES
26     void setTypeFilter(quint32 modes);
27     void setMinAmount(qint64 minimum);
28
29 protected:
30     bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const;
31
32 private:
33     QDateTime dateFrom;
34     QDateTime dateTo;
35     QString addrPrefix;
36     quint32 typeFilter;
37     qint64 minAmount;
38
39 signals:
40
41 public slots:
42
43 };
44
45 #endif // TRANSACTIONFILTERPROXY_H