Browse Source

Merge pull request #897 from laanwj/2012_02_fixnegativesecs

In UI, handle cases in which the last received block was generated in the future
0.8
Wladimir J. van der Laan 13 years ago
parent
commit
da9ab62fb7
  1. 15
      src/qt/bitcoingui.cpp

15
src/qt/bitcoingui.cpp

@ -505,7 +505,11 @@ void BitcoinGUI::setNumBlocks(int count)
QString text; QString text;
// Represent time from last generated block in human readable text // Represent time from last generated block in human readable text
if(secs < 60) if(secs <= 0)
{
// Fully up to date. Leave text empty.
}
else if(secs < 60)
{ {
text = tr("%n second(s) ago","",secs); text = tr("%n second(s) ago","",secs);
} }
@ -525,7 +529,7 @@ void BitcoinGUI::setNumBlocks(int count)
// Set icon state: spinning if catching up, tick otherwise // Set icon state: spinning if catching up, tick otherwise
if(secs < 30*60) if(secs < 30*60)
{ {
tooltip = tr("Up to date") + QString("\n") + tooltip; tooltip = tr("Up to date") + QString(".\n") + tooltip;
labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
} }
else else
@ -535,8 +539,11 @@ void BitcoinGUI::setNumBlocks(int count)
syncIconMovie->start(); syncIconMovie->start();
} }
tooltip += QString("\n"); if(!text.isEmpty())
tooltip += tr("Last received block was generated %1.").arg(text); {
tooltip += QString("\n");
tooltip += tr("Last received block was generated %1.").arg(text);
}
labelBlocksIcon->setToolTip(tooltip); labelBlocksIcon->setToolTip(tooltip);
progressBarLabel->setToolTip(tooltip); progressBarLabel->setToolTip(tooltip);

Loading…
Cancel
Save