Fix empty tooltip during sync under specific conditions (#1637)

* Fix empty tooltip during sync under specific conditions

* Move IsBlockchainSynced check
This commit is contained in:
diego-ab 2017-09-19 10:52:10 -04:00 committed by UdjinM6
parent 753b1e486b
commit 026ad8421a

View File

@ -1065,6 +1065,10 @@ void BitcoinGUI::setAdditionalDataSyncProgress(double nSyncProgress)
if(!clientModel)
return;
// No additional data sync should be happening while blockchain is not synced, nothing to update
if(!masternodeSync.IsBlockchainSynced())
return;
// Prevent orphan statusbar messages (e.g. hover Quit in main menu, wait until chain-sync starts -> garbelled text)
statusBar()->clearMessage();
@ -1073,37 +1077,34 @@ void BitcoinGUI::setAdditionalDataSyncProgress(double nSyncProgress)
// Set icon state: spinning if catching up, tick otherwise
QString theme = GUIUtil::getThemeName();
if(masternodeSync.IsBlockchainSynced())
{
QString strSyncStatus;
tooltip = tr("Up to date") + QString(".<br>") + tooltip;
QString strSyncStatus;
tooltip = tr("Up to date") + QString(".<br>") + tooltip;
if(masternodeSync.IsSynced()) {
progressBarLabel->setVisible(false);
progressBar->setVisible(false);
labelBlocksIcon->setPixmap(QIcon(":/icons/" + theme + "/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
} else {
if(masternodeSync.IsSynced()) {
progressBarLabel->setVisible(false);
progressBar->setVisible(false);
labelBlocksIcon->setPixmap(QIcon(":/icons/" + theme + "/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
} else {
labelBlocksIcon->setPixmap(platformStyle->SingleColorIcon(QString(
":/movies/spinner-%1").arg(spinnerFrame, 3, 10, QChar('0')))
.pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
spinnerFrame = (spinnerFrame + 1) % SPINNER_FRAMES;
labelBlocksIcon->setPixmap(platformStyle->SingleColorIcon(QString(
":/movies/spinner-%1").arg(spinnerFrame, 3, 10, QChar('0')))
.pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
spinnerFrame = (spinnerFrame + 1) % SPINNER_FRAMES;
#ifdef ENABLE_WALLET
if(walletFrame)
walletFrame->showOutOfSyncWarning(false);
if(walletFrame)
walletFrame->showOutOfSyncWarning(false);
#endif // ENABLE_WALLET
progressBar->setFormat(tr("Synchronizing additional data: %p%"));
progressBar->setMaximum(1000000000);
progressBar->setValue(nSyncProgress * 1000000000.0 + 0.5);
}
strSyncStatus = QString(masternodeSync.GetSyncStatus().c_str());
progressBarLabel->setText(strSyncStatus);
tooltip = strSyncStatus + QString("<br>") + tooltip;
progressBar->setFormat(tr("Synchronizing additional data: %p%"));
progressBar->setMaximum(1000000000);
progressBar->setValue(nSyncProgress * 1000000000.0 + 0.5);
}
strSyncStatus = QString(masternodeSync.GetSyncStatus().c_str());
progressBarLabel->setText(strSyncStatus);
tooltip = strSyncStatus + QString("<br>") + tooltip;
// Don't word-wrap this (fixed-width) tooltip
tooltip = QString("<nobr>") + tooltip + QString("</nobr>");