mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-21 05:39:11 -04:00
Added to fix from Dock Icon to Show/Hide for macOS platform
This commit is contained in:
parent
75ef4dceb5
commit
15f2ea4e29
4 changed files with 97 additions and 4 deletions
|
@ -33,6 +33,10 @@
|
|||
#include <retroshare/rsplugin.h>
|
||||
#include <retroshare/rsconfig.h>
|
||||
|
||||
#if defined(Q_OS_DARWIN)
|
||||
#include "gui/common/MacDockIconHandler.h"
|
||||
#endif
|
||||
|
||||
#ifdef MESSENGER_WINDOW
|
||||
#include "MessengerWindow.h"
|
||||
#endif
|
||||
|
@ -381,6 +385,7 @@ MainWindow::~MainWindow()
|
|||
#if defined(Q_OS_DARWIN)
|
||||
delete menuBar;
|
||||
delete dockMenu;
|
||||
MacDockIconHandler::cleanup();
|
||||
#endif
|
||||
// delete notifyMenu; // already deleted by the deletion of trayMenu
|
||||
StatisticsWindow::releaseInstance();
|
||||
|
@ -656,6 +661,15 @@ void MainWindow::createTrayIcon()
|
|||
trayIcon->setContextMenu(trayMenu);
|
||||
trayIcon->setIcon(QIcon(IMAGE_NOONLINE));
|
||||
|
||||
#if defined(Q_OS_DARWIN)
|
||||
// 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();
|
||||
});
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_DARWIN)
|
||||
createMenuBar();
|
||||
#endif
|
||||
|
@ -694,10 +708,6 @@ void MainWindow::createMenuBar()
|
|||
dockMenu->addAction(tr("Options"), this, SLOT(showSettings()));
|
||||
dockMenu->addAction(tr("Help"), this, SLOT(showHelpDialog()));
|
||||
|
||||
dockMenu->addSeparator();
|
||||
QObject::connect(dockMenu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
|
||||
toggleVisibilityAction = dockMenu->addAction(tr("Show/Hide"), this, SLOT(toggleVisibilitycontextmenu()));
|
||||
|
||||
dockMenu->addSeparator();
|
||||
QMenu *statusMenu = dockMenu->addMenu(tr("Status"));
|
||||
initializeStatusObject(statusMenu, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue