aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorMatt Corallo <matt@bluematt.me>2011-12-13 14:00:21 -0500
committerLuke Dashjr <luke-jr+git@utopios.org>2011-12-13 16:17:58 -0500
commit181b863d224b5236b53309e7cb12b3927b240d70 (patch)
treef5f04e530d941442a6251e498b266e01abab6b44 /src/qt
parent142e5056cd8a62df838e9a3afee0f718faffd72b (diff)
downloadbitcoin-181b863d224b5236b53309e7cb12b3927b240d70.tar.xz
Fix status bar not displaying Alerts.
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/bitcoin.cpp2
-rw-r--r--src/qt/bitcoingui.cpp40
-rw-r--r--src/qt/bitcoingui.h2
-rw-r--r--src/qt/clientmodel.cpp5
-rw-r--r--src/qt/clientmodel.h2
5 files changed, 46 insertions, 5 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 6afa9671d0..2142db5a36 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -91,6 +91,8 @@ void UIThreadCall(boost::function0<void> fn)
void MainFrameRepaint()
{
+ if(guiref)
+ QMetaObject::invokeMethod(guiref, "refreshStatusBar", Qt::QueuedConnection);
}
void InitMessage(const std::string &message)
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 8641c723b0..5968aab6c4 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -2,6 +2,7 @@
* Qt4 bitcoin GUI.
*
* W.J. van der Laan 2011
+ * The Bitcoin Developers 2011
*/
#include "bitcoingui.h"
#include "transactiontablemodel.h"
@@ -412,15 +413,31 @@ void BitcoinGUI::setNumBlocks(int count)
if(count < total)
{
- progressBarLabel->setVisible(true);
- progressBar->setVisible(true);
- progressBar->setMaximum(total - initTotal);
- progressBar->setValue(count - initTotal);
+ if (clientModel->getStatusBarWarnings() == "")
+ {
+ progressBarLabel->setVisible(true);
+ progressBarLabel->setText(tr("Synchronizing with network..."));
+ progressBar->setVisible(true);
+ progressBar->setMaximum(total - initTotal);
+ progressBar->setValue(count - initTotal);
+ }
+ else
+ {
+ progressBarLabel->setText(clientModel->getStatusBarWarnings());
+ progressBarLabel->setVisible(true);
+ progressBar->setVisible(false);
+ }
tooltip = tr("Downloaded %1 of %2 blocks of transaction history.").arg(count).arg(total);
}
else
{
- progressBarLabel->setVisible(false);
+ if (clientModel->getStatusBarWarnings() == "")
+ progressBarLabel->setVisible(false);
+ else
+ {
+ progressBarLabel->setText(clientModel->getStatusBarWarnings());
+ progressBarLabel->setVisible(true);
+ }
progressBar->setVisible(false);
tooltip = tr("Downloaded %1 blocks of transaction history.").arg(count);
}
@@ -469,6 +486,19 @@ void BitcoinGUI::setNumBlocks(int count)
progressBar->setToolTip(tooltip);
}
+void BitcoinGUI::refreshStatusBar()
+{
+ /* Might display multiple times in the case of multiple alerts
+ static QString prevStatusBar;
+ QString newStatusBar = clientModel->getStatusBarWarnings();
+ if (prevStatusBar != newStatusBar)
+ {
+ prevStatusBar = newStatusBar;
+ error(tr("Network Alert"), newStatusBar);
+ }*/
+ setNumBlocks(clientModel->getNumBlocks());
+}
+
void BitcoinGUI::error(const QString &title, const QString &message)
{
// Report errors from network/worker thread
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index a912192196..581d393749 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -96,6 +96,8 @@ public slots:
void setNumConnections(int count);
void setNumBlocks(int count);
void setEncryptionStatus(int status);
+ /** Set the status bar text if there are any warnings (removes sync progress bar if applicable) */
+ void refreshStatusBar();
void error(const QString &title, const QString &message);
/* It is currently not possible to pass a return value to another thread through
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index 2ed3ce51df..5a0b4aa83c 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -72,6 +72,11 @@ int ClientModel::getNumBlocksOfPeers() const
return GetNumBlocksOfPeers();
}
+QString ClientModel::getStatusBarWarnings() const
+{
+ return QString::fromStdString(GetWarnings("statusbar"));
+}
+
OptionsModel *ClientModel::getOptionsModel()
{
return optionsModel;
diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h
index c68fb0f035..0b7c16d7a9 100644
--- a/src/qt/clientmodel.h
+++ b/src/qt/clientmodel.h
@@ -33,6 +33,8 @@ public:
bool inInitialBlockDownload() const;
// Return conservative estimate of total number of blocks, or 0 if unknown
int getNumBlocksOfPeers() const;
+ //! Return warnings to be displayed in status bar
+ QString getStatusBarWarnings() const;
QString formatFullVersion() const;