aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoingui.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2013-04-18 05:54:42 -0700
committerWladimir J. van der Laan <laanwj@gmail.com>2013-04-18 05:54:42 -0700
commitdc2de757a496fe2f0f385dc4dc803d8838219aa3 (patch)
tree13aff2e8c50739b2d3345a21745ad73dc20aac13 /src/qt/bitcoingui.cpp
parent52ae314b5e8082729e9c7f5914eba48aa6993a13 (diff)
parent4881353efef81acc6ddbaaecd4ba89f012b3e87e (diff)
Merge pull request #2501 from Diapolo/progress
rework ClientModel::getBlockSource() + BitcoinGUI::setNumBlocks()
Diffstat (limited to 'src/qt/bitcoingui.cpp')
-rw-r--r--src/qt/bitcoingui.cpp38
1 files changed, 16 insertions, 22 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 14d738d9da..e2eefab3cc 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -506,31 +506,26 @@ void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
// Prevent orphan statusbar messages (e.g. hover Quit in main menu, wait until chain-sync starts -> garbelled text)
statusBar()->clearMessage();
- // don't show / hide progress bar and its label if we have no connection to the network
- enum BlockSource blockSource = clientModel ? clientModel->getBlockSource() : BLOCK_SOURCE_NONE;
- if (blockSource == BLOCK_SOURCE_NONE || (blockSource == BLOCK_SOURCE_NETWORK && clientModel->getNumConnections() == 0))
- {
- progressBarLabel->setVisible(false);
- progressBar->setVisible(false);
-
- return;
+ // Acquire current block source
+ enum BlockSource blockSource = clientModel->getBlockSource();
+ switch (blockSource) {
+ case BLOCK_SOURCE_NETWORK:
+ progressBarLabel->setText(tr("Synchronizing with network..."));
+ break;
+ case BLOCK_SOURCE_DISK:
+ progressBarLabel->setText(tr("Importing blocks from disk..."));
+ break;
+ case BLOCK_SOURCE_REINDEX:
+ progressBarLabel->setText(tr("Reindexing blocks on disk..."));
+ break;
+ case BLOCK_SOURCE_NONE:
+ // Case: not Importing, not Reindexing and no network connection
+ progressBarLabel->setText(tr("No block source available..."));
+ break;
}
QString tooltip;
- QString importText;
- switch (blockSource) {
- case BLOCK_SOURCE_NONE:
- case BLOCK_SOURCE_NETWORK:
- importText = tr("Synchronizing with network...");
- break;
- case BLOCK_SOURCE_DISK:
- importText = tr("Importing blocks from disk...");
- break;
- case BLOCK_SOURCE_REINDEX:
- importText = tr("Reindexing blocks on disk...");
- }
-
QDateTime lastBlockDate = clientModel->getLastBlockDate();
QDateTime currentDate = QDateTime::currentDateTime();
int secs = lastBlockDate.secsTo(currentDate);
@@ -572,7 +567,6 @@ void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
timeBehindText = tr("%n week(s)","",secs/(7*24*60*60));
}
- progressBarLabel->setText(importText);
progressBarLabel->setVisible(true);
progressBar->setFormat(tr("%1 behind").arg(timeBehindText));
progressBar->setMaximum(1000000000);