2013-11-04 16:20:43 +01:00
|
|
|
// Copyright (c) 2011-2013 The Bitcoin developers
|
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2011-06-28 21:41:56 +02:00
|
|
|
#ifndef TRANSACTIONFILTERPROXY_H
|
|
|
|
#define TRANSACTIONFILTERPROXY_H
|
|
|
|
|
|
|
|
#include <QSortFilterProxyModel>
|
|
|
|
#include <QDateTime>
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
static quint32 TYPE(int type) { return 1<<type; }
|
|
|
|
|
|
|
|
void setDateRange(const QDateTime &from, const QDateTime &to);
|
|
|
|
void setAddressPrefix(const QString &addrPrefix);
|
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);
|
|
|
|
void setMinAmount(qint64 minimum);
|
|
|
|
|
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);
|
|
|
|
|
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;
|
|
|
|
QString addrPrefix;
|
|
|
|
quint32 typeFilter;
|
|
|
|
qint64 minAmount;
|
2011-08-03 20:52:18 +02:00
|
|
|
int limitRows;
|
2011-06-28 21:41:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TRANSACTIONFILTERPROXY_H
|