diff options
Diffstat (limited to 'src/qt')
| -rw-r--r-- | src/qt/bitcoin.cpp | 4 | ||||
| -rw-r--r-- | src/qt/bitcoingui.cpp | 37 | ||||
| -rw-r--r-- | src/qt/bitcoingui.h | 9 | ||||
| -rw-r--r-- | src/qt/clientmodel.cpp | 2 | ||||
| -rw-r--r-- | src/qt/clientmodel.h | 2 | ||||
| -rw-r--r-- | src/qt/notificator.h | 8 | ||||
| -rw-r--r-- | src/qt/walletmodel.cpp | 2 | ||||
| -rw-r--r-- | src/qt/walletmodel.h | 2 |
8 files changed, 40 insertions, 26 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index d64114e13..dbdfade0b 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -45,7 +45,6 @@ static void ThreadSafeMessageBox(const std::string& message, const std::string& modal ? GUIUtil::blockingGUIThreadConnection() : Qt::QueuedConnection, Q_ARG(QString, QString::fromStdString(caption)), Q_ARG(QString, QString::fromStdString(message)), - Q_ARG(bool, modal), Q_ARG(unsigned int, style)); } else @@ -55,12 +54,13 @@ static void ThreadSafeMessageBox(const std::string& message, const std::string& } } -static bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption) +static bool ThreadSafeAskFee(int64 nFeeRequired) { if(!guiref) return false; if(nFeeRequired < MIN_TX_FEE || nFeeRequired <= nTransactionFee || fDaemon) return true; + bool payFee = false; QMetaObject::invokeMethod(guiref, "askFee", GUIUtil::blockingGUIThreadConnection(), diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index e2350c09e..3fe86501f 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -90,7 +90,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): // Create the toolbars createToolBars(); - // Create the tray icon (or setup the dock icon) + // Create system tray icon and notification createTrayIcon(); // Create tabs @@ -354,12 +354,17 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel) // Just attach " [testnet]" to the existing tooltip trayIcon->setToolTip(trayIcon->toolTip() + QString(" ") + tr("[testnet]")); trayIcon->setIcon(QIcon(":/icons/toolbar_testnet")); - toggleHideAction->setIcon(QIcon(":/icons/toolbar_testnet")); } + toggleHideAction->setIcon(QIcon(":/icons/toolbar_testnet")); aboutAction->setIcon(QIcon(":/icons/toolbar_testnet")); } + // Create system tray menu (or setup the dock menu) that late to prevent users from calling actions, + // while the client has not yet fully loaded + if(trayIcon) + createTrayIconMenu(); + // Keep up to date with client setNumConnections(clientModel->getNumConnections()); connect(clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int))); @@ -368,7 +373,7 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel) connect(clientModel, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int))); // Receive and report messages from network/worker thread - connect(clientModel, SIGNAL(message(QString,QString,bool,unsigned int)), this, SLOT(message(QString,QString,bool,unsigned int))); + connect(clientModel, SIGNAL(message(QString,QString,unsigned int)), this, SLOT(message(QString,QString,unsigned int))); overviewPage->setClientModel(clientModel); rpcConsole->setClientModel(clientModel); @@ -383,7 +388,7 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel) if(walletModel) { // Receive and report messages from wallet thread - connect(walletModel, SIGNAL(message(QString,QString,bool,unsigned int)), this, SLOT(message(QString,QString,bool,unsigned int))); + connect(walletModel, SIGNAL(message(QString,QString,unsigned int)), this, SLOT(message(QString,QString,unsigned int))); // Put transaction list in tabs transactionView->setModel(walletModel); @@ -407,16 +412,26 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel) void BitcoinGUI::createTrayIcon() { - QMenu *trayIconMenu; #ifndef Q_OS_MAC trayIcon = new QSystemTrayIcon(this); - trayIconMenu = new QMenu(this); - trayIcon->setContextMenu(trayIconMenu); + trayIcon->setToolTip(tr("Bitcoin client")); trayIcon->setIcon(QIcon(":/icons/toolbar")); + trayIcon->show(); +#endif + + notificator = new Notificator(qApp->applicationName(), trayIcon); +} + +void BitcoinGUI::createTrayIconMenu() +{ + QMenu *trayIconMenu; +#ifndef Q_OS_MAC + trayIconMenu = new QMenu(this); + trayIcon->setContextMenu(trayIconMenu); + connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason))); - trayIcon->show(); #else // Note: On Mac, the dock icon is used to provide the tray's functionality. MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance(); @@ -438,8 +453,6 @@ void BitcoinGUI::createTrayIcon() trayIconMenu->addSeparator(); trayIconMenu->addAction(quitAction); #endif - - notificator = new Notificator(qApp->applicationName(), trayIcon); } #ifndef Q_OS_MAC @@ -593,7 +606,7 @@ void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks) progressBar->setToolTip(tooltip); } -void BitcoinGUI::message(const QString &title, const QString &message, bool modal, unsigned int style) +void BitcoinGUI::message(const QString &title, const QString &message, unsigned int style) { QString strTitle = tr("Bitcoin") + " - "; // Default to information icon @@ -626,7 +639,7 @@ void BitcoinGUI::message(const QString &title, const QString &message, bool moda } // Display message - if (modal) { + if (style & CClientUIInterface::MODAL) { // Check for buttons, use OK as default, if none was supplied QMessageBox::StandardButton buttons; if (!(buttons = (QMessageBox::StandardButton)(style & CClientUIInterface::BTN_MASK))) diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 151b108be..3faf6d948 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -105,8 +105,10 @@ private: void createMenuBar(); /** Create the toolbars */ void createToolBars(); - /** Create system tray (notification) icon */ + /** Create system tray icon and notification */ void createTrayIcon(); + /** Create system tray menu (or setup the dock menu) */ + void createTrayIconMenu(); public slots: /** Set number of connections shown in the UI */ @@ -122,11 +124,10 @@ public slots: /** Notify the user of an event from the core network or transaction handling code. @param[in] title the message box / notification title @param[in] message the displayed text - @param[in] modal true to use a message box, false to use a notification - @param[in] style style definitions (icon and used buttons - buttons only for message boxes) + @param[in] style modality and style definitions (icon and used buttons - buttons only for message boxes) @see CClientUIInterface::MessageBoxFlags */ - void message(const QString &title, const QString &message, bool modal, unsigned int style); + void message(const QString &title, const QString &message, unsigned int style); /** Asks the user whether to pay the transaction fee or to cancel the transaction. It is currently not possible to pass a return value to another thread through BlockingQueuedConnection, so an indirected pointer is used. diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index f8fa41201..ce112803f 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -84,7 +84,7 @@ void ClientModel::updateAlert(const QString &hash, int status) CAlert alert = CAlert::getAlertByHash(hash_256); if(!alert.IsNull()) { - emit message(tr("Network Alert"), QString::fromStdString(alert.strStatusBar), false, CClientUIInterface::ICON_ERROR); + emit message(tr("Network Alert"), QString::fromStdString(alert.strStatusBar), CClientUIInterface::ICON_ERROR); } } diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index b16b2d500..1afccb785 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -71,7 +71,7 @@ signals: void alertsChanged(const QString &warnings); //! Asynchronous message notification - void message(const QString &title, const QString &message, bool modal, unsigned int style); + void message(const QString &title, const QString &message, unsigned int style); public slots: void updateTimer(); diff --git a/src/qt/notificator.h b/src/qt/notificator.h index abb47109b..833b52cb1 100644 --- a/src/qt/notificator.h +++ b/src/qt/notificator.h @@ -46,11 +46,11 @@ public slots: private: QWidget *parent; enum Mode { - None, /**< Ignore informational notifications, and show a modal pop-up dialog for Critical notifications. */ - Freedesktop, /**< Use DBus org.freedesktop.Notifications */ - QSystemTray, /**< Use QSystemTray::showMessage */ + None, /**< Ignore informational notifications, and show a modal pop-up dialog for Critical notifications. */ + Freedesktop, /**< Use DBus org.freedesktop.Notifications */ + QSystemTray, /**< Use QSystemTray::showMessage */ Growl12, /**< Use the Growl 1.2 notification system (Mac only) */ - Growl13 /**< Use the Growl 1.3 notification system (Mac only) */ + Growl13 /**< Use the Growl 1.3 notification system (Mac only) */ }; QString programName; Mode mode; diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 3568616cd..9d5a2c04f 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -189,7 +189,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(const QList<SendCoinsRecipie } return TransactionCreationFailed; } - if(!uiInterface.ThreadSafeAskFee(nFeeRequired, tr("Sending...").toStdString())) + if(!uiInterface.ThreadSafeAskFee(nFeeRequired)) { return Aborted; } diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index 3c8d5903b..fd5c8c4d4 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -148,7 +148,7 @@ signals: void requireUnlock(); // Asynchronous message notification - void message(const QString &title, const QString &message, bool modal, unsigned int style); + void message(const QString &title, const QString &message, unsigned int style); public slots: /* Wallet status might have changed */ |