Skip to content

Commit 76cb089

Browse files
committed
GUI/Intro: Never change the prune checkbox after the user has touched it
1 parent 501ead3 commit 76cb089

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/qt/intro.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ Intro::Intro(QWidget *parent, int64_t blockchain_size_gb, int64_t chain_state_si
143143
const int min_prune_target_GB = std::ceil(MIN_DISK_SPACE_FOR_BLOCK_FILES / 1e9);
144144
ui->pruneGB->setRange(min_prune_target_GB, std::numeric_limits<int>::max());
145145
if (gArgs.IsArgSet("-prune")) {
146+
m_prune_checkbox_is_default = false;
146147
ui->prune->setChecked(gArgs.GetIntArg("-prune", 0) >= 1);
147148
ui->prune->setEnabled(false);
148149
}
@@ -152,6 +153,7 @@ Intro::Intro(QWidget *parent, int64_t blockchain_size_gb, int64_t chain_state_si
152153
UpdatePruneLabels(ui->prune->isChecked());
153154

154155
connect(ui->prune, &QCheckBox::toggled, [this](bool prune_checked) {
156+
m_prune_checkbox_is_default = false;
155157
UpdatePruneLabels(prune_checked);
156158
UpdateFreeSpaceLabel();
157159
});
@@ -287,8 +289,9 @@ void Intro::setStatus(int status, const QString &message, quint64 bytesAvailable
287289
ui->freeSpace->setText("");
288290
} else {
289291
m_bytes_available = bytesAvailable;
290-
if (ui->prune->isEnabled() && !(gArgs.IsArgSet("-prune") && gArgs.GetIntArg("-prune", 0) == 0)) {
292+
if (ui->prune->isEnabled() && m_prune_checkbox_is_default) {
291293
ui->prune->setChecked(m_bytes_available < (m_blockchain_size_gb + m_chain_state_size_gb + 10) * GB_BYTES);
294+
m_prune_checkbox_is_default = true;
292295
}
293296
UpdateFreeSpaceLabel();
294297
}

src/qt/intro.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ private Q_SLOTS:
6464

6565
private:
6666
Ui::Intro *ui;
67+
bool m_prune_checkbox_is_default{true};
6768
QThread *thread;
6869
QMutex mutex;
6970
bool signalled;

0 commit comments

Comments
 (0)