0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-02 09:46:52 -05:00

refactor: Add Intro::UpdatePruneLabels()

This is a move-only commit and it does not change behavior.
This commit is contained in:
Hennadii Stepanov 2019-11-12 15:21:20 +02:00
parent e4caa82a03
commit daa3f3fa90
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
2 changed files with 19 additions and 13 deletions

View file

@ -135,19 +135,7 @@ Intro::Intro(QWidget *parent, int64_t blockchain_size_gb, int64_t chain_state_si
}
const int prune_target_gb = PruneMiBtoGB(prune_target_mib);
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));
m_required_space_gb = m_blockchain_size_gb + m_chain_state_size_gb;
QString storageRequiresMsg = tr("At least %1 GB of data will be stored in this directory, and it will grow over time.");
if (0 < prune_target_gb && prune_target_gb <= m_blockchain_size_gb) {
m_required_space_gb = prune_target_gb + m_chain_state_size_gb;
storageRequiresMsg = tr("Approximately %1 GB of data will be stored in this directory.");
}
ui->lblExplanation3->setVisible(prune_target_gb > 0);
ui->sizeWarningLabel->setText(
tr("%1 will download and store a copy of the Bitcoin block chain.").arg(PACKAGE_NAME) + " " +
storageRequiresMsg.arg(m_required_space_gb) + " " +
tr("The wallet will also be stored in this directory.")
);
this->adjustSize();
UpdatePruneLabels(prune_target_gb);
startThread();
}
@ -341,3 +329,20 @@ QString Intro::getPathToCheck()
mutex.unlock();
return retval;
}
void Intro::UpdatePruneLabels(int64_t prune_target_gb)
{
m_required_space_gb = m_blockchain_size_gb + m_chain_state_size_gb;
QString storageRequiresMsg = tr("At least %1 GB of data will be stored in this directory, and it will grow over time.");
if (0 < prune_target_gb && prune_target_gb <= m_blockchain_size_gb) {
m_required_space_gb = prune_target_gb + m_chain_state_size_gb;
storageRequiresMsg = tr("Approximately %1 GB of data will be stored in this directory.");
}
ui->lblExplanation3->setVisible(prune_target_gb > 0);
ui->sizeWarningLabel->setText(
tr("%1 will download and store a copy of the Bitcoin block chain.").arg(PACKAGE_NAME) + " " +
storageRequiresMsg.arg(m_required_space_gb) + " " +
tr("The wallet will also be stored in this directory.")
);
this->adjustSize();
}

View file

@ -75,6 +75,7 @@ private:
void startThread();
void checkPath(const QString &dataDir);
QString getPathToCheck();
void UpdatePruneLabels(int64_t prune_target_gb);
friend class FreespaceChecker;
};