mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-23 07:15:29 +01:00
qt, refactor: Fill up trayIconMenu before connections
This change is required for the following commits.
This commit is contained in:
parent
66afa286e5
commit
78189daac8
1 changed files with 24 additions and 24 deletions
|
@ -784,33 +784,16 @@ void BitcoinGUI::createTrayIcon()
|
||||||
void BitcoinGUI::createTrayIconMenu()
|
void BitcoinGUI::createTrayIconMenu()
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
// return if trayIcon is unset (only on non-macOSes)
|
if (!trayIcon) return;
|
||||||
if (!trayIcon)
|
#endif // Q_OS_MAC
|
||||||
return;
|
|
||||||
|
|
||||||
trayIcon->setContextMenu(trayIconMenu.get());
|
// Configuration of the tray icon (or Dock icon) menu.
|
||||||
connect(trayIcon, &QSystemTrayIcon::activated, [this](QSystemTrayIcon::ActivationReason reason) {
|
|
||||||
if (reason == QSystemTrayIcon::Trigger) {
|
|
||||||
// Click on system tray icon triggers show/hide of the main window
|
|
||||||
toggleHidden();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
#else
|
|
||||||
// Note: On macOS, the Dock icon is used to provide the tray's functionality.
|
|
||||||
MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance();
|
|
||||||
connect(dockIconHandler, &MacDockIconHandler::dockIconClicked, [this] {
|
|
||||||
show();
|
|
||||||
activateWindow();
|
|
||||||
});
|
|
||||||
trayIconMenu->setAsDockMenu();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Configuration of the tray icon (or Dock icon) menu
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
// Note: On macOS, the Dock icon's menu already has Show / Hide action.
|
// Note: On macOS, the Dock icon's menu already has Show / Hide action.
|
||||||
trayIconMenu->addAction(toggleHideAction);
|
trayIconMenu->addAction(toggleHideAction);
|
||||||
trayIconMenu->addSeparator();
|
trayIconMenu->addSeparator();
|
||||||
#endif
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
if (enableWallet) {
|
if (enableWallet) {
|
||||||
trayIconMenu->addAction(sendCoinsMenuAction);
|
trayIconMenu->addAction(sendCoinsMenuAction);
|
||||||
trayIconMenu->addAction(receiveCoinsMenuAction);
|
trayIconMenu->addAction(receiveCoinsMenuAction);
|
||||||
|
@ -821,10 +804,27 @@ void BitcoinGUI::createTrayIconMenu()
|
||||||
}
|
}
|
||||||
trayIconMenu->addAction(optionsAction);
|
trayIconMenu->addAction(optionsAction);
|
||||||
trayIconMenu->addAction(openRPCConsoleAction);
|
trayIconMenu->addAction(openRPCConsoleAction);
|
||||||
#ifndef Q_OS_MAC // This is built-in on macOS
|
#ifndef Q_OS_MAC
|
||||||
|
// Note: On macOS, the Dock icon's menu already has Quit action.
|
||||||
trayIconMenu->addSeparator();
|
trayIconMenu->addSeparator();
|
||||||
trayIconMenu->addAction(quitAction);
|
trayIconMenu->addAction(quitAction);
|
||||||
#endif
|
|
||||||
|
trayIcon->setContextMenu(trayIconMenu.get());
|
||||||
|
connect(trayIcon, &QSystemTrayIcon::activated, [this](QSystemTrayIcon::ActivationReason reason) {
|
||||||
|
if (reason == QSystemTrayIcon::Trigger) {
|
||||||
|
// Click on system tray icon triggers show/hide of the main window
|
||||||
|
toggleHidden();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
#else
|
||||||
|
// Note: On macOS, the Dock icon is used to provide the tray's functionality.
|
||||||
|
MacDockIconHandler* dockIconHandler = MacDockIconHandler::instance();
|
||||||
|
connect(dockIconHandler, &MacDockIconHandler::dockIconClicked, [this] {
|
||||||
|
show();
|
||||||
|
activateWindow();
|
||||||
|
});
|
||||||
|
trayIconMenu->setAsDockMenu();
|
||||||
|
#endif // Q_OS_MAC
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::optionsClicked()
|
void BitcoinGUI::optionsClicked()
|
||||||
|
|
Loading…
Add table
Reference in a new issue