aboutsummaryrefslogtreecommitdiff
path: root/src/qt/transactionfilterproxy.h
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2021-06-03 09:54:25 +0100
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2021-06-11 23:39:19 +0100
commit4830f4912a538600e9e9133442e9f8d929006630 (patch)
treee78ec0da98928708aa8be906f61a90fc0ec29e65 /src/qt/transactionfilterproxy.h
parenta9435e34457e0bfebd22e574fe63428537948aeb (diff)
downloadbitcoin-4830f4912a538600e9e9133442e9f8d929006630.tar.xz
qt: Refactor open date range to use std::optional
Diffstat (limited to 'src/qt/transactionfilterproxy.h')
-rw-r--r--src/qt/transactionfilterproxy.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/qt/transactionfilterproxy.h b/src/qt/transactionfilterproxy.h
index 693b363692..09bc9e75db 100644
--- a/src/qt/transactionfilterproxy.h
+++ b/src/qt/transactionfilterproxy.h
@@ -10,6 +10,8 @@
#include <QDateTime>
#include <QSortFilterProxyModel>
+#include <optional>
+
/** Filter the transaction list according to pre-specified rules. */
class TransactionFilterProxy : public QSortFilterProxyModel
{
@@ -18,10 +20,6 @@ class TransactionFilterProxy : public QSortFilterProxyModel
public:
explicit TransactionFilterProxy(QObject *parent = nullptr);
- /** Earliest date that can be represented (far in the past) */
- static const QDateTime MIN_DATE;
- /** Last date that can be represented (far in the future) */
- static const QDateTime MAX_DATE;
/** Type filter bit field (all types) */
static const quint32 ALL_TYPES = 0xFFFFFFFF;
@@ -34,7 +32,8 @@ public:
WatchOnlyFilter_No
};
- void setDateRange(const QDateTime &from, const QDateTime &to);
+ /** Filter transactions between date range. Use std::nullopt for open range. */
+ void setDateRange(const std::optional<QDateTime>& from, const std::optional<QDateTime>& to);
void setSearchString(const QString &);
/**
@note Type filter takes a bit field created with TYPE() or ALL_TYPES
@@ -55,8 +54,8 @@ protected:
bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const override;
private:
- QDateTime dateFrom;
- QDateTime dateTo;
+ std::optional<QDateTime> dateFrom;
+ std::optional<QDateTime> dateTo;
QString m_search_string;
quint32 typeFilter;
WatchOnlyFilter watchOnlyFilter;