aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2018-11-02 10:58:14 +0200
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2018-12-30 11:21:54 +0000
commit0c2fb87dc1ec1b13fa7abab038f6c52ce0c749e9 (patch)
treef898d9e09fc0dff68ad21b4376702df9c2bf1dcc /src/qt
parent90347141bdb4020875c55ff51375aada46a1a4d9 (diff)
Remove obj_c for macOS Dock icon menu
Qt `setAsDockMenu()` does this work. Github-Pull: #14597 Rebased-From: 6b1d2972bf9a40f97ba3a5c95831fd179b1054cf
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/bitcoingui.cpp4
-rw-r--r--src/qt/macdockiconhandler.h11
-rw-r--r--src/qt/macdockiconhandler.mm25
3 files changed, 4 insertions, 36 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index a8b9aef9ad..018e6a179c 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -598,7 +598,9 @@ void BitcoinGUI::createTrayIconMenu()
// Note: On macOS, the Dock icon is used to provide the tray's functionality.
MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance();
connect(dockIconHandler, &MacDockIconHandler::dockIconClicked, this, &BitcoinGUI::macosDockIconActivated);
- trayIconMenu = dockIconHandler->dockMenu();
+
+ trayIconMenu = new QMenu(this);
+ trayIconMenu->setAsDockMenu();
#endif
// Configuration of the tray icon (or Dock icon) menu
diff --git a/src/qt/macdockiconhandler.h b/src/qt/macdockiconhandler.h
index ea77cdf054..ff867e21a7 100644
--- a/src/qt/macdockiconhandler.h
+++ b/src/qt/macdockiconhandler.h
@@ -7,11 +7,6 @@
#include <QObject>
-QT_BEGIN_NAMESPACE
-class QMenu;
-class QWidget;
-QT_END_NAMESPACE
-
/** macOS-specific Dock icon handler.
*/
class MacDockIconHandler : public QObject
@@ -19,9 +14,6 @@ class MacDockIconHandler : public QObject
Q_OBJECT
public:
- ~MacDockIconHandler();
-
- QMenu *dockMenu();
static MacDockIconHandler *instance();
static void cleanup();
@@ -30,9 +22,6 @@ Q_SIGNALS:
private:
MacDockIconHandler();
-
- QWidget *m_dummyWidget;
- QMenu *m_dockMenu;
};
#endif // BITCOIN_QT_MACDOCKICONHANDLER_H
diff --git a/src/qt/macdockiconhandler.mm b/src/qt/macdockiconhandler.mm
index a356617697..102adce6c5 100644
--- a/src/qt/macdockiconhandler.mm
+++ b/src/qt/macdockiconhandler.mm
@@ -4,17 +4,13 @@
#include "macdockiconhandler.h"
-#include <QMenu>
-#include <QWidget>
-
#undef slots
-#include <Cocoa/Cocoa.h>
#include <objc/objc.h>
#include <objc/message.h>
static MacDockIconHandler *s_instance = nullptr;
-bool dockClickHandler(id self,SEL _cmd,...) {
+bool dockClickHandler(id self, SEL _cmd, ...) {
Q_UNUSED(self)
Q_UNUSED(_cmd)
@@ -32,28 +28,9 @@ void setupDockClickHandler() {
class_replaceMethod(delClass, shouldHandle, (IMP)dockClickHandler, "B@:");
}
-
MacDockIconHandler::MacDockIconHandler() : QObject()
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
setupDockClickHandler();
- this->m_dummyWidget = new QWidget();
- this->m_dockMenu = new QMenu(this->m_dummyWidget);
-#if QT_VERSION >= 0x050200
- this->m_dockMenu->setAsDockMenu();
-#endif
- [pool release];
-}
-
-MacDockIconHandler::~MacDockIconHandler()
-{
- delete this->m_dummyWidget;
-}
-
-QMenu *MacDockIconHandler::dockMenu()
-{
- return this->m_dockMenu;
}
MacDockIconHandler *MacDockIconHandler::instance()