Skip to content

Commit 62932cc

Browse files
committed
GUI/Intro: Return actual prune setting from showIfNeeded
1 parent a47e596 commit 62932cc

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

src/qt/bitcoin.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,9 @@ void BitcoinApplication::parameterSetup()
315315
InitParameterInteraction(gArgs);
316316
}
317317

318-
void BitcoinApplication::InitializePruneSetting(bool prune)
318+
void BitcoinApplication::InitPruneSetting(int64_t prune_MiB)
319319
{
320-
// If prune is set, intentionally override existing prune size with
321-
// the default size since this is called when choosing a new datadir.
322-
optionsModel->SetPruneTargetGB(prune ? DEFAULT_PRUNE_TARGET_GB : 0, true);
320+
optionsModel->SetPruneTargetGB(PruneMiBtoGB(prune_MiB), true);
323321
}
324322

325323
void BitcoinApplication::requestInitialize()
@@ -508,9 +506,9 @@ int GuiMain(int argc, char* argv[])
508506
/// 5. Now that settings and translations are available, ask user for data directory
509507
// User language is set up: pick a data directory
510508
bool did_show_intro = false;
511-
bool prune = false; // Intro dialog prune check box
509+
int64_t prune_MiB = 0; // Intro dialog prune configuration
512510
// Gracefully exit if the user cancels
513-
if (!Intro::showIfNeeded(did_show_intro, prune)) return EXIT_SUCCESS;
511+
if (!Intro::showIfNeeded(did_show_intro, prune_MiB)) return EXIT_SUCCESS;
514512

515513
/// 6. Determine availability of data directory and parse bitcoin.conf
516514
/// - Do not call GetDataDir(true) before this step finishes
@@ -594,7 +592,7 @@ int GuiMain(int argc, char* argv[])
594592

595593
if (did_show_intro) {
596594
// Store intro dialog settings other than datadir (network specific)
597-
app.InitializePruneSetting(prune);
595+
app.InitPruneSetting(prune_MiB);
598596
}
599597

600598
if (gArgs.GetBoolArg("-splash", DEFAULT_SPLASHSCREEN) && !gArgs.GetBoolArg("-min", false))

src/qt/bitcoin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class BitcoinApplication: public QApplication
6868
/// Create options model
6969
void createOptionsModel(bool resetSettings);
7070
/// Initialize prune setting
71-
void InitializePruneSetting(bool prune);
71+
void InitPruneSetting(int64_t prune_MiB);
7272
/// Create main window
7373
void createWindow(const NetworkStyle *networkStyle);
7474
/// Create splash screen

src/qt/intro.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void Intro::setDataDirectory(const QString &dataDir)
182182
}
183183
}
184184

185-
bool Intro::showIfNeeded(bool& did_show_intro, bool& prune)
185+
bool Intro::showIfNeeded(bool& did_show_intro, int64_t& prune_MiB)
186186
{
187187
did_show_intro = false;
188188

@@ -233,7 +233,7 @@ bool Intro::showIfNeeded(bool& did_show_intro, bool& prune)
233233
}
234234

235235
// Additional preferences:
236-
prune = intro.ui->prune->isChecked();
236+
prune_MiB = intro.ui->prune->isChecked() ? PruneGBtoMiB(intro.m_prune_target_gb) : int64_t(0);
237237

238238
settings.setValue("strDataDir", dataDir);
239239
settings.setValue("fReset", false);

src/qt/intro.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Intro : public QDialog
4747
* @note do NOT call global GetDataDir() before calling this function, this
4848
* will cause the wrong path to be cached.
4949
*/
50-
static bool showIfNeeded(bool& did_show_intro, bool& prune);
50+
static bool showIfNeeded(bool& did_show_intro, int64_t& prune_MiB);
5151

5252
Q_SIGNALS:
5353
void requestCheck();

0 commit comments

Comments
 (0)