aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoingui.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-05-12 11:46:58 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-05-12 11:56:21 +0200
commit7c8558da362fda976eaef44bb0fbb63ae3082d17 (patch)
treea3aab66893f5a23af3269b0f1f9d6629d9813313 /src/qt/bitcoingui.cpp
parent2efe38b8323c77d259bbf87280c5e5e634f3f475 (diff)
parent8b0e4970281de15472a93a529302f3de15163943 (diff)
downloadbitcoin-7c8558da362fda976eaef44bb0fbb63ae3082d17.tar.xz
Merge #8006: Qt: Add option to disable the system tray icon
8b0e497 Qt: Add option to hide the system tray icon (Tyler Hardin)
Diffstat (limited to 'src/qt/bitcoingui.cpp')
-rw-r--r--src/qt/bitcoingui.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index b00cdfcaf2..9984486364 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -474,6 +474,16 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel)
}
#endif // ENABLE_WALLET
unitDisplayControl->setOptionsModel(clientModel->getOptionsModel());
+
+ OptionsModel* optionsModel = clientModel->getOptionsModel();
+ if(optionsModel)
+ {
+ // be aware of the tray icon disable state change reported by the OptionsModel object.
+ connect(optionsModel,SIGNAL(hideTrayIconChanged(bool)),this,SLOT(setTrayIconVisible(bool)));
+
+ // initialize the disable state of the tray icon with the current value in the model.
+ setTrayIconVisible(optionsModel->getHideTrayIcon());
+ }
} else {
// Disable possibility to show main window via action
toggleHideAction->setEnabled(false);
@@ -535,7 +545,7 @@ void BitcoinGUI::createTrayIcon(const NetworkStyle *networkStyle)
QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + networkStyle->getTitleAddText();
trayIcon->setToolTip(toolTip);
trayIcon->setIcon(networkStyle->getTrayAndWindowIcon());
- trayIcon->show();
+ trayIcon->hide();
#endif
notificator = new Notificator(QApplication::applicationName(), trayIcon, this);
@@ -1044,6 +1054,14 @@ void BitcoinGUI::showProgress(const QString &title, int nProgress)
progressDialog->setValue(nProgress);
}
+void BitcoinGUI::setTrayIconVisible(bool fHideTrayIcon)
+{
+ if (trayIcon)
+ {
+ trayIcon->setVisible(!fHideTrayIcon);
+ }
+}
+
static bool ThreadSafeMessageBox(BitcoinGUI *gui, const std::string& message, const std::string& caption, unsigned int style)
{
bool modal = (style & CClientUIInterface::MODAL);