diff --git a/src/qt/forms/intro.ui b/src/qt/forms/intro.ui index f27a4ebe44..db1b567049 100644 --- a/src/qt/forms/intro.ui +++ b/src/qt/forms/intro.ui @@ -7,7 +7,7 @@ 0 0 674 - 415 + 447 @@ -200,6 +200,40 @@ + + + + + + Limit block chain storage to + + + Reverting this setting requires re-downloading the entire blockchain. It is faster to download the full chain first and prune it later. Disables some advanced features. + + + + + + + GB + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + @@ -210,16 +244,6 @@ - - - - Reverting this setting requires re-downloading the entire blockchain. It is faster to download the full chain first and prune it later. Disables some advanced features. - - - - - - diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index 61fb1463b9..e91722795c 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -139,17 +140,25 @@ Intro::Intro(QWidget *parent, int64_t blockchain_size_gb, int64_t chain_state_si ); ui->lblExplanation2->setText(ui->lblExplanation2->text().arg(PACKAGE_NAME)); + const int min_prune_target_GB = std::ceil(MIN_DISK_SPACE_FOR_BLOCK_FILES / 1e9); + ui->pruneGB->setRange(min_prune_target_GB, std::numeric_limits::max()); if (gArgs.GetArg("-prune", 0) > 1) { // -prune=1 means enabled, above that it's a size in MiB ui->prune->setChecked(true); ui->prune->setEnabled(false); } - ui->prune->setText(tr("Discard blocks after verification, except most recent %1 GB (prune)").arg(m_prune_target_gb)); + ui->pruneGB->setValue(m_prune_target_gb); + ui->pruneGB->setToolTip(ui->prune->toolTip()); UpdatePruneLabels(ui->prune->isChecked()); connect(ui->prune, &QCheckBox::toggled, [this](bool prune_checked) { UpdatePruneLabels(prune_checked); UpdateFreeSpaceLabel(); }); + connect(ui->pruneGB, QOverload::of(&QSpinBox::valueChanged), [this](int prune_GB) { + m_prune_target_gb = prune_GB; + UpdatePruneLabels(ui->prune->isChecked()); + UpdateFreeSpaceLabel(); + }); startThread(); } @@ -371,6 +380,7 @@ void Intro::UpdatePruneLabels(bool prune_checked) storageRequiresMsg = tr("Approximately %1 GB of data will be stored in this directory."); } ui->lblExplanation3->setVisible(prune_checked); + ui->pruneGB->setEnabled(prune_checked); 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) + " " + diff --git a/src/qt/intro.h b/src/qt/intro.h index bf7dad6ffb..88fe2b722d 100644 --- a/src/qt/intro.h +++ b/src/qt/intro.h @@ -73,7 +73,7 @@ private: //! Total required space (in GB) depending on user choice (prune or not prune). int64_t m_required_space_gb{0}; uint64_t m_bytes_available{0}; - const int64_t m_prune_target_gb; + int64_t m_prune_target_gb; void startThread(); void checkPath(const QString &dataDir);