mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
Merge bitcoin-core/gui#658: Intro: Never change the prune checkbox after the user has touched it
bee0ffbecf
GUI/Intro: Never change the prune checkbox after the user has touched it (Luke Dashjr)420a983e25
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: ACKbee0ffbecf
, both commits are improvements of the current behaviour. Tested on Ubuntu 23.10. Tree-SHA512: 8eb7d90af37deb30fe226179db3bc9df8ab59e4f3218c8e447ed31fc9ddc81ac1a1629da63347518587a56a4c8558b05cf7ec474024c5f5dfc6d49d6ff0eb0cc
This commit is contained in:
commit
2afbacc4b1
2 changed files with 6 additions and 3 deletions
|
@ -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();
|
||||
|
|
|
@ -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};
|
||||
|
|
Loading…
Add table
Reference in a new issue