2018-07-27 00:36:45 +02:00
|
|
|
// Copyright (c) 2011-2018 The Bitcoin Core developers
|
2014-12-13 05:09:33 +01:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
2013-11-04 16:20:43 +01:00
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2014-11-03 16:16:40 +01:00
|
|
|
#ifndef BITCOIN_QT_TRANSACTIONFILTERPROXY_H
|
|
|
|
#define BITCOIN_QT_TRANSACTIONFILTERPROXY_H
|
2011-06-28 21:41:56 +02:00
|
|
|
|
2017-11-10 01:57:53 +01:00
|
|
|
#include <amount.h>
|
2014-04-23 00:46:19 +02:00
|
|
|
|
2011-06-28 21:41:56 +02:00
|
|
|
#include <QDateTime>
|
2013-04-13 07:13:08 +02:00
|
|
|
#include <QSortFilterProxyModel>
|
2011-06-28 21:41:56 +02:00
|
|
|
|
2011-11-13 13:19:52 +01:00
|
|
|
/** Filter the transaction list according to pre-specified rules. */
|
2011-06-28 21:41:56 +02:00
|
|
|
class TransactionFilterProxy : public QSortFilterProxyModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2013-01-23 21:51:02 +01:00
|
|
|
|
2011-06-28 21:41:56 +02:00
|
|
|
public:
|
2018-07-30 12:37:09 +02:00
|
|
|
explicit TransactionFilterProxy(QObject *parent = nullptr);
|
2011-06-28 21:41:56 +02:00
|
|
|
|
2011-11-13 13:19:52 +01:00
|
|
|
/** Earliest date that can be represented (far in the past) */
|
2011-06-28 21:41:56 +02:00
|
|
|
static const QDateTime MIN_DATE;
|
2011-11-13 13:19:52 +01:00
|
|
|
/** Last date that can be represented (far in the future) */
|
2011-06-28 21:41:56 +02:00
|
|
|
static const QDateTime MAX_DATE;
|
2011-11-13 13:19:52 +01:00
|
|
|
/** Type filter bit field (all types) */
|
2011-06-28 21:41:56 +02:00
|
|
|
static const quint32 ALL_TYPES = 0xFFFFFFFF;
|
|
|
|
|
|
|
|
static quint32 TYPE(int type) { return 1<<type; }
|
|
|
|
|
2014-08-10 02:26:04 +02:00
|
|
|
enum WatchOnlyFilter
|
|
|
|
{
|
|
|
|
WatchOnlyFilter_All,
|
|
|
|
WatchOnlyFilter_Yes,
|
|
|
|
WatchOnlyFilter_No
|
|
|
|
};
|
|
|
|
|
2011-06-28 21:41:56 +02:00
|
|
|
void setDateRange(const QDateTime &from, const QDateTime &to);
|
2017-09-25 06:13:27 +02:00
|
|
|
void setSearchString(const QString &);
|
2011-11-13 13:19:52 +01:00
|
|
|
/**
|
2012-07-26 02:48:39 +02:00
|
|
|
@note Type filter takes a bit field created with TYPE() or ALL_TYPES
|
2011-11-13 13:19:52 +01:00
|
|
|
*/
|
2011-06-28 21:41:56 +02:00
|
|
|
void setTypeFilter(quint32 modes);
|
2014-04-23 00:46:19 +02:00
|
|
|
void setMinAmount(const CAmount& minimum);
|
2014-08-10 02:26:04 +02:00
|
|
|
void setWatchOnlyFilter(WatchOnlyFilter filter);
|
2011-06-28 21:41:56 +02:00
|
|
|
|
2011-11-13 13:19:52 +01:00
|
|
|
/** Set maximum number of rows returned, -1 if unlimited. */
|
2011-08-03 20:52:18 +02:00
|
|
|
void setLimit(int limit);
|
|
|
|
|
2014-02-14 07:59:07 +01:00
|
|
|
/** Set whether to show conflicted transactions. */
|
|
|
|
void setShowInactive(bool showInactive);
|
|
|
|
|
2012-01-14 12:14:36 +01:00
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
2013-01-23 21:51:02 +01:00
|
|
|
|
2011-06-28 21:41:56 +02:00
|
|
|
protected:
|
|
|
|
bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QDateTime dateFrom;
|
|
|
|
QDateTime dateTo;
|
2017-09-25 06:13:27 +02:00
|
|
|
QString m_search_string;
|
2011-06-28 21:41:56 +02:00
|
|
|
quint32 typeFilter;
|
2014-08-10 02:26:04 +02:00
|
|
|
WatchOnlyFilter watchOnlyFilter;
|
2014-04-23 00:46:19 +02:00
|
|
|
CAmount minAmount;
|
2011-08-03 20:52:18 +02:00
|
|
|
int limitRows;
|
2014-02-14 07:59:07 +01:00
|
|
|
bool showInactive;
|
2011-06-28 21:41:56 +02:00
|
|
|
};
|
|
|
|
|
2014-11-03 16:16:40 +01:00
|
|
|
#endif // BITCOIN_QT_TRANSACTIONFILTERPROXY_H
|