aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2020-04-20 14:42:52 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2020-11-19 03:15:53 +0000
commit62932cc686dc46ce14c026993deea8e561654177 (patch)
treec96402f607c6113a978164fa6fb57c09051d2671 /src
parenta47e5964861dfb98d61719c9852e12fd6da84c31 (diff)
downloadbitcoin-62932cc686dc46ce14c026993deea8e561654177.tar.xz
GUI/Intro: Return actual prune setting from showIfNeeded
Diffstat (limited to 'src')
-rw-r--r--src/qt/bitcoin.cpp12
-rw-r--r--src/qt/bitcoin.h2
-rw-r--r--src/qt/intro.cpp4
-rw-r--r--src/qt/intro.h2
4 files changed, 9 insertions, 11 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index eaaaaeb904..f7db865e32 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -315,11 +315,9 @@ void BitcoinApplication::parameterSetup()
InitParameterInteraction(gArgs);
}
-void BitcoinApplication::InitializePruneSetting(bool prune)
+void BitcoinApplication::InitPruneSetting(int64_t prune_MiB)
{
- // If prune is set, intentionally override existing prune size with
- // the default size since this is called when choosing a new datadir.
- optionsModel->SetPruneTargetGB(prune ? DEFAULT_PRUNE_TARGET_GB : 0, true);
+ optionsModel->SetPruneTargetGB(PruneMiBtoGB(prune_MiB), true);
}
void BitcoinApplication::requestInitialize()
@@ -508,9 +506,9 @@ int GuiMain(int argc, char* argv[])
/// 5. Now that settings and translations are available, ask user for data directory
// User language is set up: pick a data directory
bool did_show_intro = false;
- bool prune = false; // Intro dialog prune check box
+ int64_t prune_MiB = 0; // Intro dialog prune configuration
// Gracefully exit if the user cancels
- if (!Intro::showIfNeeded(did_show_intro, prune)) return EXIT_SUCCESS;
+ if (!Intro::showIfNeeded(did_show_intro, prune_MiB)) return EXIT_SUCCESS;
/// 6. Determine availability of data directory and parse bitcoin.conf
/// - Do not call GetDataDir(true) before this step finishes
@@ -594,7 +592,7 @@ int GuiMain(int argc, char* argv[])
if (did_show_intro) {
// Store intro dialog settings other than datadir (network specific)
- app.InitializePruneSetting(prune);
+ app.InitPruneSetting(prune_MiB);
}
if (gArgs.GetBoolArg("-splash", DEFAULT_SPLASHSCREEN) && !gArgs.GetBoolArg("-min", false))
diff --git a/src/qt/bitcoin.h b/src/qt/bitcoin.h
index 69e0a5921e..17ea67ba66 100644
--- a/src/qt/bitcoin.h
+++ b/src/qt/bitcoin.h
@@ -68,7 +68,7 @@ public:
/// Create options model
void createOptionsModel(bool resetSettings);
/// Initialize prune setting
- void InitializePruneSetting(bool prune);
+ void InitPruneSetting(int64_t prune_MiB);
/// Create main window
void createWindow(const NetworkStyle *networkStyle);
/// Create splash screen
diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp
index 235722d091..437c941f70 100644
--- a/src/qt/intro.cpp
+++ b/src/qt/intro.cpp
@@ -182,7 +182,7 @@ void Intro::setDataDirectory(const QString &dataDir)
}
}
-bool Intro::showIfNeeded(bool& did_show_intro, bool& prune)
+bool Intro::showIfNeeded(bool& did_show_intro, int64_t& prune_MiB)
{
did_show_intro = false;
@@ -233,7 +233,7 @@ bool Intro::showIfNeeded(bool& did_show_intro, bool& prune)
}
// Additional preferences:
- prune = intro.ui->prune->isChecked();
+ prune_MiB = intro.ui->prune->isChecked() ? PruneGBtoMiB(intro.m_prune_target_gb) : int64_t(0);
settings.setValue("strDataDir", dataDir);
settings.setValue("fReset", false);
diff --git a/src/qt/intro.h b/src/qt/intro.h
index 51f42de7ac..67888343a5 100644
--- a/src/qt/intro.h
+++ b/src/qt/intro.h
@@ -47,7 +47,7 @@ public:
* @note do NOT call global GetDataDir() before calling this function, this
* will cause the wrong path to be cached.
*/
- static bool showIfNeeded(bool& did_show_intro, bool& prune);
+ static bool showIfNeeded(bool& did_show_intro, int64_t& prune_MiB);
Q_SIGNALS:
void requestCheck();