aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoingui.cpp
diff options
context:
space:
mode:
authorPhilip Kaufmann <phil.kaufmann@t-online.de>2012-04-02 07:57:54 +0200
committerPhilip Kaufmann <phil.kaufmann@t-online.de>2012-04-02 23:48:21 +0200
commit9ceae8acea658d3e9d6bfe851e0d904c191c6f81 (patch)
tree7144c5bd23bed24249017fd54a07720f9f93846a /src/qt/bitcoingui.cpp
parent85ea8b4f4380dac803d43cd0b7829b107cc09e38 (diff)
modified block DL progressbar to be dynamic and more precise
Diffstat (limited to 'src/qt/bitcoingui.cpp')
-rw-r--r--src/qt/bitcoingui.cpp35
1 files changed, 27 insertions, 8 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 91696310b4..464fb8c482 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -332,8 +332,12 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel)
setNumConnections(clientModel->getNumConnections());
connect(clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));
- setNumBlocks(clientModel->getNumBlocks());
- connect(clientModel, SIGNAL(numBlocksChanged(int)), this, SLOT(setNumBlocks(int)));
+ // don't display the sync. message, if we are not connected to the network
+ if (clientModel->getNumConnections() > 0)
+ {
+ setNumBlocks(clientModel->getNumBlocks());
+ connect(clientModel, SIGNAL(numBlocksChanged(int)), this, SLOT(setNumBlocks(int)));
+ }
// Report errors from network/worker thread
connect(clientModel, SIGNAL(error(QString,QString)), this, SLOT(error(QString,QString)));
@@ -453,18 +457,33 @@ void BitcoinGUI::setNumBlocks(int count)
{
if(!clientModel)
return;
- int total = clientModel->getNumBlocksOfPeers();
+ int nTotal = clientModel->getNumBlocksOfPeers();
+ int nInitTotal = clientModel->getNumBlocksAtStartup();
+ int nPercentageLeft = 100 - (count / (nTotal / 100));
QString tooltip;
- if(count < total)
+ if(count < nTotal)
{
if (clientModel->getStatusBarWarnings() == "")
{
progressBarLabel->setVisible(true);
- progressBarLabel->setText(tr("Synchronizing with network..."));
progressBar->setVisible(true);
- progressBar->setMaximum(total);
- progressBar->setValue(count);
+ progressBar->setFormat(tr("%v of %m blocks (%p%)"));
+ progressBar->setAlignment(Qt::AlignCenter);
+ // display absolute bar if the difference between count and nTotal is > 10%
+ if (nPercentageLeft > 10)
+ {
+ progressBarLabel->setText(tr("Synchronizing with network... (abs. display)"));
+ progressBar->setMaximum(nTotal);
+ progressBar->setValue(count);
+ }
+ else
+ {
+ progressBarLabel->setText(tr("Synchronizing with network... (rel. display)"));
+ progressBar->setMaximum(nTotal - nInitTotal);
+ progressBar->setValue(count - nInitTotal);
+ }
+
}
else
{
@@ -472,7 +491,7 @@ void BitcoinGUI::setNumBlocks(int count)
progressBarLabel->setVisible(true);
progressBar->setVisible(false);
}
- tooltip = tr("Downloaded %1 of %2 blocks of transaction history.").arg(count).arg(total);
+ tooltip = tr("Downloaded %1 of %2 blocks of transaction history (%3% left).").arg(count).arg(nTotal).arg(nPercentageLeft);
}
else
{