Merge pull request #699 from laanwj/about_qt
authorGavin Andresen <gavinandresen@gmail.com>
Mon, 19 Dec 2011 15:26:14 +0000 (07:26 -0800)
committerGavin Andresen <gavinandresen@gmail.com>
Mon, 19 Dec 2011 15:26:14 +0000 (07:26 -0800)
Add "About Qt" menu option to show built-in Qt About dialog

1  2 
src/qt/bitcoingui.cpp
src/qt/bitcoingui.h

diff --combined src/qt/bitcoingui.cpp
@@@ -2,7 -2,6 +2,7 @@@
   * Qt4 bitcoin GUI.
   *
   * W.J. van der Laan 2011
 + * The Bitcoin Developers 2011
   */
  #include "bitcoingui.h"
  #include "transactiontablemodel.h"
@@@ -57,6 -56,7 +57,7 @@@ BitcoinGUI::BitcoinGUI(QWidget *parent)
      walletModel(0),
      encryptWalletAction(0),
      changePassphraseAction(0),
+     aboutQtAction(0),
      trayIcon(0),
      notificator(0)
  {
@@@ -209,7 -209,10 +210,10 @@@ void BitcoinGUI::createActions(
      quitAction->setMenuRole(QAction::QuitRole);
      aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About %1").arg(qApp->applicationName()), this);
      aboutAction->setToolTip(tr("Show information about Bitcoin"));
-     aboutAction->setMenuRole(QAction::AboutQtRole);
+     aboutAction->setMenuRole(QAction::AboutRole);
+     aboutQtAction = new QAction(tr("About &Qt"), this);
+     aboutQtAction->setToolTip(tr("Show information about Qt"));
+     aboutQtAction->setMenuRole(QAction::AboutQtRole);
      optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this);
      optionsAction->setToolTip(tr("Modify configuration options for bitcoin"));
      optionsAction->setMenuRole(QAction::PreferencesRole);
      connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
      connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
      connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
+     connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
      connect(openBitcoinAction, SIGNAL(triggered()), this, SLOT(showNormal()));
      connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool)));
      connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase()));
@@@ -253,6 -257,7 +258,7 @@@ void BitcoinGUI::createMenuBar(
  
      QMenu *help = appMenuBar->addMenu(tr("&Help"));
      help->addAction(aboutAction);
+     help->addAction(aboutQtAction);
  }
  
  void BitcoinGUI::createToolBars()
@@@ -418,31 -423,15 +424,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);
      }
      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 --combined src/qt/bitcoingui.h
@@@ -82,6 -82,7 +82,7 @@@ private
      QAction *exportAction;
      QAction *encryptWalletAction;
      QAction *changePassphraseAction;
+     QAction *aboutQtAction;
  
      QSystemTrayIcon *trayIcon;
      Notificator *notificator;
@@@ -108,8 -109,6 +109,8 @@@ public slots
         @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);