mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-19 18:09:47 +01:00
Merge #15000: qt: Fix broken notificator on GNOME
c8d9d9093b
Fix broken notificator on GNOME (Hennadii Stepanov)
Pull request description:
Fix #14994; that bug was introduced in #14228 (that was my fault).
~Also this commit explicit separates~ There are two functions of the tray icon:
- a system tray widget (`QSystemTrayIcon::isSystemTrayAvailable() == true`)
- a high-level notificator via balloon messages (`QSystemTrayIcon::supportsMessages() == true`)
~These properties are mutually independent,~ e.g., on Fedora 29 + GNOME:
```
QSystemTrayIcon::isSystemTrayAvailable() == false;
QSystemTrayIcon::supportsMessages() == true;
```
UPDATE:
`supportsMessages()` makes no sense without `isSystemTrayAvailable()`: `QSystemTrayIcon::showMessage()` just not working on Fedora 29 + GNOME.
Tree-SHA512: 3e75ed2dfcef112bd64b8c329227ae68ba57f3be55769629f4eb3b1c52ef1f33db635f00bb5fd57c25f73a692971d6a847ea14c525f41c594fddde6e970a8ad8
This commit is contained in:
commit
fb52d0684e
@ -129,6 +129,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
|
|||||||
if (QSystemTrayIcon::isSystemTrayAvailable()) {
|
if (QSystemTrayIcon::isSystemTrayAvailable()) {
|
||||||
createTrayIcon(networkStyle);
|
createTrayIcon(networkStyle);
|
||||||
}
|
}
|
||||||
|
notificator = new Notificator(QApplication::applicationName(), trayIcon, this);
|
||||||
|
|
||||||
// Create status bar
|
// Create status bar
|
||||||
statusBar();
|
statusBar();
|
||||||
@ -536,8 +537,7 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
|
|||||||
unitDisplayControl->setOptionsModel(_clientModel->getOptionsModel());
|
unitDisplayControl->setOptionsModel(_clientModel->getOptionsModel());
|
||||||
|
|
||||||
OptionsModel* optionsModel = _clientModel->getOptionsModel();
|
OptionsModel* optionsModel = _clientModel->getOptionsModel();
|
||||||
if(optionsModel)
|
if (optionsModel && trayIcon) {
|
||||||
{
|
|
||||||
// be aware of the tray icon disable state change reported by the OptionsModel object.
|
// be aware of the tray icon disable state change reported by the OptionsModel object.
|
||||||
connect(optionsModel, &OptionsModel::hideTrayIconChanged, this, &BitcoinGUI::setTrayIconVisible);
|
connect(optionsModel, &OptionsModel::hideTrayIconChanged, this, &BitcoinGUI::setTrayIconVisible);
|
||||||
|
|
||||||
@ -642,14 +642,10 @@ void BitcoinGUI::createTrayIcon(const NetworkStyle *networkStyle)
|
|||||||
assert(QSystemTrayIcon::isSystemTrayAvailable());
|
assert(QSystemTrayIcon::isSystemTrayAvailable());
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
trayIcon = new QSystemTrayIcon(this);
|
trayIcon = new QSystemTrayIcon(networkStyle->getTrayAndWindowIcon(), this);
|
||||||
QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + networkStyle->getTitleAddText();
|
QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + networkStyle->getTitleAddText();
|
||||||
trayIcon->setToolTip(toolTip);
|
trayIcon->setToolTip(toolTip);
|
||||||
trayIcon->setIcon(networkStyle->getTrayAndWindowIcon());
|
|
||||||
trayIcon->hide();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
notificator = new Notificator(QApplication::applicationName(), trayIcon, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::createTrayIconMenu()
|
void BitcoinGUI::createTrayIconMenu()
|
||||||
|
Loading…
Reference in New Issue
Block a user