diff options
author | Romain Perier <romain.perier@gmail.com> | 2013-05-11 09:28:53 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-16 10:45:04 +0200 |
commit | 94c7002df30d931df13b3bae9d4c46ff1e6f714c (patch) | |
tree | 17cb12d18eb5437ad4fbf16f5e8d2804924ffcaa /src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm | |
parent | adaa50e37da1fddada874a289792a1bd95c5aebc (diff) |
Improve Qt-in-namespace implementation in the Cocoa platform plugin
Objective-C++ does not support namespaces. In order to make this work,
we decorate each symbol with suffix using the macro QT_MANGLE_NAMESPACE.
However, with such a technic each public symbol needs to be explicitly exported through
this macro. The use of @compatibility_alias allows to define alias to use it
automatically and transparently.
Task-number: QTBUG-23946
Change-Id: Id521b8160bab126fda40a9d960277b1c04cc8b66
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm')
-rwxr-xr-x | src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm index 99f533b33a..83c960d931 100755 --- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm @@ -135,12 +135,16 @@ QT_USE_NAMESPACE -(id)initWithQMenu:(QPlatformMenu*)qmenu; @end +QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSStatusItem); +QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSImageView); +QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSMenu); + QT_BEGIN_NAMESPACE class QSystemTrayIconSys { public: QSystemTrayIconSys(QCocoaSystemTrayIcon *sys) { - item = [[QT_MANGLE_NAMESPACE(QNSStatusItem) alloc] initWithSysTray:sys]; + item = [[QNSStatusItem alloc] initWithSysTray:sys]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) { [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:item]; @@ -156,7 +160,7 @@ public: #endif [item release]; } - QT_MANGLE_NAMESPACE(QNSStatusItem) *item; + QNSStatusItem *item; }; void QCocoaSystemTrayIcon::init() @@ -310,8 +314,8 @@ QT_END_NAMESPACE @implementation NSStatusItem (Qt) @end -@implementation QT_MANGLE_NAMESPACE(QNSImageView) --(id)initWithParent:(QT_MANGLE_NAMESPACE(QNSStatusItem)*)myParent { +@implementation QNSImageView +-(id)initWithParent:(QNSStatusItem*)myParent { self = [super init]; parent = myParent; down = NO; @@ -406,7 +410,7 @@ QT_END_NAMESPACE } @end -@implementation QT_MANGLE_NAMESPACE(QNSStatusItem) +@implementation QNSStatusItem -(id)initWithSysTray:(QCocoaSystemTrayIcon *)sys { @@ -416,7 +420,7 @@ QT_END_NAMESPACE menu = 0; menuVisible = false; systray = sys; - imageCell = [[QT_MANGLE_NAMESPACE(QNSImageView) alloc] initWithParent:self]; + imageCell = [[QNSImageView alloc] initWithParent:self]; [item setView: imageCell]; } return self; @@ -494,7 +498,7 @@ private: QSystemTrayIconQMenu(); }; -@implementation QT_MANGLE_NAMESPACE(QNSMenu) +@implementation QNSMenu -(id)initWithQMenu:(QPlatformMenu*)qm { self = [super init]; if (self) { |