From f3bdc143b67e8a5e763071a0774f6d994ca35c57 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 6 Jan 2022 18:41:36 +0200 Subject: [PATCH] refactor, qt: Add SHUTDOWN_POLLING_DELAY constant A named constant is better for the code readability. Also it could be reused in an alternative GUI implementation (e.g., QML-based). --- src/qt/bitcoin.cpp | 2 +- src/qt/guiconstants.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 9b9585f9933..9b5783e00cc 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -414,7 +414,7 @@ void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHead QTimer::singleShot(100ms, paymentServer, &PaymentServer::uiReady); } #endif - pollShutdownTimer->start(200ms); + pollShutdownTimer->start(SHUTDOWN_POLLING_DELAY); } else { Q_EMIT splashFinished(); // Make sure splash screen doesn't stick around during shutdown requestShutdown(); diff --git a/src/qt/guiconstants.h b/src/qt/guiconstants.h index b910ead12f2..1adcd5b6b91 100644 --- a/src/qt/guiconstants.h +++ b/src/qt/guiconstants.h @@ -13,6 +13,9 @@ using namespace std::chrono_literals; /* A delay between model updates */ static constexpr auto MODEL_UPDATE_DELAY{250ms}; +/* A delay between shutdown pollings */ +static constexpr auto SHUTDOWN_POLLING_DELAY{200ms}; + /* AskPassphraseDialog -- Maximum passphrase length */ static const int MAX_PASSPHRASE_SIZE = 1024;