From: Philip Kaufmann Date: Mon, 2 Apr 2012 08:18:51 +0000 (+0200) Subject: removed relative progressbar display and moved re-worked network detection code to... X-Git-Tag: v0.4.0-unstable~129^2~111^2~6 X-Git-Url: https://git.novaco.in/?a=commitdiff_plain;h=068ed1e8384dd0e12ef68c0dc91c7064b6aae8ec;hp=9ceae8acea658d3e9d6bfe851e0d904c191c6f81;p=novacoin.git removed relative progressbar display and moved re-worked network detection code to setNumBlocks() --- diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 464fb8c..c8294cf 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -332,12 +332,8 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel) setNumConnections(clientModel->getNumConnections()); connect(clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(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))); - } + 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))); @@ -455,10 +451,16 @@ void BitcoinGUI::setNumConnections(int count) void BitcoinGUI::setNumBlocks(int count) { - if(!clientModel) + // don't show / hide progressBar and it's label if we have no connection(s) to the network + if (!clientModel || clientModel->getNumConnections() == 0) + { + progressBarLabel->setVisible(false); + progressBar->setVisible(false); + return; + } + int nTotal = clientModel->getNumBlocksOfPeers(); - int nInitTotal = clientModel->getNumBlocksAtStartup(); int nPercentageLeft = 100 - (count / (nTotal / 100)); QString tooltip; @@ -467,23 +469,12 @@ void BitcoinGUI::setNumBlocks(int count) if (clientModel->getStatusBarWarnings() == "") { progressBarLabel->setVisible(true); + progressBarLabel->setText(tr("Synchronizing with network...")); progressBar->setVisible(true); 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); - } - + progressBar->setMaximum(nTotal); + progressBar->setValue(count); } else {