diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2022-08-30 18:44:38 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2023-06-29 23:24:39 +0000 |
commit | bee0ffbecf4f95b65f4084893924a1ab250ca77c (patch) | |
tree | bd31e91b5aba2f715358350fd5478a3cfa9ce7a8 /src/qt | |
parent | 420a983e25d2f3ac3cc4d537bf223682be651604 (diff) |
GUI/Intro: Never change the prune checkbox after the user has touched it
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/intro.cpp | 4 | ||||
-rw-r--r-- | src/qt/intro.h | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index bb03899f07..c521bf3c51 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -142,6 +142,7 @@ 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.IsArgSet("-prune")) { + m_prune_checkbox_is_default = false; ui->prune->setChecked(gArgs.GetIntArg("-prune", 0) >= 1); ui->prune->setEnabled(false); } @@ -151,6 +152,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(); }); @@ -286,7 +288,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}; |