aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2020-11-19 03:19:30 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2020-11-19 03:19:30 +0000
commitf2e5a6b54fa38b10d822609939b8108bd8fe041b (patch)
tree63a7f90b96e9602b25ee92d57e2a12cd6e79e4b4 /src/qt
parent62932cc686dc46ce14c026993deea8e561654177 (diff)
downloadbitcoin-f2e5a6b54fa38b10d822609939b8108bd8fe041b.tar.xz
GUI/Intro: Abstract GUI-to-option into Intro::getPrune
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/intro.cpp12
-rw-r--r--src/qt/intro.h1
2 files changed, 12 insertions, 1 deletions
diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp
index 437c941f70..61fb1463b9 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 67888343a5..bf7dad6ffb 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.