Merge #10114: [tests] sync_with_ping should assert that ping hasn't timed out
[bitcoinplatinum.git] / src / qt / transactionfilterproxy.h
blob7db02cd61f82a592324dc925c989cb6b99fbb74c
1 // Copyright (c) 2011-2014 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 #ifndef BITCOIN_QT_TRANSACTIONFILTERPROXY_H
6 #define BITCOIN_QT_TRANSACTIONFILTERPROXY_H
8 #include "amount.h"
10 #include <QDateTime>
11 #include <QSortFilterProxyModel>
13 /** Filter the transaction list according to pre-specified rules. */
14 class TransactionFilterProxy : public QSortFilterProxyModel
16 Q_OBJECT
18 public:
19 explicit TransactionFilterProxy(QObject *parent = 0);
21 /** Earliest date that can be represented (far in the past) */
22 static const QDateTime MIN_DATE;
23 /** Last date that can be represented (far in the future) */
24 static const QDateTime MAX_DATE;
25 /** Type filter bit field (all types) */
26 static const quint32 ALL_TYPES = 0xFFFFFFFF;
28 static quint32 TYPE(int type) { return 1<<type; }
30 enum WatchOnlyFilter
32 WatchOnlyFilter_All,
33 WatchOnlyFilter_Yes,
34 WatchOnlyFilter_No
37 void setDateRange(const QDateTime &from, const QDateTime &to);
38 void setAddressPrefix(const QString &addrPrefix);
39 /**
40 @note Type filter takes a bit field created with TYPE() or ALL_TYPES
42 void setTypeFilter(quint32 modes);
43 void setMinAmount(const CAmount& minimum);
44 void setWatchOnlyFilter(WatchOnlyFilter filter);
46 /** Set maximum number of rows returned, -1 if unlimited. */
47 void setLimit(int limit);
49 /** Set whether to show conflicted transactions. */
50 void setShowInactive(bool showInactive);
52 int rowCount(const QModelIndex &parent = QModelIndex()) const;
54 protected:
55 bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const;
57 private:
58 QDateTime dateFrom;
59 QDateTime dateTo;
60 QString addrPrefix;
61 quint32 typeFilter;
62 WatchOnlyFilter watchOnlyFilter;
63 CAmount minAmount;
64 int limitRows;
65 bool showInactive;
68 #endif // BITCOIN_QT_TRANSACTIONFILTERPROXY_H