GUI/Intro: Abstract GUI-to-option into Intro::getPrune

This commit is contained in:
Luke Dashjr 2020-11-19 03:19:30 +00:00
parent 62932cc686
commit f2e5a6b54f
2 changed files with 12 additions and 1 deletions

View file

@ -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);

View file

@ -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.