|
|
@ -35,6 +35,7 @@ |
|
|
|
#include <QMessageBox> |
|
|
|
#include <QMessageBox> |
|
|
|
#include <QProgressBar> |
|
|
|
#include <QProgressBar> |
|
|
|
#include <QStackedWidget> |
|
|
|
#include <QStackedWidget> |
|
|
|
|
|
|
|
#include <QDateTime> |
|
|
|
|
|
|
|
|
|
|
|
#include <QDebug> |
|
|
|
#include <QDebug> |
|
|
|
|
|
|
|
|
|
|
@ -109,11 +110,13 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): |
|
|
|
labelConnections = new QLabel(); |
|
|
|
labelConnections = new QLabel(); |
|
|
|
labelConnections->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
|
|
|
labelConnections->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
|
|
|
labelConnections->setMinimumWidth(150); |
|
|
|
labelConnections->setMinimumWidth(150); |
|
|
|
|
|
|
|
labelConnections->setMaximumWidth(150); |
|
|
|
labelConnections->setToolTip(tr("Number of connections to other clients")); |
|
|
|
labelConnections->setToolTip(tr("Number of connections to other clients")); |
|
|
|
|
|
|
|
|
|
|
|
labelBlocks = new QLabel(); |
|
|
|
labelBlocks = new QLabel(); |
|
|
|
labelBlocks->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
|
|
|
labelBlocks->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
|
|
|
labelBlocks->setMinimumWidth(130); |
|
|
|
labelBlocks->setMinimumWidth(150); |
|
|
|
|
|
|
|
labelBlocks->setMaximumWidth(150); |
|
|
|
labelBlocks->setToolTip(tr("Number of blocks in the block chain")); |
|
|
|
labelBlocks->setToolTip(tr("Number of blocks in the block chain")); |
|
|
|
|
|
|
|
|
|
|
|
// Progress bar for blocks download
|
|
|
|
// Progress bar for blocks download
|
|
|
@ -314,7 +317,34 @@ void BitcoinGUI::setNumBlocks(int count) |
|
|
|
progressBar->setVisible(false); |
|
|
|
progressBar->setVisible(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
labelBlocks->setText(tr("%n block(s)", "", count)); |
|
|
|
QDateTime now = QDateTime::currentDateTime(); |
|
|
|
|
|
|
|
QDateTime lastBlockDate = clientModel->getLastBlockDate(); |
|
|
|
|
|
|
|
int secs = lastBlockDate.secsTo(now); |
|
|
|
|
|
|
|
QString text; |
|
|
|
|
|
|
|
QString icon = ":/icons/notsynced"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// "Up to date" icon, and outdated icon
|
|
|
|
|
|
|
|
if(secs < 30*60) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
text = "Up to date"; |
|
|
|
|
|
|
|
icon = ":/icons/synced"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if(secs < 60*60) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
text = tr("%n minute(s) ago","",secs/60); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if(secs < 24*60*60) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
text = tr("%n hour(s) ago","",secs/(60*60)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
text = tr("%n day(s) ago","",secs/(60*60*24)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
labelBlocks->setText("<img src=\""+icon+"\"> " + text); |
|
|
|
|
|
|
|
labelBlocks->setToolTip(tr("%n block(s) in total, last block was generated %1", "", count) |
|
|
|
|
|
|
|
.arg(QLocale::system().toString(lastBlockDate))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void BitcoinGUI::setNumTransactions(int count) |
|
|
|
void BitcoinGUI::setNumTransactions(int count) |
|
|
|