mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-23 05:09:26 +02:00
Merge bitcoin-core/gui#354: Refactor open date range to use std::optional
4830f4912aqt: Refactor open date range to use std::optional (João Barbosa) Pull request description: Use `std::nullopt` for open date range instead of `TransactionFilterProxy::MIN_DATE` and `TransactionFilterProxy::MAX_DATE`. ACKs for top commit: hebasto: re-ACK4830f4912a, only missed header included since my [previous](https://github.com/bitcoin-core/gui/pull/354#pullrequestreview-682108182) review. Talkless: tACK4830f4912a, tested on Debian Sid, filtering seems to work as expected. Tree-SHA512: dcecbcc129cb401d6ac13a20f015b8cb2a7434fae6bd3e5b19fca5531e8bd915e2a0835f9c601371381750cdc8cd6fcf4f8c6669177d679773046cbe13bed68b
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
|
||||
#include <node/ui_interface.h>
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QComboBox>
|
||||
#include <QDateTimeEdit>
|
||||
@@ -266,26 +268,26 @@ void TransactionView::chooseDate(int idx)
|
||||
{
|
||||
case All:
|
||||
transactionProxyModel->setDateRange(
|
||||
TransactionFilterProxy::MIN_DATE,
|
||||
TransactionFilterProxy::MAX_DATE);
|
||||
std::nullopt,
|
||||
std::nullopt);
|
||||
break;
|
||||
case Today:
|
||||
transactionProxyModel->setDateRange(
|
||||
GUIUtil::StartOfDay(current),
|
||||
TransactionFilterProxy::MAX_DATE);
|
||||
std::nullopt);
|
||||
break;
|
||||
case ThisWeek: {
|
||||
// Find last Monday
|
||||
QDate startOfWeek = current.addDays(-(current.dayOfWeek()-1));
|
||||
transactionProxyModel->setDateRange(
|
||||
GUIUtil::StartOfDay(startOfWeek),
|
||||
TransactionFilterProxy::MAX_DATE);
|
||||
std::nullopt);
|
||||
|
||||
} break;
|
||||
case ThisMonth:
|
||||
transactionProxyModel->setDateRange(
|
||||
GUIUtil::StartOfDay(QDate(current.year(), current.month(), 1)),
|
||||
TransactionFilterProxy::MAX_DATE);
|
||||
std::nullopt);
|
||||
break;
|
||||
case LastMonth:
|
||||
transactionProxyModel->setDateRange(
|
||||
@@ -295,7 +297,7 @@ void TransactionView::chooseDate(int idx)
|
||||
case ThisYear:
|
||||
transactionProxyModel->setDateRange(
|
||||
GUIUtil::StartOfDay(QDate(current.year(), 1, 1)),
|
||||
TransactionFilterProxy::MAX_DATE);
|
||||
std::nullopt);
|
||||
break;
|
||||
case Range:
|
||||
dateRangeWidget->setVisible(true);
|
||||
|
||||
Reference in New Issue
Block a user