Skip to content

Commit 272c475

Browse files
hebastoUdjinM6
authored andcommitted
qt, refactor: Replace BitcoinGUI::trayIconActivated with a lambda
1 parent 4ac8ec1 commit 272c475

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

src/qt/bitcoingui.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,12 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
796796
#ifndef Q_OS_MAC
797797
// Show main window on tray icon click
798798
// Note: ignore this on Mac - this is not the way tray should work there
799-
connect(trayIcon, &QSystemTrayIcon::activated, this, &BitcoinGUI::trayIconActivated);
799+
connect(trayIcon, &QSystemTrayIcon::activated, [this](QSystemTrayIcon::ActivationReason reason) {
800+
if (reason == QSystemTrayIcon::Trigger) {
801+
// Click on system tray icon triggers show/hide of the main window
802+
toggleHidden();
803+
}
804+
});
800805
#else
801806
// Note: on macOS, the Dock icon is also used to provide menu functionality
802807
// similar to one for tray icon
@@ -1068,17 +1073,6 @@ void BitcoinGUI::createIconMenu(QMenu *pmenu)
10681073
#endif
10691074
}
10701075

1071-
#ifndef Q_OS_MAC
1072-
void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
1073-
{
1074-
if(reason == QSystemTrayIcon::Trigger)
1075-
{
1076-
// Click on system tray icon triggers show/hide of the main window
1077-
toggleHidden();
1078-
}
1079-
}
1080-
#endif
1081-
10821076
void BitcoinGUI::optionsClicked()
10831077
{
10841078
openOptionsDialogWithTab(OptionsDialog::TAB_MAIN);

src/qt/bitcoingui.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,6 @@ public Q_SLOTS:
371371
void showHelpMessageClicked();
372372
/** Show CoinJoin help message dialog */
373373
void showCoinJoinHelpClicked();
374-
#ifndef Q_OS_MAC
375-
/** Handle tray icon clicked */
376-
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
377-
#endif
378374

379375
/** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
380376
void showNormalIfMinimized() { showNormalIfMinimized(false); }

0 commit comments

Comments
 (0)