Fixed compilation on Mac OS X (qt namespace and preprocessor issues))

Configured with -qtnamespace <...> -no-opengl -D QT_NO_PRINTER

Change-Id: I1c959a89afda08d29a854f21e6e51732d136753c
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
This commit is contained in:
Sergei Kulik 2015-03-10 15:12:00 +11:00 committed by Timur Pocheptsov
parent 282ba9a180
commit 97edc8ede2
17 changed files with 59 additions and 12 deletions

View File

@ -38,6 +38,8 @@
#include <QtGui> #include <QtGui>
#include <qpa/qplatformaccessibility.h> #include <qpa/qplatformaccessibility.h>
QT_BEGIN_NAMESPACE
class QCocoaAccessibility : public QPlatformAccessibility class QCocoaAccessibility : public QPlatformAccessibility
{ {
public: public:
@ -81,4 +83,6 @@ id getValueAttribute(QAccessibleInterface *interface);
} }
QT_END_NAMESPACE
#endif #endif

View File

@ -35,6 +35,8 @@
#include <QtGui/qaccessible.h> #include <QtGui/qaccessible.h>
#include <private/qcore_mac_p.h> #include <private/qcore_mac_p.h>
QT_BEGIN_NAMESPACE
QCocoaAccessibility::QCocoaAccessibility() QCocoaAccessibility::QCocoaAccessibility()
{ {
@ -367,3 +369,6 @@ id getValueAttribute(QAccessibleInterface *interface)
} }
} // namespace QCocoaAccessible } // namespace QCocoaAccessible
QT_END_NAMESPACE

View File

@ -40,6 +40,7 @@
#import <AppKit/NSAccessibility.h> #import <AppKit/NSAccessibility.h>
QT_USE_NAMESPACE
static void convertLineOffset(QAccessibleTextInterface *text, int &line, int &offset, NSUInteger *start = 0, NSUInteger *end = 0) static void convertLineOffset(QAccessibleTextInterface *text, int &line, int &offset, NSUInteger *start = 0, NSUInteger *end = 0)
{ {

View File

@ -92,8 +92,8 @@
- (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader); - (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader);
- (int)QT_MANGLE_NAMESPACE(qt_validModesForFontPanel):(NSFontPanel *)fontPanel; - (int)QT_MANGLE_NAMESPACE(qt_validModesForFontPanel):(NSFontPanel *)fontPanel;
- (void)qt_sendPostedMessage:(NSEvent *)event; - (void)QT_MANGLE_NAMESPACE(qt_sendPostedMessage):(NSEvent *)event;
- (BOOL)qt_filterEvent:(NSEvent *)event; - (BOOL)QT_MANGLE_NAMESPACE(qt_filterEvent):(NSEvent *)event;
@end @end
@interface QT_MANGLE_NAMESPACE(QNSApplication) : NSApplication { @interface QT_MANGLE_NAMESPACE(QNSApplication) : NSApplication {

View File

@ -98,7 +98,7 @@ QT_USE_NAMESPACE
| NSFontPanelStrikethroughEffectModeMask; | NSFontPanelStrikethroughEffectModeMask;
} }
- (void)qt_sendPostedMessage:(NSEvent *)event - (void)QT_MANGLE_NAMESPACE(qt_sendPostedMessage):(NSEvent *)event
{ {
// WARNING: data1 and data2 is truncated to from 64-bit to 32-bit on OS 10.5! // WARNING: data1 and data2 is truncated to from 64-bit to 32-bit on OS 10.5!
// That is why we need to split the address in two parts: // That is why we need to split the address in two parts:
@ -126,7 +126,7 @@ QT_USE_NAMESPACE
static const QByteArray q_macLocalEventType = QByteArrayLiteral("mac_generic_NSEvent"); static const QByteArray q_macLocalEventType = QByteArrayLiteral("mac_generic_NSEvent");
- (BOOL)qt_filterEvent:(NSEvent *)event - (BOOL)QT_MANGLE_NAMESPACE(qt_filterEvent):(NSEvent *)event
{ {
if (qApp && qApp->eventDispatcher()-> if (qApp && qApp->eventDispatcher()->
filterNativeEvent(q_macLocalEventType, static_cast<void*>(event), 0)) filterNativeEvent(q_macLocalEventType, static_cast<void*>(event), 0))
@ -135,7 +135,7 @@ static const QByteArray q_macLocalEventType = QByteArrayLiteral("mac_generic_NSE
if ([event type] == NSApplicationDefined) { if ([event type] == NSApplicationDefined) {
switch ([event subtype]) { switch ([event subtype]) {
case QtCocoaEventSubTypePostMessage: case QtCocoaEventSubTypePostMessage:
[NSApp qt_sendPostedMessage:event]; [NSApp QT_MANGLE_NAMESPACE(qt_sendPostedMessage):event];
return true; return true;
default: default:
break; break;
@ -163,7 +163,7 @@ static const QByteArray q_macLocalEventType = QByteArrayLiteral("mac_generic_NSE
// be called instead of sendEvent if redirection occurs. // be called instead of sendEvent if redirection occurs.
// 'self' will then be an instance of NSApplication // 'self' will then be an instance of NSApplication
// (and not QNSApplication) // (and not QNSApplication)
if (![NSApp qt_filterEvent:event]) if (![NSApp QT_MANGLE_NAMESPACE(qt_filterEvent):event])
[self qt_sendEvent_original:event]; [self qt_sendEvent_original:event];
} }
@ -171,7 +171,7 @@ static const QByteArray q_macLocalEventType = QByteArrayLiteral("mac_generic_NSE
{ {
// This method will be called if // This method will be called if
// no redirection occurs // no redirection occurs
if (![NSApp qt_filterEvent:event]) if (![NSApp QT_MANGLE_NAMESPACE(qt_filterEvent):event])
[super sendEvent:event]; [super sendEvent:event];
} }

View File

@ -80,12 +80,14 @@
QT_USE_NAMESPACE QT_USE_NAMESPACE
QT_BEGIN_NAMESPACE
static QCocoaApplicationDelegate *sharedCocoaApplicationDelegate = nil; static QCocoaApplicationDelegate *sharedCocoaApplicationDelegate = nil;
static void cleanupCocoaApplicationDelegate() static void cleanupCocoaApplicationDelegate()
{ {
[sharedCocoaApplicationDelegate release]; [sharedCocoaApplicationDelegate release];
} }
QT_END_NAMESPACE
@implementation QCocoaApplicationDelegate @implementation QCocoaApplicationDelegate

View File

@ -35,9 +35,10 @@
#define QCOCOAAUTORELEASEPOOL_H #define QCOCOAAUTORELEASEPOOL_H
#undef slots #undef slots
#include <qglobal.h>
#include <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>
QT_BEGIN_NAMESPACE
class QCocoaAutoReleasePool class QCocoaAutoReleasePool
{ {
public: public:
@ -47,5 +48,6 @@ public:
private: private:
NSAutoreleasePool *pool; NSAutoreleasePool *pool;
}; };
QT_END_NAMESPACE
#endif // QCOCOAAUTORELEASEPOOL_H #endif // QCOCOAAUTORELEASEPOOL_H

View File

@ -33,6 +33,8 @@
#include "qcocoaautoreleasepool.h" #include "qcocoaautoreleasepool.h"
QT_BEGIN_NAMESPACE
QCocoaAutoReleasePool::QCocoaAutoReleasePool() QCocoaAutoReleasePool::QCocoaAutoReleasePool()
{ {
pool = [[NSAutoreleasePool alloc] init]; pool = [[NSAutoreleasePool alloc] init];
@ -42,3 +44,5 @@ QCocoaAutoReleasePool::~QCocoaAutoReleasePool()
{ {
[pool release]; [pool release];
} }
QT_END_NAMESPACE

View File

@ -42,6 +42,8 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
QT_BEGIN_NAMESPACE
static inline QByteArray getGlString(GLenum param) static inline QByteArray getGlString(GLenum param)
{ {
if (const GLubyte *s = glGetString(param)) if (const GLubyte *s = glGetString(param))
@ -351,3 +353,6 @@ bool QCocoaGLContext::isSharing() const
{ {
return m_shareContext != nil; return m_shareContext != nil;
} }
QT_END_NAMESPACE

View File

@ -45,6 +45,8 @@
#include "qcocoawindow.h" #include "qcocoawindow.h"
#import "qnsview.h" #import "qnsview.h"
QT_BEGIN_NAMESPACE
NSString *qt_mac_removePrivateUnicode(NSString* string) NSString *qt_mac_removePrivateUnicode(NSString* string)
{ {
int len = [string length]; int len = [string length];
@ -71,6 +73,8 @@ static inline QCocoaMenuLoader *getMenuLoader()
return [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)]; return [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
} }
QT_END_NAMESPACE
@interface QT_MANGLE_NAMESPACE(QCocoaMenuDelegate) : NSObject <NSMenuDelegate> { @interface QT_MANGLE_NAMESPACE(QCocoaMenuDelegate) : NSObject <NSMenuDelegate> {
QCocoaMenu *m_menu; QCocoaMenu *m_menu;
} }

View File

@ -42,6 +42,8 @@
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>
#include <QtCore/QDebug> #include <QtCore/QDebug>
QT_BEGIN_NAMESPACE
static QList<QCocoaMenuBar*> static_menubars; static QList<QCocoaMenuBar*> static_menubars;
static inline QCocoaMenuLoader *getMenuLoader() static inline QCocoaMenuLoader *getMenuLoader()
@ -382,3 +384,5 @@ NSMenuItem *QCocoaMenuBar::itemForRole(QPlatformMenuItem::MenuRole r)
return Q_NULLPTR; return Q_NULLPTR;
} }
QT_END_NAMESPACE

View File

@ -44,6 +44,8 @@
#include <QtCore/QDebug> #include <QtCore/QDebug>
QT_BEGIN_NAMESPACE
static inline QCocoaMenuLoader *getMenuLoader() static inline QCocoaMenuLoader *getMenuLoader()
{ {
return [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)]; return [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
@ -423,3 +425,5 @@ void QCocoaMenuItem::setIconSize(int size)
{ {
m_iconSize = size; m_iconSize = size;
} }
QT_END_NAMESPACE

View File

@ -39,6 +39,8 @@
#include "qt_mac_p.h" #include "qt_mac_p.h"
QT_BEGIN_NAMESPACE
class QCocoaPrinterSupport : public QPlatformPrinterSupport class QCocoaPrinterSupport : public QPlatformPrinterSupport
{ {
public: public:
@ -53,5 +55,7 @@ public:
QString defaultPrintDeviceId() const Q_DECL_OVERRIDE; QString defaultPrintDeviceId() const Q_DECL_OVERRIDE;
}; };
QT_END_NAMESPACE
#endif // QT_NO_PRINTER #endif // QT_NO_PRINTER
#endif // QCOCOAPRINTERSUPPORT_H #endif // QCOCOAPRINTERSUPPORT_H

View File

@ -40,6 +40,8 @@
#include <private/qprinterinfo_p.h> #include <private/qprinterinfo_p.h>
QT_BEGIN_NAMESPACE
QCocoaPrinterSupport::QCocoaPrinterSupport() QCocoaPrinterSupport::QCocoaPrinterSupport()
{ } { }
@ -94,4 +96,6 @@ QString QCocoaPrinterSupport::defaultPrintDeviceId() const
return QString(); return QString();
} }
QT_END_NAMESPACE
#endif //QT_NO_PRINTER #endif //QT_NO_PRINTER

View File

@ -38,6 +38,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_PRINTER
class QCocoaPrinterSupportPlugin : public QPlatformPrinterSupportPlugin class QCocoaPrinterSupportPlugin : public QPlatformPrinterSupportPlugin
{ {
Q_OBJECT Q_OBJECT
@ -65,6 +67,8 @@ QPlatformPrinterSupport *QCocoaPrinterSupportPlugin::create(const QString &key)
return platformPrinterSupport; return platformPrinterSupport;
} }
#endif
QT_END_NAMESPACE QT_END_NAMESPACE
#include "main.moc" #include "main.moc"

View File

@ -173,8 +173,8 @@ protected:
#endif #endif
}; };
QT_END_NAMESPACE
#endif // QT_NO_PRINTER #endif // QT_NO_PRINTER
QT_END_NAMESPACE
#endif // QPLATFORMPRINTDEVICE_H #endif // QPLATFORMPRINTDEVICE_H

View File

@ -136,8 +136,8 @@ private:
Q_DECLARE_SHARED(QPrintDevice) Q_DECLARE_SHARED(QPrintDevice)
QT_END_NAMESPACE
#endif // QT_NO_PRINTER #endif // QT_NO_PRINTER
QT_END_NAMESPACE
#endif // QPLATFORMPRINTDEVICE_H #endif // QPLATFORMPRINTDEVICE_H