aboutsummaryrefslogtreecommitdiff
path: root/src/qt/intro.cpp
diff options
context:
space:
mode:
authorSjors Provoost <sjors@sprovoost.nl>2019-08-24 19:13:04 +0200
committerSjors Provoost <sjors@sprovoost.nl>2019-08-24 22:41:32 +0200
commitc8de347a9d6c88fe67d77aba6fcce1b7fd66791c (patch)
treeadaefc5bf862bfa403edafd7f2be2b658db96a75 /src/qt/intro.cpp
parent1bbc49d2078ee53488e214d00eb47462687b05c5 (diff)
[gui] intro: add prune preference
Adds a checkbox to the introduction screen letting the user enable pruning from the start. Disable checkbox when launched with -prune
Diffstat (limited to 'src/qt/intro.cpp')
-rw-r--r--src/qt/intro.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp
index 0a18561109..0079cbc4f4 100644
--- a/src/qt/intro.cpp
+++ b/src/qt/intro.cpp
@@ -131,6 +131,11 @@ Intro::Intro(QWidget *parent, uint64_t blockchain_size, uint64_t chain_state_siz
ui->lblExplanation2->setText(ui->lblExplanation2->text().arg(PACKAGE_NAME));
uint64_t pruneTarget = std::max<int64_t>(0, gArgs.GetArg("-prune", 0));
+ if (pruneTarget > 1) { // -prune=1 means enabled, above that it's a size in MB
+ ui->prune->setChecked(true);
+ ui->prune->setEnabled(false);
+ }
+ ui->prune->setText(tr("Discard blocks after verification, except most recent %1 GB (prune)").arg(pruneTarget ? pruneTarget / 1000 : 2));
requiredSpace = m_blockchain_size;
QString storageRequiresMsg = tr("At least %1 GB of data will be stored in this directory, and it will grow over time.");
if (pruneTarget) {
@@ -180,7 +185,7 @@ void Intro::setDataDirectory(const QString &dataDir)
}
}
-bool Intro::showIfNeeded(interfaces::Node& node, bool& did_show_intro)
+bool Intro::showIfNeeded(interfaces::Node& node, bool& did_show_intro, bool& prune)
{
did_show_intro = false;
@@ -230,6 +235,9 @@ bool Intro::showIfNeeded(interfaces::Node& node, bool& did_show_intro)
}
}
+ // Additional preferences:
+ prune = intro.ui->prune->isChecked();
+
settings.setValue("strDataDir", dataDir);
settings.setValue("fReset", false);
}