mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-22 21:50:14 +01:00
Merge #17696: qt: Force set nPruneSize in QSettings after the intro dialog
af112ab628qt: Rename SetPrune() to InitializePruneSetting() (Hennadii Stepanov)b0bfbe5028refactor: Drop `bool force' parameter (Hennadii Stepanov)68c9bbe9bcqt: Force set nPruneSize in QSettings after intro (Hennadii Stepanov)a82bd8fa57util: Replace magics with DEFAULT_PRUNE_TARGET_GB (Hennadii Stepanov) Pull request description: On master (5622d8f315), having `QSettings` set already ``` $ grep nPruneSize ~/.config/Bitcoin/Bitcoin-Qt-testnet.conf nPruneSize=6 ``` enabling prune option in the intro dialog ``` $ ./src/qt/bitcoin-qt -choosedatadir -testnet ```  has no effect: ``` $ grep Prune ~/.bitcoin/testnet3/debug.log 2019-12-08T10:04:41Z Prune configured to target 5722 MiB on disk for block and undo files. ``` --- With this PR: ``` $ grep Prune ~/.bitcoin/testnet3/debug.log 2019-12-08T10:20:35Z Prune configured to target 1907 MiB on disk for block and undo files. ``` This PR has been split of #17453 (the first two commits) as it fixes an orthogonal bug. Refs: - https://github.com/bitcoin/bitcoin/pull/17453#discussion_r345424240 - https://github.com/bitcoin/bitcoin/pull/17453#discussion_r350960201 ACKs for top commit: Sjors: Code review re-ACKaf112ab628ryanofsky: Code review ACKaf112ab628. Just suggested changes since last review (thanks!) promag: Tested ACKaf112ab628. Latest suggestions and changes look good to me. Tree-SHA512: 8ddad34b30dcc2cdcad6678ba8a0b36fa176e4e3465862ef6eee9be0f98d8146705138c9c7995dd8c0990af41078ca743fef1a90ed9240081f052f32ddec72b9
This commit is contained in:
@@ -91,8 +91,8 @@ void OptionsModel::Init(bool resetSettings)
|
||||
if (!settings.contains("bPrune"))
|
||||
settings.setValue("bPrune", false);
|
||||
if (!settings.contains("nPruneSize"))
|
||||
settings.setValue("nPruneSize", 2);
|
||||
SetPrune(settings.value("bPrune").toBool());
|
||||
settings.setValue("nPruneSize", DEFAULT_PRUNE_TARGET_GB);
|
||||
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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user