diff options
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/bitcoingui.cpp | 26 | ||||
-rw-r--r-- | src/qt/bitcoingui.h | 3 | ||||
-rw-r--r-- | src/qt/clientmodel.cpp | 6 | ||||
-rw-r--r-- | src/qt/clientmodel.h | 2 |
4 files changed, 36 insertions, 1 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index f487da709f..2dfcd40df3 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -36,6 +36,7 @@ #include <QSortFilterProxyModel> #include <QClipboard> #include <QMessageBox> +#include <QProgressBar> #include <QDebug> @@ -124,10 +125,19 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): labelTransactions->setMinimumWidth(130); labelTransactions->setToolTip(tr("Number of transactions in your wallet")); + // Progress bar for blocks download + progressBarLabel = new QLabel(tr("Downloading initial data...")); + progressBarLabel->setVisible(false); + progressBar = new QProgressBar(); + progressBar->setToolTip(tr("Initial block chain download in progress")); + progressBar->setVisible(false); + + statusBar()->addWidget(progressBarLabel); + statusBar()->addWidget(progressBar); statusBar()->addPermanentWidget(labelConnections); statusBar()->addPermanentWidget(labelBlocks); statusBar()->addPermanentWidget(labelTransactions); - + // Action bindings connect(button_new, SIGNAL(clicked()), this, SLOT(newAddressClicked())); connect(button_clipboard, SIGNAL(clicked()), this, SLOT(copyClipboardClicked())); @@ -360,6 +370,20 @@ void BitcoinGUI::setNumConnections(int count) void BitcoinGUI::setNumBlocks(int count) { + int total = model->getTotalBlocksEstimate(); + if(count < total) + { + progressBarLabel->setVisible(true); + progressBar->setVisible(true); + progressBar->setMaximum(total); + progressBar->setValue(count); + } + else + { + progressBarLabel->setVisible(false); + progressBar->setVisible(false); + } + labelBlocks->setText(QLocale::system().toString(count)+" "+tr("block(s)", "", count)); } diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index e1b3ef1783..b3559c3bcd 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -13,6 +13,7 @@ class QLineEdit; class QTableView; class QAbstractItemModel; class QModelIndex; +class QProgressBar; QT_END_NAMESPACE class BitcoinGUI : public QMainWindow @@ -43,6 +44,8 @@ private: QLabel *labelConnectionsIcon; QLabel *labelBlocks; QLabel *labelTransactions; + QLabel *progressBarLabel; + QProgressBar *progressBar; QAction *quit; QAction *sendcoins; diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 822c03d949..86fc8b32d3 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -143,6 +143,12 @@ bool ClientModel::inInitialBlockDownload() const return IsInitialBlockDownload(); } +int ClientModel::getTotalBlocksEstimate() const +{ + return GetTotalBlocksEstimate(); +} + + OptionsModel *ClientModel::getOptionsModel() { return optionsModel; diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index f5f12fcfd9..7141937441 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -36,6 +36,8 @@ public: /* Return true if core is doing initial block download */ bool inInitialBlockDownload() const; + /* Return conservative estimate of total number of blocks, or 0 if unknown */ + int getTotalBlocksEstimate() const; /* Set default address */ void setAddress(const QString &defaultAddress); |