diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2024-02-12 12:03:12 +0000 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2024-02-12 12:08:46 +0000 |
commit | 2afbacc4b17871e46ad8e412d4908f7154b11f17 (patch) | |
tree | 0c3f6fc1cad16b8b16e32bf603fef6b528aedd65 /src/qt | |
parent | 7d837b569d078d9231e0a1e7912710037b7ad6f6 (diff) | |
parent | bee0ffbecf4f95b65f4084893924a1ab250ca77c (diff) | |
download | bitcoin-2afbacc4b17871e46ad8e412d4908f7154b11f17.tar.xz |
Merge bitcoin-core/gui#658: Intro: Never change the prune checkbox after the user has touched it
bee0ffbecf4f95b65f4084893924a1ab250ca77c GUI/Intro: Never change the prune checkbox after the user has touched it (Luke Dashjr)
420a983e25d2f3ac3cc4d537bf223682be651604 Bugfix: GUI/Intro: Disable GUI prune option if -prune is set, regardless of set value (Luke Dashjr)
Pull request description:
Re-PR from https://github.com/bitcoin/bitcoin/pull/18729
Now includes a bugfix too (`-prune=2+` disabled the checkbox, but `-prune=0/1` did not; this behaviour is necessary since `-prune` overrides GUI settings)
ACKs for top commit:
hebasto:
ACK bee0ffbecf4f95b65f4084893924a1ab250ca77c, both commits are improvements of the current behaviour. Tested on Ubuntu 23.10.
Tree-SHA512: 8eb7d90af37deb30fe226179db3bc9df8ab59e4f3218c8e447ed31fc9ddc81ac1a1629da63347518587a56a4c8558b05cf7ec474024c5f5dfc6d49d6ff0eb0cc
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/intro.cpp | 8 | ||||
-rw-r--r-- | src/qt/intro.h | 1 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index f86b167076..5371dbaa30 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -142,8 +142,9 @@ Intro::Intro(QWidget *parent, int64_t blockchain_size_gb, int64_t chain_state_si const int min_prune_target_GB = std::ceil(MIN_DISK_SPACE_FOR_BLOCK_FILES / 1e9); ui->pruneGB->setRange(min_prune_target_GB, std::numeric_limits<int>::max()); - if (gArgs.GetIntArg("-prune", 0) > 1) { // -prune=1 means enabled, above that it's a size in MiB - ui->prune->setChecked(true); + if (gArgs.IsArgSet("-prune")) { + m_prune_checkbox_is_default = false; + ui->prune->setChecked(gArgs.GetIntArg("-prune", 0) >= 1); ui->prune->setEnabled(false); } ui->pruneGB->setValue(m_prune_target_gb); @@ -152,6 +153,7 @@ Intro::Intro(QWidget *parent, int64_t blockchain_size_gb, int64_t chain_state_si UpdatePruneLabels(ui->prune->isChecked()); connect(ui->prune, &QCheckBox::toggled, [this](bool prune_checked) { + m_prune_checkbox_is_default = false; UpdatePruneLabels(prune_checked); UpdateFreeSpaceLabel(); }); @@ -287,7 +289,7 @@ void Intro::setStatus(int status, const QString &message, quint64 bytesAvailable ui->freeSpace->setText(""); } else { m_bytes_available = bytesAvailable; - if (ui->prune->isEnabled() && !(gArgs.IsArgSet("-prune") && gArgs.GetIntArg("-prune", 0) == 0)) { + if (ui->prune->isEnabled() && m_prune_checkbox_is_default) { ui->prune->setChecked(m_bytes_available < (m_blockchain_size_gb + m_chain_state_size_gb + 10) * GB_BYTES); } UpdateFreeSpaceLabel(); diff --git a/src/qt/intro.h b/src/qt/intro.h index 900c657b27..7b34c73b02 100644 --- a/src/qt/intro.h +++ b/src/qt/intro.h @@ -64,6 +64,7 @@ private Q_SLOTS: private: Ui::Intro *ui; + bool m_prune_checkbox_is_default{true}; QThread* thread{nullptr}; QMutex mutex; bool signalled{false}; |