Bitcoin Core  22.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 
13 #include <optional>
14 
16 class TransactionFilterProxy : public QSortFilterProxyModel
17 {
18  Q_OBJECT
19 
20 public:
21  explicit TransactionFilterProxy(QObject *parent = nullptr);
22 
24  static const quint32 ALL_TYPES = 0xFFFFFFFF;
25 
26  static quint32 TYPE(int type) { return 1<<type; }
27 
29  {
33  };
34 
36  void setDateRange(const std::optional<QDateTime>& from, const std::optional<QDateTime>& to);
37  void setSearchString(const QString &);
41  void setTypeFilter(quint32 modes);
42  void setMinAmount(const CAmount& minimum);
44 
46  void setLimit(int limit);
47 
49  void setShowInactive(bool showInactive);
50 
51  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
52 
53 protected:
54  bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const override;
55 
56 private:
57  std::optional<QDateTime> dateFrom;
58  std::optional<QDateTime> dateTo;
59  QString m_search_string;
60  quint32 typeFilter;
63  int limitRows;
65 };
66 
67 #endif // BITCOIN_QT_TRANSACTIONFILTERPROXY_H
TransactionFilterProxy::setDateRange
void setDateRange(const std::optional< QDateTime > &from, const std::optional< QDateTime > &to)
Filter transactions between date range.
Definition: transactionfilterproxy.cpp:63
TransactionFilterProxy::setSearchString
void setSearchString(const QString &)
Definition: transactionfilterproxy.cpp:70
TransactionFilterProxy::WatchOnlyFilter_All
@ WatchOnlyFilter_All
Definition: transactionfilterproxy.h:30
TransactionFilterProxy::WatchOnlyFilter_No
@ WatchOnlyFilter_No
Definition: transactionfilterproxy.h:32
TransactionFilterProxy::filterAcceptsRow
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
Definition: transactionfilterproxy.cpp:25
TransactionFilterProxy::setShowInactive
void setShowInactive(bool showInactive)
Set whether to show conflicted transactions.
Definition: transactionfilterproxy.cpp:100
TransactionFilterProxy::showInactive
bool showInactive
Definition: transactionfilterproxy.h:64
TransactionFilterProxy::setMinAmount
void setMinAmount(const CAmount &minimum)
Definition: transactionfilterproxy.cpp:83
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:95
TransactionFilterProxy::TYPE
static quint32 TYPE(int type)
Definition: transactionfilterproxy.h:26
TransactionFilterProxy::limitRows
int limitRows
Definition: transactionfilterproxy.h:63
TransactionFilterProxy::typeFilter
quint32 typeFilter
Definition: transactionfilterproxy.h:60
TransactionFilterProxy::setTypeFilter
void setTypeFilter(quint32 modes)
Definition: transactionfilterproxy.cpp:77
TransactionFilterProxy::setWatchOnlyFilter
void setWatchOnlyFilter(WatchOnlyFilter filter)
Definition: transactionfilterproxy.cpp:89
TransactionFilterProxy::m_search_string
QString m_search_string
Definition: transactionfilterproxy.h:59
TransactionFilterProxy::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition: transactionfilterproxy.cpp:106
TransactionFilterProxy::WatchOnlyFilter_Yes
@ WatchOnlyFilter_Yes
Definition: transactionfilterproxy.h:31
TransactionFilterProxy::TransactionFilterProxy
TransactionFilterProxy(QObject *parent=nullptr)
Definition: transactionfilterproxy.cpp:14
TransactionFilterProxy::WatchOnlyFilter
WatchOnlyFilter
Definition: transactionfilterproxy.h:28
TransactionFilterProxy::dateFrom
std::optional< QDateTime > dateFrom
Definition: transactionfilterproxy.h:57
TransactionFilterProxy::watchOnlyFilter
WatchOnlyFilter watchOnlyFilter
Definition: transactionfilterproxy.h:61
amount.h
TransactionFilterProxy::minAmount
CAmount minAmount
Definition: transactionfilterproxy.h:62
TransactionFilterProxy::dateTo
std::optional< QDateTime > dateTo
Definition: transactionfilterproxy.h:58
TransactionFilterProxy::ALL_TYPES
static const quint32 ALL_TYPES
Type filter bit field (all types)
Definition: transactionfilterproxy.h:24
TransactionFilterProxy
Filter the transaction list according to pre-specified rules.
Definition: transactionfilterproxy.h:16