Fix "Last received block was generated Up to date"

This commit is contained in:
Wladimir J. van der Laan 2011-07-18 06:55:05 +02:00
parent 1907b96d69
commit a75e1e3292

View file

@ -334,13 +334,11 @@ void BitcoinGUI::setNumBlocks(int count)
QDateTime lastBlockDate = clientModel->getLastBlockDate(); QDateTime lastBlockDate = clientModel->getLastBlockDate();
int secs = lastBlockDate.secsTo(now); int secs = lastBlockDate.secsTo(now);
QString text; QString text;
bool spinning = true;
// "Up to date" icon, and outdated icon // Represent time from last generated block in human readable text
if(secs < 30*60) if(secs < 60)
{ {
text = "Up to date"; text = tr("%n second(s) ago","",secs);
spinning = false;
} }
else if(secs < 60*60) else if(secs < 60*60)
{ {
@ -354,6 +352,16 @@ void BitcoinGUI::setNumBlocks(int count)
{ {
text = tr("%n day(s) ago","",secs/(60*60*24)); text = tr("%n day(s) ago","",secs/(60*60*24));
} }
// In the label we want to be less specific
QString labelText = text;
bool spinning = true;
if(secs < 30*60)
{
labelText = "Up to date";
spinning = false;
}
tooltip += QString("\n"); tooltip += QString("\n");
tooltip += tr("Last received block was generated %1.").arg(text); tooltip += tr("Last received block was generated %1.").arg(text);
@ -366,7 +374,7 @@ void BitcoinGUI::setNumBlocks(int count)
{ {
labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(16,16)); labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(16,16));
} }
labelBlocks->setText(text); labelBlocks->setText(labelText);
labelBlocksIcon->setToolTip(tooltip); labelBlocksIcon->setToolTip(tooltip);
labelBlocks->setToolTip(tooltip); labelBlocks->setToolTip(tooltip);