From f2e5a6b54fa38b10d822609939b8108bd8fe041b Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 19 Nov 2020 03:19:30 +0000 Subject: [PATCH] GUI/Intro: Abstract GUI-to-option into Intro::getPrune --- src/qt/intro.cpp | 12 +++++++++++- src/qt/intro.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index 437c941f70b..61fb1463b94 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -182,6 +182,16 @@ void Intro::setDataDirectory(const QString &dataDir) } } +int64_t Intro::getPruneMiB() const +{ + switch (ui->prune->checkState()) { + case Qt::Checked: + return PruneGBtoMiB(m_prune_target_gb); + case Qt::Unchecked: default: + return 0; + } +} + bool Intro::showIfNeeded(bool& did_show_intro, int64_t& prune_MiB) { did_show_intro = false; @@ -233,7 +243,7 @@ bool Intro::showIfNeeded(bool& did_show_intro, int64_t& prune_MiB) } // Additional preferences: - prune_MiB = intro.ui->prune->isChecked() ? PruneGBtoMiB(intro.m_prune_target_gb) : int64_t(0); + prune_MiB = intro.getPruneMiB(); settings.setValue("strDataDir", dataDir); settings.setValue("fReset", false); diff --git a/src/qt/intro.h b/src/qt/intro.h index 67888343a52..bf7dad6ffb3 100644 --- a/src/qt/intro.h +++ b/src/qt/intro.h @@ -36,6 +36,7 @@ public: QString getDataDirectory(); void setDataDirectory(const QString &dataDir); + int64_t getPruneMiB() const; /** * Determine data directory. Let the user choose if the current one doesn't exist.