Skip to content

Commit f2e5a6b

Browse files
committed
GUI/Intro: Abstract GUI-to-option into Intro::getPrune
1 parent 62932cc commit f2e5a6b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/qt/intro.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,16 @@ void Intro::setDataDirectory(const QString &dataDir)
182182
}
183183
}
184184

185+
int64_t Intro::getPruneMiB() const
186+
{
187+
switch (ui->prune->checkState()) {
188+
case Qt::Checked:
189+
return PruneGBtoMiB(m_prune_target_gb);
190+
case Qt::Unchecked: default:
191+
return 0;
192+
}
193+
}
194+
185195
bool Intro::showIfNeeded(bool& did_show_intro, int64_t& prune_MiB)
186196
{
187197
did_show_intro = false;
@@ -233,7 +243,7 @@ bool Intro::showIfNeeded(bool& did_show_intro, int64_t& prune_MiB)
233243
}
234244

235245
// Additional preferences:
236-
prune_MiB = intro.ui->prune->isChecked() ? PruneGBtoMiB(intro.m_prune_target_gb) : int64_t(0);
246+
prune_MiB = intro.getPruneMiB();
237247

238248
settings.setValue("strDataDir", dataDir);
239249
settings.setValue("fReset", false);

src/qt/intro.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class Intro : public QDialog
3636

3737
QString getDataDirectory();
3838
void setDataDirectory(const QString &dataDir);
39+
int64_t getPruneMiB() const;
3940

4041
/**
4142
* Determine data directory. Let the user choose if the current one doesn't exist.

0 commit comments

Comments
 (0)