Qt/Intro: Allow changing prune setting even when specified on commandline

This commit is contained in:
Luke Dashjr 2023-08-04 00:10:48 +00:00
parent 6e564fe617
commit a2bcbef77f
3 changed files with 5 additions and 1 deletions

View File

@ -154,7 +154,6 @@ Intro::Intro(QWidget *parent, int64_t blockchain_size_gb, int64_t chain_state_si
default: default:
ui->prune->setChecked(true); ui->prune->setChecked(true);
} }
ui->prune->setEnabled(false);
} }
ui->pruneMiB->setValue(m_prune_target_mib); ui->pruneMiB->setValue(m_prune_target_mib);
ui->pruneMiB->setToolTip(ui->prune->toolTip()); ui->pruneMiB->setToolTip(ui->prune->toolTip());

View File

@ -238,6 +238,9 @@ bool OptionsModel::Init(bilingual_str& error)
// and we want command-line parameters to overwrite the GUI settings. // and we want command-line parameters to overwrite the GUI settings.
for (OptionID option : {DatabaseCache, ThreadsScriptVerif, SpendZeroConfChange, ExternalSignerPath, MapPortUPnP, for (OptionID option : {DatabaseCache, ThreadsScriptVerif, SpendZeroConfChange, ExternalSignerPath, MapPortUPnP,
MapPortNatpmp, Listen, Server, PruneTristate, ProxyUse, ProxyUseTor, Language}) { MapPortNatpmp, Listen, Server, PruneTristate, ProxyUse, ProxyUseTor, Language}) {
// isSettingIgnored will have a false positive here during first-run prune changes
if (option == PruneTristate && m_prune_forced_by_gui) continue;
std::string setting = SettingName(option); std::string setting = SettingName(option);
if (node().isSettingIgnored(setting)) addOverriddenOption("-" + setting); if (node().isSettingIgnored(setting)) addOverriddenOption("-" + setting);
try { try {
@ -397,6 +400,7 @@ void OptionsModel::SetPruneTargetMiB(int prune_target_mib)
// this point because this function is only called after the intro screen is // this point because this function is only called after the intro screen is
// shown, before the node starts. // shown, before the node starts.
node().forceSetting("prune", new_value); node().forceSetting("prune", new_value);
m_prune_forced_by_gui = true;
// Update settings.json if value configured in intro screen is different // Update settings.json if value configured in intro screen is different
// from saved value. Avoid writing settings.json if bitcoin.conf value // from saved value. Avoid writing settings.json if bitcoin.conf value

View File

@ -138,6 +138,7 @@ private:
/* settings that were overridden by command-line */ /* settings that were overridden by command-line */
QString strOverriddenByCommandLine; QString strOverriddenByCommandLine;
bool m_prune_forced_by_gui{false};
static QString FontChoiceToString(const OptionsModel::FontChoice&); static QString FontChoiceToString(const OptionsModel::FontChoice&);
static FontChoice FontChoiceFromString(const QString&); static FontChoice FontChoiceFromString(const QString&);