Bitcoin Core  21.99.0
P2P Digital Currency
transactionfilterproxy.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2020 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.
4 
5 #ifndef BITCOIN_QT_TRANSACTIONFILTERPROXY_H
6 #define BITCOIN_QT_TRANSACTIONFILTERPROXY_H
7 
8 #include <amount.h>
9 
10 #include <QDateTime>
11 #include <QSortFilterProxyModel>
12 
14 class TransactionFilterProxy : public QSortFilterProxyModel
15 {
16  Q_OBJECT
17 
18 public:
19  explicit TransactionFilterProxy(QObject *parent = nullptr);
20 
22  static const QDateTime MIN_DATE;
24  static const QDateTime MAX_DATE;
26  static const quint32 ALL_TYPES = 0xFFFFFFFF;
27 
28  static quint32 TYPE(int type) { return 1<<type; }
29 
31  {
35  };
36 
37  void setDateRange(const QDateTime &from, const QDateTime &to);
38  void setSearchString(const QString &);
42  void setTypeFilter(quint32 modes);
43  void setMinAmount(const CAmount& minimum);
45 
47  void setLimit(int limit);
48 
50  void setShowInactive(bool showInactive);
51 
52  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
53 
54 protected:
55  bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const override;
56 
57 private:
58  QDateTime dateFrom;
59  QDateTime dateTo;
60  QString m_search_string;
61  quint32 typeFilter;
64  int limitRows;
66 };
67 
68 #endif // BITCOIN_QT_TRANSACTIONFILTERPROXY_H
TransactionFilterProxy::setSearchString
void setSearchString(const QString &)
Definition: transactionfilterproxy.cpp:75
TransactionFilterProxy::dateTo
QDateTime dateTo
Definition: transactionfilterproxy.h:59
TransactionFilterProxy::WatchOnlyFilter_All
@ WatchOnlyFilter_All
Definition: transactionfilterproxy.h:32
TransactionFilterProxy::WatchOnlyFilter_No
@ WatchOnlyFilter_No
Definition: transactionfilterproxy.h:34
TransactionFilterProxy::MIN_DATE
static const QDateTime MIN_DATE
Earliest date that can be represented (far in the past)
Definition: transactionfilterproxy.h:22
TransactionFilterProxy::filterAcceptsRow
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
Definition: transactionfilterproxy.cpp:30
TransactionFilterProxy::setShowInactive
void setShowInactive(bool showInactive)
Set whether to show conflicted transactions.
Definition: transactionfilterproxy.cpp:105
TransactionFilterProxy::showInactive
bool showInactive
Definition: transactionfilterproxy.h:65
TransactionFilterProxy::setMinAmount
void setMinAmount(const CAmount &minimum)
Definition: transactionfilterproxy.cpp:88
CAmount
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
TransactionFilterProxy::setLimit
void setLimit(int limit)
Set maximum number of rows returned, -1 if unlimited.
Definition: transactionfilterproxy.cpp:100
TransactionFilterProxy::TYPE
static quint32 TYPE(int type)
Definition: transactionfilterproxy.h:28
TransactionFilterProxy::limitRows
int limitRows
Definition: transactionfilterproxy.h:64
TransactionFilterProxy::typeFilter
quint32 typeFilter
Definition: transactionfilterproxy.h:61
TransactionFilterProxy::setTypeFilter
void setTypeFilter(quint32 modes)
Definition: transactionfilterproxy.cpp:82
TransactionFilterProxy::setWatchOnlyFilter
void setWatchOnlyFilter(WatchOnlyFilter filter)
Definition: transactionfilterproxy.cpp:94
TransactionFilterProxy::MAX_DATE
static const QDateTime MAX_DATE
Last date that can be represented (far in the future)
Definition: transactionfilterproxy.h:24
TransactionFilterProxy::m_search_string
QString m_search_string
Definition: transactionfilterproxy.h:60
TransactionFilterProxy::setDateRange
void setDateRange(const QDateTime &from, const QDateTime &to)
Definition: transactionfilterproxy.cpp:68
TransactionFilterProxy::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition: transactionfilterproxy.cpp:111
TransactionFilterProxy::WatchOnlyFilter_Yes
@ WatchOnlyFilter_Yes
Definition: transactionfilterproxy.h:33
TransactionFilterProxy::TransactionFilterProxy
TransactionFilterProxy(QObject *parent=nullptr)
Definition: transactionfilterproxy.cpp:17
TransactionFilterProxy::WatchOnlyFilter
WatchOnlyFilter
Definition: transactionfilterproxy.h:30
TransactionFilterProxy::watchOnlyFilter
WatchOnlyFilter watchOnlyFilter
Definition: transactionfilterproxy.h:62
amount.h
TransactionFilterProxy::minAmount
CAmount minAmount
Definition: transactionfilterproxy.h:63
TransactionFilterProxy::ALL_TYPES
static const quint32 ALL_TYPES
Type filter bit field (all types)
Definition: transactionfilterproxy.h:26
TransactionFilterProxy::dateFrom
QDateTime dateFrom
Definition: transactionfilterproxy.h:58
TransactionFilterProxy
Filter the transaction list according to pre-specified rules.
Definition: transactionfilterproxy.h:14