aboutsummaryrefslogtreecommitdiff
path: root/src/qt/optionsmodel.cpp
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2019-11-12 12:09:10 +0200
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2020-01-08 00:12:32 +0200
commit68c9bbe9bc91f882404556998666b1b5acea60e4 (patch)
tree429b2ae01af8f97b3e998e6bc2d14bcbd9667f40 /src/qt/optionsmodel.cpp
parenta82bd8fa5708c16d1db3edc4e82d70788eb5af19 (diff)
downloadbitcoin-68c9bbe9bc91f882404556998666b1b5acea60e4.tar.xz
qt: Force set nPruneSize in QSettings after intro
If QSettings is set already, it is required to force set nPruneSize after the intro dialog.
Diffstat (limited to 'src/qt/optionsmodel.cpp')
-rw-r--r--src/qt/optionsmodel.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp
index c721c801e1..1512babbc3 100644
--- a/src/qt/optionsmodel.cpp
+++ b/src/qt/optionsmodel.cpp
@@ -92,7 +92,7 @@ void OptionsModel::Init(bool resetSettings)
settings.setValue("bPrune", false);
if (!settings.contains("nPruneSize"))
settings.setValue("nPruneSize", DEFAULT_PRUNE_TARGET_GB);
- SetPrune(settings.value("bPrune").toBool());
+ SetPruneEnabled(settings.value("bPrune").toBool());
if (!settings.contains("nDatabaseCache"))
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);
}
-void OptionsModel::SetPrune(bool prune, bool force)
+void OptionsModel::SetPruneEnabled(bool prune, bool force)
{
QSettings settings;
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
QVariant OptionsModel::data(const QModelIndex & index, int role) const
{