mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-14 15:42:44 +02:00
qt, refactor: Replace BitcoinGUI::trayIconActivated with a lambda
This commit is contained in:
@ -789,7 +789,12 @@ void BitcoinGUI::createTrayIconMenu()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
trayIcon->setContextMenu(trayIconMenu.get());
|
trayIcon->setContextMenu(trayIconMenu.get());
|
||||||
connect(trayIcon, &QSystemTrayIcon::activated, this, &BitcoinGUI::trayIconActivated);
|
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
|
#else
|
||||||
// Note: On macOS, the Dock icon is used to provide the tray's functionality.
|
// Note: On macOS, the Dock icon is used to provide the tray's functionality.
|
||||||
MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance();
|
MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance();
|
||||||
@ -822,17 +827,6 @@ void BitcoinGUI::createTrayIconMenu()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
|
||||||
void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
|
|
||||||
{
|
|
||||||
if(reason == QSystemTrayIcon::Trigger)
|
|
||||||
{
|
|
||||||
// Click on system tray icon triggers show/hide of the main window
|
|
||||||
toggleHidden();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void BitcoinGUI::optionsClicked()
|
void BitcoinGUI::optionsClicked()
|
||||||
{
|
{
|
||||||
openOptionsDialogWithTab(OptionsDialog::TAB_MAIN);
|
openOptionsDialogWithTab(OptionsDialog::TAB_MAIN);
|
||||||
|
@ -302,10 +302,6 @@ public Q_SLOTS:
|
|||||||
void showDebugWindowActivateConsole();
|
void showDebugWindowActivateConsole();
|
||||||
/** Show help message dialog */
|
/** Show help message dialog */
|
||||||
void showHelpMessageClicked();
|
void showHelpMessageClicked();
|
||||||
#ifndef Q_OS_MAC
|
|
||||||
/** Handle tray icon clicked */
|
|
||||||
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
|
/** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
|
||||||
void showNormalIfMinimized() { showNormalIfMinimized(false); }
|
void showNormalIfMinimized() { showNormalIfMinimized(false); }
|
||||||
|
Reference in New Issue
Block a user