aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@digia.com>2013-06-26 23:11:40 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-01 15:15:42 +0200
commit8783de7f082c7a60821127ed8964884bae31a817 (patch)
tree46b551a4934c68811808f8486dba0e418dd80a33
parent3e21bfb18623a3ab9a9b31d489ae20f06e223c5d (diff)
Support namespaced build
Change-Id: Ie2073c629dcca6e8bdf33b803c9015b0373fc3a5 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
-rw-r--r--examples/macunifiedtoolbar/preferenceswindow.cpp1
-rw-r--r--examples/macunifiedtoolbar/preferenceswindow.h6
-rw-r--r--examples/macunifiedtoolbar/window.cpp1
-rw-r--r--examples/macunifiedtoolbar/window.h5
-rw-r--r--src/macextras/macextras.pro2
-rw-r--r--src/macextras/qmaccocoaviewcontainer.h4
-rw-r--r--src/macextras/qmacfunctions_mac.mm4
-rw-r--r--src/macextras/qmacfunctions_p.h4
-rw-r--r--src/macextras/qmacnativetoolbar.h18
-rw-r--r--src/macextras/qmacnativetoolbar.mm54
-rw-r--r--src/macextras/qmacnativewidget.h4
-rw-r--r--src/macextras/qmactoolbardelegate.h10
-rw-r--r--src/macextras/qmactoolbardelegate.mm2
-rw-r--r--src/macextras/qmactoolbutton.h4
-rw-r--r--src/macextras/qmactoolbutton.mm4
-rw-r--r--src/macextras/qnstoolbar.h7
-rw-r--r--src/macextras/qnstoolbar.mm2
17 files changed, 80 insertions, 52 deletions
diff --git a/examples/macunifiedtoolbar/preferenceswindow.cpp b/examples/macunifiedtoolbar/preferenceswindow.cpp
index c10f937..488ef5f 100644
--- a/examples/macunifiedtoolbar/preferenceswindow.cpp
+++ b/examples/macunifiedtoolbar/preferenceswindow.cpp
@@ -40,7 +40,6 @@
****************************************************************************/
#include "preferenceswindow.h"
-#include "ui_preferenceswindow.h"
#include <QMacNativeToolBar>
#include <QTimer>
diff --git a/examples/macunifiedtoolbar/preferenceswindow.h b/examples/macunifiedtoolbar/preferenceswindow.h
index 12d0937..0accb83 100644
--- a/examples/macunifiedtoolbar/preferenceswindow.h
+++ b/examples/macunifiedtoolbar/preferenceswindow.h
@@ -43,11 +43,7 @@
#define PREFERENCESWINDOW_H
#include <QMainWindow>
-
-namespace Ui
-{
- class PreferencesWindow;
-}
+#include "ui_preferenceswindow.h"
class PreferencesWindow : public QMainWindow
{
diff --git a/examples/macunifiedtoolbar/window.cpp b/examples/macunifiedtoolbar/window.cpp
index 6a61612..dde27e3 100644
--- a/examples/macunifiedtoolbar/window.cpp
+++ b/examples/macunifiedtoolbar/window.cpp
@@ -40,7 +40,6 @@
****************************************************************************/
#include "window.h"
-#include "ui_window.h"
#include "preferenceswindow.h"
#include <QMacNativeToolBar>
#include <QDesktopWidget>
diff --git a/examples/macunifiedtoolbar/window.h b/examples/macunifiedtoolbar/window.h
index bb0a249..7f0dc54 100644
--- a/examples/macunifiedtoolbar/window.h
+++ b/examples/macunifiedtoolbar/window.h
@@ -44,10 +44,7 @@
#include <QWidget>
#include "qmactoolbutton.h"
-
-namespace Ui {
-class Window;
-}
+#include "ui_window.h"
class WindowPrivate;
class Window : public QWidget
diff --git a/src/macextras/macextras.pro b/src/macextras/macextras.pro
index cc55456..fb39293 100644
--- a/src/macextras/macextras.pro
+++ b/src/macextras/macextras.pro
@@ -1,6 +1,6 @@
include($$PWD/macextras-lib.pri)
load(qt_build_config)
-QT += widgets gui-private
+QT += widgets gui-private core-private
TARGET = QtMacExtras
load(qt_module)
diff --git a/src/macextras/qmaccocoaviewcontainer.h b/src/macextras/qmaccocoaviewcontainer.h
index 8dcb91f..a9172ab 100644
--- a/src/macextras/qmaccocoaviewcontainer.h
+++ b/src/macextras/qmaccocoaviewcontainer.h
@@ -45,10 +45,10 @@
#include <QtWidgets/QWidget>
-QT_BEGIN_NAMESPACE
-
Q_FORWARD_DECLARE_OBJC_CLASS(NSView);
+QT_BEGIN_NAMESPACE
+
class QMacCocoaViewContainerPrivate;
class Q_MACEXTRAS_EXPORT QMacCocoaViewContainer : public QWidget
{
diff --git a/src/macextras/qmacfunctions_mac.mm b/src/macextras/qmacfunctions_mac.mm
index 5fdd407..05fc783 100644
--- a/src/macextras/qmacfunctions_mac.mm
+++ b/src/macextras/qmacfunctions_mac.mm
@@ -43,8 +43,6 @@
#include "qmacfunctions_p.h"
#import <Cocoa/Cocoa.h>
-QT_BEGIN_NAMESPACE
-
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
#include <QtGui/QWindow>
#include <QtWidgets/QMenu>
@@ -52,6 +50,8 @@ QT_BEGIN_NAMESPACE
#include <qpa/qplatformmenu.h>
#endif
+QT_BEGIN_NAMESPACE
+
namespace QtMacExtras
{
diff --git a/src/macextras/qmacfunctions_p.h b/src/macextras/qmacfunctions_p.h
index 77f83ab..6d8211b 100644
--- a/src/macextras/qmacfunctions_p.h
+++ b/src/macextras/qmacfunctions_p.h
@@ -44,13 +44,13 @@
#include "qmacfunctions.h"
-QT_BEGIN_NAMESPACE
-
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QtCore/QDebug>
#include <QtGui/QGuiApplication>
#include <qpa/qplatformnativeinterface.h>
+QT_BEGIN_NAMESPACE
+
inline QPlatformNativeInterface::NativeResourceForIntegrationFunction resolvePlatformFunction(const QByteArray &functionName)
{
QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
diff --git a/src/macextras/qmacnativetoolbar.h b/src/macextras/qmacnativetoolbar.h
index c4ad010..1ad9980 100644
--- a/src/macextras/qmacnativetoolbar.h
+++ b/src/macextras/qmacnativetoolbar.h
@@ -43,11 +43,20 @@
#define QMACTOOLBAR_H
#include "qmacextrasglobal.h"
+#include "qmactoolbutton.h"
#include <QString>
+#include <QObject>
+#include <QIcon>
+#include <QVariant>
+
+Q_FORWARD_DECLARE_OBJC_CLASS(NSToolbar);
+
+QT_BEGIN_NAMESPACE
class QToolBar;
class QWidget;
+
class QMacNativeToolBar;
namespace QtMacExtras
@@ -56,16 +65,9 @@ Q_MACEXTRAS_EXPORT QMacNativeToolBar* setNativeToolBar(QToolBar *toolbar, bool o
Q_MACEXTRAS_EXPORT QMacNativeToolBar* setNativeToolBar(QToolBar *toolbar, const QString &identifier, bool on = true);
}
-#include "qmactoolbutton.h"
-#include <QObject>
-#include <QIcon>
-#include <QVariant>
-
class QAction;
class QWindow;
-Q_FORWARD_DECLARE_OBJC_CLASS(NSToolbar);
-
class QMacNativeToolBarPrivate;
class Q_MACEXTRAS_EXPORT QMacNativeToolBar : public QObject
{
@@ -144,6 +146,8 @@ private:
QMacNativeToolBarPrivate *d;
};
+QT_END_NAMESPACE
+
Q_DECLARE_METATYPE(QMacNativeToolBar*)
#endif
diff --git a/src/macextras/qmacnativetoolbar.mm b/src/macextras/qmacnativetoolbar.mm
index 659362b..d82de0a 100644
--- a/src/macextras/qmacnativetoolbar.mm
+++ b/src/macextras/qmacnativetoolbar.mm
@@ -80,6 +80,8 @@ NSString *toNSStandardItem(QMacToolButton::StandardItem standardItem)
return @"";
}
+QT_BEGIN_NAMESPACE
+
NSToolbarDisplayMode toNSToolbarDisplayMode(Qt::ToolButtonStyle toolButtonStyle)
{
switch (toolButtonStyle)
@@ -113,7 +115,11 @@ Qt::ToolButtonStyle toQtToolButtonStyle(NSToolbarDisplayMode toolbarDisplayMode)
}
}
-@interface QNSToolbarNotifier : NSObject
+QT_END_NAMESPACE
+
+#include <qglobal.h>
+
+@interface QT_MANGLE_NAMESPACE(QNSToolbarNotifier) : NSObject
{
@public
QMacNativeToolBarPrivate *pimpl;
@@ -121,11 +127,15 @@ Qt::ToolButtonStyle toQtToolButtonStyle(NSToolbarDisplayMode toolbarDisplayMode)
- (void)notification:(NSNotification*)note;
@end
+QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSToolbarNotifier);
+
+QT_BEGIN_NAMESPACE
+
class QMacNativeToolBarPrivate
{
public:
QMacNativeToolBar *qtToolbar;
- NSToolbar *toolbar;
+ QtNSToolbar *toolbar;
QMacToolbarDelegate *delegate;
QNSToolbarNotifier *notifier;
@@ -180,25 +190,6 @@ public:
}
};
-@implementation QNSToolbarNotifier
-
-- (void)notification:(NSNotification*)note
-{
- Q_ASSERT(pimpl);
- if ([[note name] isEqualToString:QtNSToolbarVisibilityChangedNotification])
- pimpl->fireVisibilityChanged();
- else if ([[note name] isEqualToString:QtNSToolbarShowsBaselineSeparatorChangedNotification])
- pimpl->fireShowsBaselineSeparatorChanged();
- else if ([[note name] isEqualToString:QtNSToolbarDisplayModeChangedNotification])
- pimpl->fireToolButtonStyleChanged();
- else if ([[note name] isEqualToString:QtNSToolbarSizeModeChangedNotification])
- pimpl->fireSizeModeChangedNotification();
- else if ([[note name] isEqualToString:QtNSToolbarAllowsUserCustomizationChangedNotification])
- pimpl->fireAllowsUserCustomizationChanged();
-}
-
-@end
-
QMacNativeToolBar* QtMacExtras::setNativeToolBar(QToolBar *toolbar, bool on)
{
return QtMacExtras::setNativeToolBar(toolbar, QString(), on);
@@ -581,4 +572,25 @@ QAction *QMacNativeToolBar::addAllowedStandardItem(QMacToolButton::StandardItem
return [d->delegate addAllowedStandardItem:standardItem];
}
+QT_END_NAMESPACE
+
+QT_USE_NAMESPACE
+@implementation QNSToolbarNotifier
+
+- (void)notification:(NSNotification*)note
+{
+ Q_ASSERT(pimpl);
+ if ([[note name] isEqualToString:QtNSToolbarVisibilityChangedNotification])
+ pimpl->fireVisibilityChanged();
+ else if ([[note name] isEqualToString:QtNSToolbarShowsBaselineSeparatorChangedNotification])
+ pimpl->fireShowsBaselineSeparatorChanged();
+ else if ([[note name] isEqualToString:QtNSToolbarDisplayModeChangedNotification])
+ pimpl->fireToolButtonStyleChanged();
+ else if ([[note name] isEqualToString:QtNSToolbarSizeModeChangedNotification])
+ pimpl->fireSizeModeChangedNotification();
+ else if ([[note name] isEqualToString:QtNSToolbarAllowsUserCustomizationChangedNotification])
+ pimpl->fireAllowsUserCustomizationChanged();
+}
+
+@end
diff --git a/src/macextras/qmacnativewidget.h b/src/macextras/qmacnativewidget.h
index 22bdddf..72c3e8f 100644
--- a/src/macextras/qmacnativewidget.h
+++ b/src/macextras/qmacnativewidget.h
@@ -46,12 +46,12 @@
#include <QWidget>
+Q_FORWARD_DECLARE_OBJC_CLASS(NSView);
+
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-Q_FORWARD_DECLARE_OBJC_CLASS(NSView);
-
class Q_MACEXTRAS_EXPORT QMacNativeWidget : public QWidget
{
Q_OBJECT
diff --git a/src/macextras/qmactoolbardelegate.h b/src/macextras/qmactoolbardelegate.h
index ef4d3a2..b40a6ed 100644
--- a/src/macextras/qmactoolbardelegate.h
+++ b/src/macextras/qmactoolbardelegate.h
@@ -47,10 +47,13 @@
//#include <QString>
//#include <QHash>
-class QAction;
-class QIcon;
+#include <qglobal.h>
+#include <private/qcore_mac_p.h>
-@interface QMacToolbarDelegate : NSObject <NSToolbarDelegate>
+#include <QAction>
+#include <QIcon>
+
+@interface QT_MANGLE_NAMESPACE(QMacToolbarDelegate) : NSObject <NSToolbarDelegate>
{
@public
QList<QMacToolButton *> items;
@@ -78,5 +81,6 @@ class QIcon;
- (IBAction)itemClicked:(id)sender;
@end
+QT_NAMESPACE_ALIAS_OBJC_CLASS(QMacToolbarDelegate);
#endif // QMACTOOLBARDELEGATE_H
diff --git a/src/macextras/qmactoolbardelegate.mm b/src/macextras/qmactoolbardelegate.mm
index 535bc52..6620946 100644
--- a/src/macextras/qmactoolbardelegate.mm
+++ b/src/macextras/qmactoolbardelegate.mm
@@ -45,6 +45,8 @@
#include <QImage>
#include <QPixmap>
+QT_USE_NAMESPACE
+
NSArray *toNSArray(const QList<QString> &stringList)
{
NSMutableArray *array = [[NSMutableArray alloc] init];
diff --git a/src/macextras/qmactoolbutton.h b/src/macextras/qmactoolbutton.h
index 8f218bf..380422f 100644
--- a/src/macextras/qmactoolbutton.h
+++ b/src/macextras/qmactoolbutton.h
@@ -44,6 +44,8 @@
#include <QObject>
+QT_BEGIN_NAMESPACE
+
class QAction;
class QMacToolButton : public QObject
@@ -89,4 +91,6 @@ public: // (not really public)
void emitActivated() { emit activated(); }
};
+QT_END_NAMESPACE
+
#endif
diff --git a/src/macextras/qmactoolbutton.mm b/src/macextras/qmactoolbutton.mm
index c1db1c8..cd3b343 100644
--- a/src/macextras/qmactoolbutton.mm
+++ b/src/macextras/qmactoolbutton.mm
@@ -42,6 +42,8 @@
#include "qmactoolbutton.h"
#include <QAction>
+QT_BEGIN_NAMESPACE
+
QMacToolButton::QMacToolButton()
{
m_standardItem = NoItem;
@@ -87,3 +89,5 @@ void QMacToolButton::setStandardItem(StandardItem standardItem)
{
m_standardItem = standardItem;
}
+
+QT_END_NAMESPACE
diff --git a/src/macextras/qnstoolbar.h b/src/macextras/qnstoolbar.h
index b27202c..9a0d784 100644
--- a/src/macextras/qnstoolbar.h
+++ b/src/macextras/qnstoolbar.h
@@ -44,14 +44,19 @@
#include <AppKit/NSToolbar.h>
+#include <qglobal.h>
+#include <private/qcore_mac_p.h>
+
extern NSString *QtNSToolbarDisplayModeChangedNotification;
extern NSString *QtNSToolbarShowsBaselineSeparatorChangedNotification;
extern NSString *QtNSToolbarAllowsUserCustomizationChangedNotification;
extern NSString *QtNSToolbarSizeModeChangedNotification;
extern NSString *QtNSToolbarVisibilityChangedNotification;
-@interface QtNSToolbar : NSToolbar
+@interface QT_MANGLE_NAMESPACE(QtNSToolbar) : NSToolbar
@end
+QT_NAMESPACE_ALIAS_OBJC_CLASS(QtNSToolbar);
+
#endif // QNSTOOLBAR_H
diff --git a/src/macextras/qnstoolbar.mm b/src/macextras/qnstoolbar.mm
index dc6ef64..d50ea2a 100644
--- a/src/macextras/qnstoolbar.mm
+++ b/src/macextras/qnstoolbar.mm
@@ -47,6 +47,8 @@ NSString *QtNSToolbarAllowsUserCustomizationChangedNotification = @"QtNSToolbarA
NSString *QtNSToolbarSizeModeChangedNotification = @"QtNSToolbarSizeModeChangedNotification";
NSString *QtNSToolbarVisibilityChangedNotification = @"QtNSToolbarVisibilityChangedNotification";
+QT_USE_NAMESPACE
+
@implementation QtNSToolbar
- (void)setDisplayMode:(NSToolbarDisplayMode)displayMode