lbrycrd/src/qt/transactionfilterproxy.h

69 lines
2 KiB
C
Raw Normal View History

// Copyright (c) 2011-2017 The Bitcoin Core developers
2014-12-13 05:09:33 +01:00
// Distributed under the MIT software license, see the accompanying
// 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
#include <amount.h>
2014-04-23 00:46:19 +02:00
#include <QDateTime>
#include <QSortFilterProxyModel>
2011-11-13 13:19:52 +01:00
/** Filter the transaction list according to pre-specified rules. */
class TransactionFilterProxy : public QSortFilterProxyModel
{
Q_OBJECT
public:
explicit TransactionFilterProxy(QObject *parent = 0);
2011-11-13 13:19:52 +01:00
/** Earliest date that can be represented (far in the past) */
static const QDateTime MIN_DATE;
2011-11-13 13:19:52 +01:00
/** Last date that can be represented (far in the future) */
static const QDateTime MAX_DATE;
2011-11-13 13:19:52 +01:00
/** Type filter bit field (all types) */
static const quint32 ALL_TYPES = 0xFFFFFFFF;
static quint32 TYPE(int type) { return 1<<type; }
enum WatchOnlyFilter
{
WatchOnlyFilter_All,
WatchOnlyFilter_Yes,
WatchOnlyFilter_No
};
void setDateRange(const QDateTime &from, const QDateTime &to);
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
*/
void setTypeFilter(quint32 modes);
2014-04-23 00:46:19 +02:00
void setMinAmount(const CAmount& minimum);
void setWatchOnlyFilter(WatchOnlyFilter filter);
2011-11-13 13:19:52 +01:00
/** Set maximum number of rows returned, -1 if unlimited. */
void setLimit(int limit);
/** Set whether to show conflicted transactions. */
void setShowInactive(bool showInactive);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
protected:
bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const;
private:
QDateTime dateFrom;
QDateTime dateTo;
QString m_search_string;
quint32 typeFilter;
WatchOnlyFilter watchOnlyFilter;
2014-04-23 00:46:19 +02:00
CAmount minAmount;
int limitRows;
bool showInactive;
};
2014-11-03 16:16:40 +01:00
#endif // BITCOIN_QT_TRANSACTIONFILTERPROXY_H