From daa3f3fa9071a229275dd6a1b8445237ddc3fa97 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 12 Nov 2019 15:21:20 +0200 Subject: refactor: Add Intro::UpdatePruneLabels() This is a move-only commit and it does not change behavior. --- src/qt/intro.cpp | 31 ++++++++++++++++++------------- src/qt/intro.h | 1 + 2 files changed, 19 insertions(+), 13 deletions(-) (limited to 'src/qt') diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index 196f4b50bc..a1a7c8ab8b 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -135,19 +135,7 @@ Intro::Intro(QWidget *parent, int64_t blockchain_size_gb, int64_t chain_state_si } const int prune_target_gb = PruneMiBtoGB(prune_target_mib); ui->prune->setText(tr("Discard blocks after verification, except most recent %1 GB (prune)").arg(prune_target_gb ? prune_target_gb : DEFAULT_PRUNE_TARGET_GB)); - m_required_space_gb = m_blockchain_size_gb + m_chain_state_size_gb; - QString storageRequiresMsg = tr("At least %1 GB of data will be stored in this directory, and it will grow over time."); - if (0 < prune_target_gb && prune_target_gb <= m_blockchain_size_gb) { - m_required_space_gb = prune_target_gb + m_chain_state_size_gb; - storageRequiresMsg = tr("Approximately %1 GB of data will be stored in this directory."); - } - ui->lblExplanation3->setVisible(prune_target_gb > 0); - ui->sizeWarningLabel->setText( - tr("%1 will download and store a copy of the Bitcoin block chain.").arg(PACKAGE_NAME) + " " + - storageRequiresMsg.arg(m_required_space_gb) + " " + - tr("The wallet will also be stored in this directory.") - ); - this->adjustSize(); + UpdatePruneLabels(prune_target_gb); startThread(); } @@ -341,3 +329,20 @@ QString Intro::getPathToCheck() mutex.unlock(); return retval; } + +void Intro::UpdatePruneLabels(int64_t prune_target_gb) +{ + m_required_space_gb = m_blockchain_size_gb + m_chain_state_size_gb; + QString storageRequiresMsg = tr("At least %1 GB of data will be stored in this directory, and it will grow over time."); + if (0 < prune_target_gb && prune_target_gb <= m_blockchain_size_gb) { + m_required_space_gb = prune_target_gb + m_chain_state_size_gb; + storageRequiresMsg = tr("Approximately %1 GB of data will be stored in this directory."); + } + ui->lblExplanation3->setVisible(prune_target_gb > 0); + ui->sizeWarningLabel->setText( + tr("%1 will download and store a copy of the Bitcoin block chain.").arg(PACKAGE_NAME) + " " + + storageRequiresMsg.arg(m_required_space_gb) + " " + + tr("The wallet will also be stored in this directory.") + ); + this->adjustSize(); +} diff --git a/src/qt/intro.h b/src/qt/intro.h index 157b33b456..b4fd390006 100644 --- a/src/qt/intro.h +++ b/src/qt/intro.h @@ -75,6 +75,7 @@ private: void startThread(); void checkPath(const QString &dataDir); QString getPathToCheck(); + void UpdatePruneLabels(int64_t prune_target_gb); friend class FreespaceChecker; }; -- cgit v1.2.3