2016-01-27 12:05:25 +01:00
|
|
|
// Copyright (c) 2011-2014 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
|
|
|
|
2014-04-23 00:46:19 +02:00
|
|
|
#include "amount.h"
|
|
|
|
|
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:
|
|
|
|
explicit TransactionFilterProxy(QObject *parent = 0);
|
|
|
|
|
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;
|
2015-04-29 23:46:53 +02:00
|
|
|
/** Type filter bit field (all types but Darksend-SPAM) */
|
2015-05-16 01:34:25 +02:00
|
|
|
static const quint32 COMMON_TYPES = 4223;
|
2011-06-28 21:41:56 +02:00
|
|
|
|
|
|
|
static quint32 TYPE(int type) { return 1<<type; }
|
|
|
|
|
2014-08-10 02:26:04 +02:00
|
|
|
enum WatchOnlyFilter
|
|
|
|
{
|
|
|
|
WatchOnlyFilter_All,
|
|
|
|
WatchOnlyFilter_Yes,
|
|
|
|
WatchOnlyFilter_No
|
|
|
|
};
|
|
|
|
|
2018-11-12 16:08:31 +01:00
|
|
|
enum InstantSendFilter
|
|
|
|
{
|
|
|
|
InstantSendFilter_All,
|
|
|
|
InstantSendFilter_Yes,
|
|
|
|
InstantSendFilter_No
|
|
|
|
};
|
|
|
|
|
2011-06-28 21:41:56 +02:00
|
|
|
void setDateRange(const QDateTime &from, const QDateTime &to);
|
2017-11-30 00:50:30 +01: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);
|
2018-11-12 16:08:31 +01:00
|
|
|
void setInstantSendFilter(InstantSendFilter 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:
|
2019-10-19 12:39:02 +02:00
|
|
|
qint64 dateFrom;
|
|
|
|
qint64 dateTo;
|
2017-11-30 00:50:30 +01: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;
|
2018-11-12 16:08:31 +01:00
|
|
|
InstantSendFilter instantsendFilter;
|
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
|