Skip to content

Commit daa3f3f

Browse files
committed
refactor: Add Intro::UpdatePruneLabels()
This is a move-only commit and it does not change behavior.
1 parent e4caa82 commit daa3f3f

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

src/qt/intro.cpp

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -135,19 +135,7 @@ Intro::Intro(QWidget *parent, int64_t blockchain_size_gb, int64_t chain_state_si
135135
}
136136
const int prune_target_gb = PruneMiBtoGB(prune_target_mib);
137137
ui->prune->setText(tr("Discard blocks after verification, except most recent %1 GB (prune)").arg(prune_target_gb ? prune_target_gb : DEFAULT_PRUNE_TARGET_GB));
138-
m_required_space_gb = m_blockchain_size_gb + m_chain_state_size_gb;
139-
QString storageRequiresMsg = tr("At least %1 GB of data will be stored in this directory, and it will grow over time.");
140-
if (0 < prune_target_gb && prune_target_gb <= m_blockchain_size_gb) {
141-
m_required_space_gb = prune_target_gb + m_chain_state_size_gb;
142-
storageRequiresMsg = tr("Approximately %1 GB of data will be stored in this directory.");
143-
}
144-
ui->lblExplanation3->setVisible(prune_target_gb > 0);
145-
ui->sizeWarningLabel->setText(
146-
tr("%1 will download and store a copy of the Bitcoin block chain.").arg(PACKAGE_NAME) + " " +
147-
storageRequiresMsg.arg(m_required_space_gb) + " " +
148-
tr("The wallet will also be stored in this directory.")
149-
);
150-
this->adjustSize();
138+
UpdatePruneLabels(prune_target_gb);
151139
startThread();
152140
}
153141

@@ -341,3 +329,20 @@ QString Intro::getPathToCheck()
341329
mutex.unlock();
342330
return retval;
343331
}
332+
333+
void Intro::UpdatePruneLabels(int64_t prune_target_gb)
334+
{
335+
m_required_space_gb = m_blockchain_size_gb + m_chain_state_size_gb;
336+
QString storageRequiresMsg = tr("At least %1 GB of data will be stored in this directory, and it will grow over time.");
337+
if (0 < prune_target_gb && prune_target_gb <= m_blockchain_size_gb) {
338+
m_required_space_gb = prune_target_gb + m_chain_state_size_gb;
339+
storageRequiresMsg = tr("Approximately %1 GB of data will be stored in this directory.");
340+
}
341+
ui->lblExplanation3->setVisible(prune_target_gb > 0);
342+
ui->sizeWarningLabel->setText(
343+
tr("%1 will download and store a copy of the Bitcoin block chain.").arg(PACKAGE_NAME) + " " +
344+
storageRequiresMsg.arg(m_required_space_gb) + " " +
345+
tr("The wallet will also be stored in this directory.")
346+
);
347+
this->adjustSize();
348+
}

src/qt/intro.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ private Q_SLOTS:
7575
void startThread();
7676
void checkPath(const QString &dataDir);
7777
QString getPathToCheck();
78+
void UpdatePruneLabels(int64_t prune_target_gb);
7879

7980
friend class FreespaceChecker;
8081
};

0 commit comments

Comments
 (0)