* Qt4 bitcoin GUI.
*
* W.J. van der Laan 2011
+ * The Bitcoin Developers 2011
*/
#include "bitcoingui.h"
#include "transactiontablemodel.h"
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);
}
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
@see WalletModel::EncryptionStatus
*/
void setEncryptionStatus(int status);
+ /** Set the status bar text if there are any warnings (removes sync progress bar if applicable) */
+ void refreshStatusBar();
/** Notify the user of an error in the network or transaction handling code. */
void error(const QString &title, const QString &message);
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;