aboutsummaryrefslogtreecommitdiff
path: root/src/qt/intro.cpp
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2020-04-21 21:14:11 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2020-11-19 03:31:12 +0000
commite2dcd957fa206a28404ff824fb764b8889705fb2 (patch)
treef6feb981eef3ca8344bb0314575de3c029749237 /src/qt/intro.cpp
parentf2e5a6b54fa38b10d822609939b8108bd8fe041b (diff)
downloadbitcoin-e2dcd957fa206a28404ff824fb764b8889705fb2.tar.xz
GUI/Intro: Rework UI flow to let the user set prune size in GBs
Diffstat (limited to 'src/qt/intro.cpp')
-rw-r--r--src/qt/intro.cpp12
1 files changed, 11 insertions, 1 deletions
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 <interfaces/node.h>
#include <util/system.h>
+#include <validation.h>
#include <QFileDialog>
#include <QSettings>
@@ -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<int>::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<int>::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) + " " +