mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
qt: Force set nPruneSize in QSettings after intro
If QSettings is set already, it is required to force set nPruneSize after the intro dialog.
This commit is contained in:
parent
a82bd8fa57
commit
68c9bbe9bc
3 changed files with 19 additions and 5 deletions
|
@ -281,8 +281,11 @@ void BitcoinApplication::parameterSetup()
|
||||||
m_node.initParameterInteraction();
|
m_node.initParameterInteraction();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinApplication::SetPrune(bool prune, bool force) {
|
void BitcoinApplication::SetPrune(bool prune, bool force)
|
||||||
optionsModel->SetPrune(prune, force);
|
{
|
||||||
|
// 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, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinApplication::requestInitialize()
|
void BitcoinApplication::requestInitialize()
|
||||||
|
|
|
@ -92,7 +92,7 @@ void OptionsModel::Init(bool resetSettings)
|
||||||
settings.setValue("bPrune", false);
|
settings.setValue("bPrune", false);
|
||||||
if (!settings.contains("nPruneSize"))
|
if (!settings.contains("nPruneSize"))
|
||||||
settings.setValue("nPruneSize", DEFAULT_PRUNE_TARGET_GB);
|
settings.setValue("nPruneSize", DEFAULT_PRUNE_TARGET_GB);
|
||||||
SetPrune(settings.value("bPrune").toBool());
|
SetPruneEnabled(settings.value("bPrune").toBool());
|
||||||
|
|
||||||
if (!settings.contains("nDatabaseCache"))
|
if (!settings.contains("nDatabaseCache"))
|
||||||
settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache);
|
settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache);
|
||||||
|
@ -236,7 +236,7 @@ static const QString GetDefaultProxyAddress()
|
||||||
return QString("%1:%2").arg(DEFAULT_GUI_PROXY_HOST).arg(DEFAULT_GUI_PROXY_PORT);
|
return QString("%1:%2").arg(DEFAULT_GUI_PROXY_HOST).arg(DEFAULT_GUI_PROXY_PORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsModel::SetPrune(bool prune, bool force)
|
void OptionsModel::SetPruneEnabled(bool prune, bool force)
|
||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.setValue("bPrune", prune);
|
settings.setValue("bPrune", prune);
|
||||||
|
@ -252,6 +252,16 @@ void OptionsModel::SetPrune(bool prune, bool force)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OptionsModel::SetPruneTargetGB(int prune_target_gb, bool force)
|
||||||
|
{
|
||||||
|
const bool prune = prune_target_gb > 0;
|
||||||
|
if (prune) {
|
||||||
|
QSettings settings;
|
||||||
|
settings.setValue("nPruneSize", prune_target_gb);
|
||||||
|
}
|
||||||
|
SetPruneEnabled(prune, force);
|
||||||
|
}
|
||||||
|
|
||||||
// read QSettings values and return them
|
// read QSettings values and return them
|
||||||
QVariant OptionsModel::data(const QModelIndex & index, int role) const
|
QVariant OptionsModel::data(const QModelIndex & index, int role) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,7 +73,8 @@ public:
|
||||||
const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; }
|
const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; }
|
||||||
|
|
||||||
/* Explicit setters */
|
/* Explicit setters */
|
||||||
void SetPrune(bool prune, bool force = false);
|
void SetPruneEnabled(bool prune, bool force = false);
|
||||||
|
void SetPruneTargetGB(int prune_target_gb, bool force = false);
|
||||||
|
|
||||||
/* Restart flag helper */
|
/* Restart flag helper */
|
||||||
void setRestartRequired(bool fRequired);
|
void setRestartRequired(bool fRequired);
|
||||||
|
|
Loading…
Add table
Reference in a new issue