|
|
|
@ -67,7 +67,8 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
@@ -67,7 +67,8 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
|
|
|
|
|
aboutQtAction(0), |
|
|
|
|
trayIcon(0), |
|
|
|
|
notificator(0), |
|
|
|
|
rpcConsole(0) |
|
|
|
|
rpcConsole(0), |
|
|
|
|
prevBlocks(0) |
|
|
|
|
{ |
|
|
|
|
resize(850, 550); |
|
|
|
|
setWindowTitle(tr("Bitcoin") + " - " + tr("Wallet")); |
|
|
|
@ -527,75 +528,66 @@ void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
@@ -527,75 +528,66 @@ void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
|
|
|
|
|
importText = tr("Reindexing blocks on disk..."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QDateTime lastBlockDate = clientModel->getLastBlockDate(); |
|
|
|
|
QDateTime currentDate = QDateTime::currentDateTime(); |
|
|
|
|
int secs = lastBlockDate.secsTo(currentDate); |
|
|
|
|
|
|
|
|
|
if(count < nTotalBlocks) |
|
|
|
|
{ |
|
|
|
|
int nRemainingBlocks = nTotalBlocks - count; |
|
|
|
|
float nPercentageDone = count / (nTotalBlocks * 0.01f); |
|
|
|
|
|
|
|
|
|
progressBarLabel->setText(importText); |
|
|
|
|
progressBarLabel->setVisible(true); |
|
|
|
|
progressBar->setFormat(tr("~%n block(s) remaining", "", nRemainingBlocks)); |
|
|
|
|
progressBar->setMaximum(nTotalBlocks); |
|
|
|
|
progressBar->setValue(count); |
|
|
|
|
progressBar->setVisible(true); |
|
|
|
|
|
|
|
|
|
tooltip = tr("Processed %1 of %2 blocks of transaction history (%3% done).").arg(count).arg(nTotalBlocks).arg(nPercentageDone, 0, 'f', 2); |
|
|
|
|
tooltip = tr("Processed %1 of %2 (estimated) blocks of transaction history.").arg(count).arg(nTotalBlocks); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
progressBarLabel->setVisible(false); |
|
|
|
|
|
|
|
|
|
progressBar->setVisible(false); |
|
|
|
|
tooltip = tr("Processed %1 blocks of transaction history.").arg(count); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QDateTime lastBlockDate = clientModel->getLastBlockDate(); |
|
|
|
|
int secs = lastBlockDate.secsTo(QDateTime::currentDateTime()); |
|
|
|
|
QString text; |
|
|
|
|
|
|
|
|
|
// Represent time from last generated block in human readable text
|
|
|
|
|
if(secs <= 0) |
|
|
|
|
// Set icon state: spinning if catching up, tick otherwise
|
|
|
|
|
if(secs < 90*60 && count >= nTotalBlocks) |
|
|
|
|
{ |
|
|
|
|
// Fully up to date. Leave text empty.
|
|
|
|
|
tooltip = tr("Up to date") + QString(".<br>") + tooltip; |
|
|
|
|
labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); |
|
|
|
|
|
|
|
|
|
overviewPage->showOutOfSyncWarning(false); |
|
|
|
|
|
|
|
|
|
progressBarLabel->setVisible(false); |
|
|
|
|
progressBar->setVisible(false); |
|
|
|
|
} |
|
|
|
|
else if(secs < 60) |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
text = tr("%n second(s) ago","",secs); |
|
|
|
|
} |
|
|
|
|
else if(secs < 60*60) |
|
|
|
|
// Represent time from last generated block in human readable text
|
|
|
|
|
QString timeBehindText; |
|
|
|
|
if(secs < 48*60*60) |
|
|
|
|
{ |
|
|
|
|
text = tr("%n minute(s) ago","",secs/60); |
|
|
|
|
timeBehindText = tr("%n hour(s)","",secs/(60*60)); |
|
|
|
|
} |
|
|
|
|
else if(secs < 24*60*60) |
|
|
|
|
else if(secs < 14*24*60*60) |
|
|
|
|
{ |
|
|
|
|
text = tr("%n hour(s) ago","",secs/(60*60)); |
|
|
|
|
timeBehindText = tr("%n day(s)","",secs/(24*60*60)); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
text = tr("%n day(s) ago","",secs/(60*60*24)); |
|
|
|
|
timeBehindText = tr("%n week(s)","",secs/(7*24*60*60)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Set icon state: spinning if catching up, tick otherwise
|
|
|
|
|
if(secs < 90*60 && count >= nTotalBlocks) |
|
|
|
|
{ |
|
|
|
|
tooltip = tr("Up to date") + QString(".<br>") + tooltip; |
|
|
|
|
labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); |
|
|
|
|
progressBarLabel->setText(importText); |
|
|
|
|
progressBarLabel->setVisible(true); |
|
|
|
|
progressBar->setFormat(tr("%1 behind").arg(timeBehindText)); |
|
|
|
|
progressBar->setMaximum(totalSecs); |
|
|
|
|
progressBar->setValue(totalSecs - secs); |
|
|
|
|
progressBar->setVisible(true); |
|
|
|
|
|
|
|
|
|
overviewPage->showOutOfSyncWarning(false); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
tooltip = tr("Catching up...") + QString("<br>") + tooltip; |
|
|
|
|
labelBlocksIcon->setMovie(syncIconMovie); |
|
|
|
|
syncIconMovie->start(); |
|
|
|
|
if(count != prevBlocks) |
|
|
|
|
syncIconMovie->jumpToNextFrame(); |
|
|
|
|
prevBlocks = count; |
|
|
|
|
|
|
|
|
|
overviewPage->showOutOfSyncWarning(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(!text.isEmpty()) |
|
|
|
|
{ |
|
|
|
|
tooltip += QString("<br>"); |
|
|
|
|
tooltip += tr("Last received block was generated %1.").arg(text); |
|
|
|
|
tooltip += tr("Last received block was generated %1 ago.").arg(timeBehindText); |
|
|
|
|
tooltip += QString("<br>"); |
|
|
|
|
tooltip += tr("Transactions after this will not yet be visible."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Don't word-wrap this (fixed-width) tooltip
|
|
|
|
|