From c1abca564b4ff30d7d061394424f500143deb466 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 4 May 2010 09:43:12 +0200 Subject: Ensure that the Mac specific Qt classes are namespaced When configuring Qt to be in a namespace then the Mac specific Qt classes should be namespaced as well to prevent any duplicated class names when a non namespaced version of Qt is used in conjunction. Reviewed-by: Richard --- src/gui/dialogs/qcolordialog_mac.mm | 20 +++++++-------- src/gui/dialogs/qfiledialog_mac.mm | 32 +++++++++++------------ src/gui/dialogs/qfontdialog_mac.mm | 16 ++++++------ src/gui/dialogs/qnspanelproxy_mac.mm | 24 ++++++++--------- src/gui/dialogs/qpagesetupdialog_mac.mm | 8 +++--- src/gui/dialogs/qprintdialog_mac.mm | 8 +++--- src/gui/kernel/qsound_mac.mm | 6 ++--- src/gui/util/qsystemtrayicon_mac.mm | 37 +++++++++++++-------------- src/gui/widgets/qcocoatoolbardelegate_mac.mm | 2 +- src/gui/widgets/qcocoatoolbardelegate_mac_p.h | 2 +- src/gui/widgets/qmainwindowlayout_mac.mm | 2 +- 11 files changed, 78 insertions(+), 79 deletions(-) diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm index 8af0d2b..82cfa24 100644 --- a/src/gui/dialogs/qcolordialog_mac.mm +++ b/src/gui/dialogs/qcolordialog_mac.mm @@ -65,9 +65,9 @@ typedef float CGFloat; // Should only not be defined on 32-bit platforms QT_USE_NAMESPACE -@class QCocoaColorPanelDelegate; +@class QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate); -@interface QCocoaColorPanelDelegate : NSObject { +@interface QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) : NSObject { NSColorPanel *mColorPanel; NSView *mStolenContentView; NSButton *mOkButton; @@ -99,7 +99,7 @@ QT_USE_NAMESPACE - (void)setResultSet:(BOOL)result; @end -@implementation QCocoaColorPanelDelegate +@implementation QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) - (id)initWithColorPanel:(NSColorPanel *)panel stolenContentView:(NSView *)stolenContentView okButton:(NSButton *)okButton @@ -432,26 +432,26 @@ void QColorDialogPrivate::openCocoaColorPanel(const QColor &initial, [colorPanel setDefaultButtonCell:[okButton cell]]; } - delegate = [[QCocoaColorPanelDelegate alloc] initWithColorPanel:colorPanel + delegate = [[QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) alloc] initWithColorPanel:colorPanel stolenContentView:stolenContentView okButton:okButton cancelButton:cancelButton priv:this]; - [colorPanel setDelegate:static_cast(delegate)]; + [colorPanel setDelegate:static_cast(delegate)]; } [delegate setResultSet:false]; setCocoaPanelColor(initial); - [static_cast(delegate) showColorPanel]; + [static_cast(delegate) showColorPanel]; } void QColorDialogPrivate::closeCocoaColorPanel() { - [static_cast(delegate) onCancelClicked]; + [static_cast(delegate) onCancelClicked]; } void QColorDialogPrivate::releaseCocoaColorPanelDelegate() { - [static_cast(delegate) release]; + [static_cast(delegate) release]; } void QColorDialogPrivate::mac_nativeDialogModalHelp() @@ -471,13 +471,13 @@ void QColorDialogPrivate::mac_nativeDialogModalHelp() void QColorDialogPrivate::_q_macRunNativeAppModalPanel() { - [static_cast(delegate) exec]; + [static_cast(delegate) exec]; } void QColorDialogPrivate::setCocoaPanelColor(const QColor &color) { QMacCocoaAutoReleasePool pool; - QCocoaColorPanelDelegate *theDelegate = static_cast(delegate); + QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *theDelegate = static_cast(delegate); NSColor *nsColor; const QColor::Spec spec = color.spec(); if (spec == QColor::Cmyk) { diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index 28acf24..b07b1ea 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -82,9 +82,9 @@ QT_FORWARD_DECLARE_CLASS(QAction) QT_FORWARD_DECLARE_CLASS(QFileInfo) QT_USE_NAMESPACE -@class QNSOpenSavePanelDelegate; +@class QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate); -@interface QNSOpenSavePanelDelegate : NSObject { +@interface QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) : NSObject { @public NSOpenPanel *mOpenPanel; NSSavePanel *mSavePanel; @@ -123,7 +123,7 @@ QT_USE_NAMESPACE @end -@implementation QNSOpenSavePanelDelegate +@implementation QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) - (id)initWithAcceptMode:(QT_PREPEND_NAMESPACE(QFileDialog::AcceptMode))acceptMode title:(const QString &)title @@ -554,7 +554,7 @@ void QFileDialogPrivate::setDirectory_sys(const QString &directory) } #else QMacCocoaAutoReleasePool pool; - QNSOpenSavePanelDelegate *delegate = static_cast(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast(mDelegate); [delegate->mSavePanel setDirectory:qt_mac_QStringToNSString(directory)]; #endif } @@ -565,7 +565,7 @@ QString QFileDialogPrivate::directory_sys() const return mCurrentLocation; #else QMacCocoaAutoReleasePool pool; - QNSOpenSavePanelDelegate *delegate = static_cast(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast(mDelegate); return qt_mac_NSStringToQString([delegate->mSavePanel directory]); #endif } @@ -622,7 +622,7 @@ QStringList QFileDialogPrivate::selectedFiles_sys() const } #else QMacCocoaAutoReleasePool pool; - QNSOpenSavePanelDelegate *delegate = static_cast(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast(mDelegate); return [delegate selectedFiles]; #endif } @@ -633,7 +633,7 @@ void QFileDialogPrivate::setNameFilters_sys(const QStringList &filters) Q_UNUSED(filters); #else QMacCocoaAutoReleasePool pool; - QNSOpenSavePanelDelegate *delegate = static_cast(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast(mDelegate); bool hideDetails = q_func()->testOption(QFileDialog::HideNameFilterDetails); [delegate setNameFilters:filters hideDetails:hideDetails]; #endif @@ -645,7 +645,7 @@ void QFileDialogPrivate::setFilter_sys() #else Q_Q(QFileDialog); QMacCocoaAutoReleasePool pool; - QNSOpenSavePanelDelegate *delegate = static_cast(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast(mDelegate); *(delegate->mQDirFilter) = model->filter(); delegate->mFileMode = fileMode; [delegate->mSavePanel setTitle:qt_mac_QStringToNSString(q->windowTitle())]; @@ -668,7 +668,7 @@ void QFileDialogPrivate::selectNameFilter_sys(const QString &filter) NavCustomControl(mDialog, kNavCtlSelectCustomType, &navSpec); #else QMacCocoaAutoReleasePool pool; - QNSOpenSavePanelDelegate *delegate = static_cast(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast(mDelegate); [delegate->mPopUpButton selectItemAtIndex:index]; [delegate filterChanged:nil]; #endif @@ -681,7 +681,7 @@ QString QFileDialogPrivate::selectedNameFilter_sys() const int index = filterInfo.currentSelection; #else QMacCocoaAutoReleasePool pool; - QNSOpenSavePanelDelegate *delegate = static_cast(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast(mDelegate); int index = [delegate->mPopUpButton indexOfSelectedItem]; #endif return index != -1 ? nameFilters.at(index) : QString(); @@ -696,7 +696,7 @@ void QFileDialogPrivate::deleteNativeDialog_sys() mDialogStarted = false; #else QMacCocoaAutoReleasePool pool; - [reinterpret_cast(mDelegate) release]; + [reinterpret_cast(mDelegate) release]; mDelegate = 0; #endif nativeDialogInUse = false; @@ -1034,7 +1034,7 @@ void QFileDialogPrivate::createNSOpenSavePanelDelegate() bool selectDir = q->selectedFiles().isEmpty(); QString selection(selectDir ? q->directory().absolutePath() : q->selectedFiles().value(0)); - QNSOpenSavePanelDelegate *delegate = [[QNSOpenSavePanelDelegate alloc] + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) alloc] initWithAcceptMode:acceptMode title:q->windowTitle() nameFilters:q->nameFilters() @@ -1055,7 +1055,7 @@ bool QFileDialogPrivate::showCocoaFilePanel() Q_Q(QFileDialog); QMacCocoaAutoReleasePool pool; createNSOpenSavePanelDelegate(); - QNSOpenSavePanelDelegate *delegate = static_cast(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast(mDelegate); if (qt_mac_is_macsheet(q)) [delegate showWindowModalSheet:q->parentWidget()]; else @@ -1071,7 +1071,7 @@ bool QFileDialogPrivate::hideCocoaFilePanel() return false; } else { QMacCocoaAutoReleasePool pool; - QNSOpenSavePanelDelegate *delegate = static_cast(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast(mDelegate); [delegate closePanel]; // Even when we hide it, we are still using a // native dialog, so return true: @@ -1104,7 +1104,7 @@ void QFileDialogPrivate::_q_macRunNativeAppModalPanel() #else Q_Q(QFileDialog); QMacCocoaAutoReleasePool pool; - QNSOpenSavePanelDelegate *delegate = static_cast(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast(mDelegate); [delegate runApplicationModalPanel]; dialogResultCode_sys() == QDialog::Accepted ? q->accept() : q->reject(); #endif @@ -1119,7 +1119,7 @@ QDialog::DialogCode QFileDialogPrivate::dialogResultCode_sys() else return QDialog::Accepted; #else - QNSOpenSavePanelDelegate *delegate = static_cast(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast(mDelegate); return [delegate dialogResultCode]; #endif } diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm index 919790b..bb8ef3f 100644 --- a/src/gui/dialogs/qfontdialog_mac.mm +++ b/src/gui/dialogs/qfontdialog_mac.mm @@ -82,7 +82,7 @@ const CGFloat DialogSideMargin = 9.0; const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask; -@class QCocoaFontPanelDelegate; +@class QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate); #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 @@ -93,7 +93,7 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin #endif -@interface QCocoaFontPanelDelegate : NSObject { +@interface QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) : NSObject { NSFontPanel *mFontPanel; NSView *mStolenContentView; NSButton *mOkButton; @@ -156,7 +156,7 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) return newFont; } -@implementation QCocoaFontPanelDelegate +@implementation QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) - (id)initWithFontPanel:(NSFontPanel *)panel stolenContentView:(NSView *)stolenContentView okButton:(NSButton *)okButton @@ -478,7 +478,7 @@ QT_BEGIN_NAMESPACE void QFontDialogPrivate::closeCocoaFontPanel() { QMacCocoaAutoReleasePool pool; - QCocoaFontPanelDelegate *theDelegate = static_cast(delegate); + QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *theDelegate = static_cast(delegate); NSWindow *ourPanel = [theDelegate actualPanel]; [ourPanel close]; [theDelegate cleanUpAfterMyself]; @@ -519,7 +519,7 @@ void QFontDialogPrivate::setFont(void *delegate, const QFont &font) } [mgr setSelectedFont:nsFont isMultiple:NO]; - [static_cast(delegate) setQtFont:font]; + [static_cast(delegate) setQtFont:font]; } void QFontDialogPrivate::createNSFontPanelDelegate() @@ -584,7 +584,7 @@ void QFontDialogPrivate::createNSFontPanelDelegate() } // create the delegate and set it - QCocoaFontPanelDelegate *del = [[QCocoaFontPanelDelegate alloc] initWithFontPanel:sharedFontPanel + QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *del = [[QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) alloc] initWithFontPanel:sharedFontPanel stolenContentView:stolenContentView okButton:okButton cancelButton:cancelButton @@ -637,7 +637,7 @@ void QFontDialogPrivate::mac_nativeDialogModalHelp() void QFontDialogPrivate::_q_macRunNativeAppModalPanel() { createNSFontPanelDelegate(); - QCocoaFontPanelDelegate *del = static_cast(delegate); + QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *del = static_cast(delegate); [del runApplicationModalPanel]; } @@ -649,7 +649,7 @@ bool QFontDialogPrivate::showCocoaFontPanel() Q_Q(QFontDialog); QMacCocoaAutoReleasePool pool; createNSFontPanelDelegate(); - QCocoaFontPanelDelegate *del = static_cast(delegate); + QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *del = static_cast(delegate); if (qt_mac_is_macsheet(q)) [del showWindowModalSheet:q->parentWidget()]; else diff --git a/src/gui/dialogs/qnspanelproxy_mac.mm b/src/gui/dialogs/qnspanelproxy_mac.mm index 3229a4d..0bd5c63 100644 --- a/src/gui/dialogs/qnspanelproxy_mac.mm +++ b/src/gui/dialogs/qnspanelproxy_mac.mm @@ -52,9 +52,9 @@ QT_END_NAMESPACE QT_USE_NAMESPACE -@class QNSPanelProxy; +@class QT_MANGLE_NAMESPACE(QNSPanelProxy); -@interface QNSPanelProxy : NSWindow { +@interface QT_MANGLE_NAMESPACE(QNSPanelProxy) : NSWindow { } - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation; @@ -66,7 +66,7 @@ QT_USE_NAMESPACE backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation screen:(NSScreen *)screen; @end -@implementation QNSPanelProxy +@implementation QT_MANGLE_NAMESPACE(QNSPanelProxy) - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation { @@ -108,15 +108,15 @@ QT_USE_NAMESPACE } @end -@class QNSWindowProxy; +@class QT_MANGLE_NAMESPACE(QNSWindowProxy); -@interface QNSWindowProxy : NSWindow { +@interface QT_MANGLE_NAMESPACE(QNSWindowProxy) : NSWindow { } - (void)setTitle:(NSString *)title; - (void)qt_fakeSetTitle:(NSString *)title; @end -@implementation QNSWindowProxy +@implementation QT_MANGLE_NAMESPACE(QNSWindowProxy) - (void)setTitle:(NSString *)title { QCFString cftitle(currentWindow->windowTitle()); @@ -190,10 +190,10 @@ void macStartInterceptNSPanelCtor() { macStartIntercept(@selector(initWithContentRect:styleMask:backing:defer:), @selector(qt_fakeInitWithContentRect:styleMask:backing:defer:), - [NSPanel class], [QNSPanelProxy class]); + [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]); macStartIntercept(@selector(initWithContentRect:styleMask:backing:defer:screen:), @selector(qt_fakeInitWithContentRect:styleMask:backing:defer:screen:), - [NSPanel class], [QNSPanelProxy class]); + [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]); } /* @@ -203,10 +203,10 @@ void macStopInterceptNSPanelCtor() { macStopIntercept(@selector(initWithContentRect:styleMask:backing:defer:screen:), @selector(qt_fakeInitWithContentRect:styleMask:backing:defer:screen:), - [NSPanel class], [QNSPanelProxy class]); + [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]); macStopIntercept(@selector(initWithContentRect:styleMask:backing:defer:), @selector(qt_fakeInitWithContentRect:styleMask:backing:defer:), - [NSPanel class], [QNSPanelProxy class]); + [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]); } /* @@ -217,7 +217,7 @@ void macStartInterceptWindowTitle(QWidget *window) { currentWindow = window; macStartIntercept(@selector(setTitle:), @selector(qt_fakeSetTitle:), - [NSWindow class], [QNSWindowProxy class]); + [NSWindow class], [QT_MANGLE_NAMESPACE(QNSWindowProxy) class]); } /* @@ -227,7 +227,7 @@ void macStopInterceptWindowTitle() { currentWindow = 0; macStopIntercept(@selector(setTitle:), @selector(qt_fakeSetTitle:), - [NSWindow class], [QNSWindowProxy class]); + [NSWindow class], [QT_MANGLE_NAMESPACE(QNSWindowProxy) class]); } /* diff --git a/src/gui/dialogs/qpagesetupdialog_mac.mm b/src/gui/dialogs/qpagesetupdialog_mac.mm index cfcde0f..0302be4 100644 --- a/src/gui/dialogs/qpagesetupdialog_mac.mm +++ b/src/gui/dialogs/qpagesetupdialog_mac.mm @@ -50,9 +50,9 @@ QT_USE_NAMESPACE -@class QCocoaPageLayoutDelegate; +@class QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate); -@interface QCocoaPageLayoutDelegate : NSObject { +@interface QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) : NSObject { QMacPrintEnginePrivate *pe; } - (id)initWithMacPrintEngine:(QMacPrintEnginePrivate *)printEngine; @@ -60,7 +60,7 @@ QT_USE_NAMESPACE returnCode:(int)returnCode contextInfo:(void *)contextInfo; @end -@implementation QCocoaPageLayoutDelegate +@implementation QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) - (id)initWithMacPrintEngine:(QMacPrintEnginePrivate *)printEngine; { self = [super init]; @@ -213,7 +213,7 @@ void QPageSetupDialogPrivate::openCocoaPageLayout(Qt::WindowModality modality) pageLayout = [NSPageLayout pageLayout]; // Keep a copy to this since we plan on using it for a bit. [pageLayout retain]; - QCocoaPageLayoutDelegate *delegate = [[QCocoaPageLayoutDelegate alloc] initWithMacPrintEngine:ep]; + QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) alloc] initWithMacPrintEngine:ep]; if (modality == Qt::ApplicationModal) { int rval = [pageLayout runModalWithPrintInfo:ep->printInfo]; diff --git a/src/gui/dialogs/qprintdialog_mac.mm b/src/gui/dialogs/qprintdialog_mac.mm index 6a8d6a4..84a72db 100644 --- a/src/gui/dialogs/qprintdialog_mac.mm +++ b/src/gui/dialogs/qprintdialog_mac.mm @@ -124,15 +124,15 @@ QT_USE_NAMESPACE #ifdef QT_MAC_USE_COCOA -@class QCocoaPrintPanelDelegate; +@class QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate); -@interface QCocoaPrintPanelDelegate : NSObject { +@interface QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) : NSObject { } - (void)printPanelDidEnd:(NSPrintPanel *)printPanel returnCode:(int)returnCode contextInfo:(void *)contextInfo; @end -@implementation QCocoaPrintPanelDelegate +@implementation QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) - (void)printPanelDidEnd:(NSPrintPanel *)printPanel returnCode:(int)returnCode contextInfo:(void *)contextInfo { @@ -313,7 +313,7 @@ void QPrintDialogPrivate::openCocoaPrintPanel(Qt::WindowModality modality) macStartInterceptWindowTitle(q); printPanel = [NSPrintPanel printPanel]; - QCocoaPrintPanelDelegate *delegate = [[QCocoaPrintPanelDelegate alloc] init]; + QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) alloc] init]; [printPanel setOptions:macOptions]; if (modality == Qt::ApplicationModal) { diff --git a/src/gui/kernel/qsound_mac.mm b/src/gui/kernel/qsound_mac.mm index 71fd663..2aff44d 100644 --- a/src/gui/kernel/qsound_mac.mm +++ b/src/gui/kernel/qsound_mac.mm @@ -88,14 +88,14 @@ QT_END_NAMESPACE QT_USE_NAMESPACE -@interface QMacSoundDelegate : NSObject { +@interface QT_MANGLE_NAMESPACE(QMacSoundDelegate) : NSObject { QSound *qSound; // may be null. QAuServerMac* server; } -(id)initWithQSound:(QSound*)sound:(QAuServerMac*)server; @end -@implementation QMacSoundDelegate +@implementation QT_MANGLE_NAMESPACE(QMacSoundDelegate) -(id)initWithQSound:(QSound*)s:(QAuServerMac*)serv { self = [super init]; if(self) { @@ -172,7 +172,7 @@ NSSound *QAuServerMac::createNSSound(const QString &fileName, QSound *qSound) { NSString *nsFileName = const_cast(reinterpret_cast(QCFString::toCFStringRef(fileName))); NSSound * const nsSound = [[NSSound alloc] initWithContentsOfFile: nsFileName byReference:YES]; - QMacSoundDelegate * const delegate = [[QMacSoundDelegate alloc] initWithQSound:qSound:this]; + QT_MANGLE_NAMESPACE(QMacSoundDelegate) * const delegate = [[QT_MANGLE_NAMESPACE(QMacSoundDelegate) alloc] initWithQSound:qSound:this]; [nsSound setDelegate:delegate]; [nsFileName release]; return nsSound; diff --git a/src/gui/util/qsystemtrayicon_mac.mm b/src/gui/util/qsystemtrayicon_mac.mm index d943c8c..8aaaa0f 100644 --- a/src/gui/util/qsystemtrayicon_mac.mm +++ b/src/gui/util/qsystemtrayicon_mac.mm @@ -75,8 +75,6 @@ #define QT_MAC_SYSTEMTRAY_USE_GROWL -@class QNSMenu; - #include #include #include @@ -98,13 +96,14 @@ QT_END_NAMESPACE QT_USE_NAMESPACE -@class QNSImageView; +@class QT_MANGLE_NAMESPACE(QNSMenu); +@class QT_MANGLE_NAMESPACE(QNSImageView); -@interface QNSStatusItem : NSObject { +@interface QT_MANGLE_NAMESPACE(QNSStatusItem) : NSObject { NSStatusItem *item; QSystemTrayIcon *icon; QSystemTrayIconPrivate *iconPrivate; - QNSImageView *imageCell; + QT_MANGLE_NAMESPACE(QNSImageView) *imageCell; } -(id)initWithIcon:(QSystemTrayIcon*)icon iconPrivate:(QSystemTrayIconPrivate *)iprivate; -(void)dealloc; @@ -115,11 +114,11 @@ QT_USE_NAMESPACE - (void)doubleClickSelector:(id)sender; @end -@interface QNSImageView : NSImageView { +@interface QT_MANGLE_NAMESPACE(QNSImageView) : NSImageView { BOOL down; - QNSStatusItem *parent; + QT_MANGLE_NAMESPACE(QNSStatusItem) *parent; } --(id)initWithParent:(QNSStatusItem*)myParent; +-(id)initWithParent:(QT_MANGLE_NAMESPACE(QNSStatusItem)*)myParent; -(QSystemTrayIcon*)icon; -(void)menuTrackingDone:(NSNotification*)notification; -(void)mousePressed:(NSEvent *)mouseEvent button:(Qt::MouseButton)mouseButton; @@ -134,7 +133,7 @@ QT_USE_NAMESPACE #endif -@interface QNSMenu : NSMenu { +@interface QT_MANGLE_NAMESPACE(QNSMenu) : NSMenu { QMenu *qmenu; } -(QMenu*)menu; @@ -148,14 +147,14 @@ class QSystemTrayIconSys public: QSystemTrayIconSys(QSystemTrayIcon *icon, QSystemTrayIconPrivate *d) { QMacCocoaAutoReleasePool pool; - item = [[QNSStatusItem alloc] initWithIcon:icon iconPrivate:d]; + item = [[QT_MANGLE_NAMESPACE(QNSStatusItem) alloc] initWithIcon:icon iconPrivate:d]; } ~QSystemTrayIconSys() { QMacCocoaAutoReleasePool pool; [[[item item] view] setHidden: YES]; [item release]; } - QNSStatusItem *item; + QT_MANGLE_NAMESPACE(QNSStatusItem) *item; }; void QSystemTrayIconPrivate::install_sys() @@ -299,8 +298,8 @@ QT_END_NAMESPACE @implementation NSStatusItem (Qt) @end -@implementation QNSImageView --(id)initWithParent:(QNSStatusItem*)myParent { +@implementation QT_MANGLE_NAMESPACE(QNSImageView) +-(id)initWithParent:(QT_MANGLE_NAMESPACE(QNSStatusItem)*)myParent { self = [super init]; parent = myParent; down = NO; @@ -400,7 +399,7 @@ QT_END_NAMESPACE } @end -@implementation QNSStatusItem +@implementation QT_MANGLE_NAMESPACE(QNSStatusItem) -(id)initWithIcon:(QSystemTrayIcon*)i iconPrivate:(QSystemTrayIconPrivate *)iPrivate { @@ -409,7 +408,7 @@ QT_END_NAMESPACE icon = i; iconPrivate = iPrivate; item = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain]; - imageCell = [[QNSImageView alloc] initWithParent:self]; + imageCell = [[QT_MANGLE_NAMESPACE(QNSImageView) alloc] initWithParent:self]; [item setView: imageCell]; } return self; @@ -453,7 +452,7 @@ QT_END_NAMESPACE [[[self item] view] removeAllToolTips]; iconPrivate->updateToolTip_sys(); #endif - NSMenu *m = [[QNSMenu alloc] initWithQMenu:icon->contextMenu()]; + NSMenu *m = [[QT_MANGLE_NAMESPACE(QNSMenu) alloc] initWithQMenu:icon->contextMenu()]; [m setAutoenablesItems: NO]; [[NSNotificationCenter defaultCenter] addObserver:imageCell selector:@selector(menuTrackingDone:) @@ -481,7 +480,7 @@ private: QSystemTrayIconQMenu(); }; -@implementation QNSMenu +@implementation QT_MANGLE_NAMESPACE(QNSMenu) -(id)initWithQMenu:(QMenu*)qm { self = [super init]; if(self) { @@ -494,7 +493,7 @@ private: return qmenu; } -(void)menuNeedsUpdate:(NSMenu*)nsmenu { - QNSMenu *menu = static_cast(nsmenu); + QT_MANGLE_NAMESPACE(QNSMenu) *menu = static_cast(nsmenu); emit static_cast(menu->qmenu)->doAboutToShow(); for(int i = [menu numberOfItems]-1; i >= 0; --i) [menu removeItemAtIndex:i]; @@ -539,7 +538,7 @@ private: [nsimage release]; } if(action->menu()) { - QNSMenu *sub = [[QNSMenu alloc] initWithQMenu:action->menu()]; + QT_MANGLE_NAMESPACE(QNSMenu) *sub = [[QT_MANGLE_NAMESPACE(QNSMenu) alloc] initWithQMenu:action->menu()]; [item setSubmenu:sub]; } else { [item setAction:@selector(selectedAction:)]; diff --git a/src/gui/widgets/qcocoatoolbardelegate_mac.mm b/src/gui/widgets/qcocoatoolbardelegate_mac.mm index b2a0e0c..e68ee7c 100644 --- a/src/gui/widgets/qcocoatoolbardelegate_mac.mm +++ b/src/gui/widgets/qcocoatoolbardelegate_mac.mm @@ -58,7 +58,7 @@ QT_FORWARD_DECLARE_CLASS(QMainWindowLayout); QT_FORWARD_DECLARE_CLASS(QToolBar); QT_FORWARD_DECLARE_CLASS(QCFString); -@implementation QCocoaToolBarDelegate +@implementation QT_MANGLE_NAMESPACE(QCocoaToolBarDelegate) - (id)initWithMainWindowLayout:(QMainWindowLayout *)layout { diff --git a/src/gui/widgets/qcocoatoolbardelegate_mac_p.h b/src/gui/widgets/qcocoatoolbardelegate_mac_p.h index 8e3d06f..b4af54f 100644 --- a/src/gui/widgets/qcocoatoolbardelegate_mac_p.h +++ b/src/gui/widgets/qcocoatoolbardelegate_mac_p.h @@ -61,7 +61,7 @@ QT_END_NAMESPACE @class NSToolbarItem; -@interface QCocoaToolBarDelegate : NSObject { +@interface QT_MANGLE_NAMESPACE(QCocoaToolBarDelegate) : NSObject { QT_PREPEND_NAMESPACE(QMainWindowLayout) *mainWindowLayout; NSToolbarItem *toolbarItem; } diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm index 9527057..b8cef93 100644 --- a/src/gui/widgets/qmainwindowlayout_mac.mm +++ b/src/gui/widgets/qmainwindowlayout_mac.mm @@ -410,7 +410,7 @@ void QMainWindowLayout::insertIntoMacToolbar(QToolBar *before, QToolBar *toolbar macToolbar = [[NSToolbar alloc] initWithIdentifier:(NSString *)kQMainWindowMacToolbarID]; [macToolbar setDisplayMode:NSToolbarDisplayModeIconOnly]; [macToolbar setSizeMode:NSToolbarSizeModeRegular]; - [macToolbar setDelegate:[[QCocoaToolBarDelegate alloc] initWithMainWindowLayout:this]]; + [macToolbar setDelegate:[[QT_MANGLE_NAMESPACE(QCocoaToolBarDelegate) alloc] initWithMainWindowLayout:this]]; [window setToolbar:macToolbar]; [macToolbar release]; } -- cgit v0.12