Android: Fix namespace usage

This change makes it possible to set a Qt namespace for Android builds.

Change-Id: I79f4ae8200223f36f97e2849aae49e45b8850d23
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
Christian Strømme 2014-04-23 16:10:33 +02:00 committed by Christian Stromme
parent 3251429813
commit 8f96ce3733
28 changed files with 116 additions and 0 deletions

View File

@ -153,6 +153,8 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void * /*reserved*/)
return JNI_VERSION_1_4; return JNI_VERSION_1_4;
} }
QT_BEGIN_NAMESPACE
QList<QByteArray> QSslSocketPrivate::fetchSslCertificateData() QList<QByteArray> QSslSocketPrivate::fetchSslCertificateData()
{ {
QList<QByteArray> certificateData; QList<QByteArray> certificateData;
@ -177,3 +179,5 @@ QList<QByteArray> QSslSocketPrivate::fetchSslCertificateData()
return certificateData; return certificateData;
} }
QT_END_NAMESPACE

View File

@ -55,6 +55,8 @@ static const char m_qtTag[] = "Qt A11Y";
static const char m_classErrorMsg[] = "Can't find class \"%s\""; static const char m_classErrorMsg[] = "Can't find class \"%s\"";
static const char m_methodErrorMsg[] = "Can't find method \"%s%s\""; static const char m_methodErrorMsg[] = "Can't find method \"%s%s\"";
QT_BEGIN_NAMESPACE
namespace QtAndroidAccessibility namespace QtAndroidAccessibility
{ {
static jmethodID m_addActionMethodID = 0; static jmethodID m_addActionMethodID = 0;
@ -290,3 +292,5 @@ if (!clazz) { \
return true; return true;
} }
} }
QT_END_NAMESPACE

View File

@ -42,10 +42,15 @@
#ifndef ANDROIDJNIACCESSIBILITY_H #ifndef ANDROIDJNIACCESSIBILITY_H
#define ANDROIDJNIACCESSIBILITY_H #define ANDROIDJNIACCESSIBILITY_H
#include <jni.h> #include <jni.h>
#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
namespace QtAndroidAccessibility namespace QtAndroidAccessibility
{ {
bool registerNatives(JNIEnv *env); bool registerNatives(JNIEnv *env);
} }
QT_END_NAMESPACE
#endif // ANDROIDJNIINPUT_H #endif // ANDROIDJNIINPUT_H

View File

@ -42,6 +42,8 @@
#include "androidjniclipboard.h" #include "androidjniclipboard.h"
#include "androidjnimain.h" #include "androidjnimain.h"
QT_BEGIN_NAMESPACE
using namespace QtAndroid; using namespace QtAndroid;
namespace QtAndroidClipboard namespace QtAndroidClipboard
{ {
@ -118,3 +120,5 @@ namespace QtAndroidClipboard
return true; return true;
} }
} }
QT_END_NAMESPACE

View File

@ -45,6 +45,8 @@
#include <jni.h> #include <jni.h>
#include <QString> #include <QString>
QT_BEGIN_NAMESPACE
class QAndroidPlatformClipboard; class QAndroidPlatformClipboard;
namespace QtAndroidClipboard namespace QtAndroidClipboard
{ {
@ -58,4 +60,6 @@ namespace QtAndroidClipboard
bool registerNatives(JNIEnv *env); bool registerNatives(JNIEnv *env);
} }
QT_END_NAMESPACE
#endif // ANDROIDJNICLIPBOARD_H #endif // ANDROIDJNICLIPBOARD_H

View File

@ -49,6 +49,8 @@
#include <QDebug> #include <QDebug>
QT_BEGIN_NAMESPACE
using namespace QtAndroid; using namespace QtAndroid;
namespace QtAndroidInput namespace QtAndroidInput
@ -758,3 +760,5 @@ namespace QtAndroidInput
return true; return true;
} }
} }
QT_END_NAMESPACE

View File

@ -42,6 +42,9 @@
#ifndef ANDROIDJNIINPUT_H #ifndef ANDROIDJNIINPUT_H
#define ANDROIDJNIINPUT_H #define ANDROIDJNIINPUT_H
#include <jni.h> #include <jni.h>
#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
namespace QtAndroidInput namespace QtAndroidInput
{ {
@ -56,4 +59,6 @@ namespace QtAndroidInput
bool registerNatives(JNIEnv *env); bool registerNatives(JNIEnv *env);
} }
QT_END_NAMESPACE
#endif // ANDROIDJNIINPUT_H #endif // ANDROIDJNIINPUT_H

View File

@ -76,6 +76,8 @@
Q_IMPORT_PLUGIN(QAndroidPlatformIntegrationPlugin) Q_IMPORT_PLUGIN(QAndroidPlatformIntegrationPlugin)
QT_BEGIN_NAMESPACE
static JavaVM *m_javaVM = NULL; static JavaVM *m_javaVM = NULL;
static jclass m_applicationClass = NULL; static jclass m_applicationClass = NULL;
static jobject m_classLoaderObject = NULL; static jobject m_classLoaderObject = NULL;
@ -748,8 +750,11 @@ static int registerNatives(JNIEnv *env)
return JNI_TRUE; return JNI_TRUE;
} }
QT_END_NAMESPACE
Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/) Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/)
{ {
QT_USE_NAMESPACE
typedef union { typedef union {
JNIEnv *nativeEnvironment; JNIEnv *nativeEnvironment;
void *venv; void *venv;

View File

@ -50,6 +50,8 @@
#include <QImage> #include <QImage>
QT_BEGIN_NAMESPACE
class QRect; class QRect;
class QPoint; class QPoint;
class QThread; class QThread;
@ -119,4 +121,7 @@ namespace QtAndroid
QString deviceName(); QString deviceName();
} }
QT_END_NAMESPACE
#endif // ANDROID_APP_H #endif // ANDROID_APP_H

View File

@ -50,6 +50,8 @@
#include <QQueue> #include <QQueue>
#include <QWindow> #include <QWindow>
QT_BEGIN_NAMESPACE
using namespace QtAndroid; using namespace QtAndroid;
namespace QtAndroidMenu namespace QtAndroidMenu
@ -428,3 +430,5 @@ namespace QtAndroidMenu
return true; return true;
} }
} }
QT_END_NAMESPACE

View File

@ -43,6 +43,9 @@
#define ANDROIDJNIMENU_H #define ANDROIDJNIMENU_H
#include <jni.h> #include <jni.h>
#include <qglobal.h>
QT_BEGIN_NAMESPACE
class QAndroidPlatformMenuBar; class QAndroidPlatformMenuBar;
class QAndroidPlatformMenu; class QAndroidPlatformMenu;
@ -66,4 +69,6 @@ namespace QtAndroidMenu
bool registerNatives(JNIEnv *env); bool registerNatives(JNIEnv *env);
} }
QT_END_NAMESPACE
#endif // ANDROIDJNIMENU_H #endif // ANDROIDJNIMENU_H

View File

@ -44,6 +44,8 @@
#include <QMutex> #include <QMutex>
#include <jni.h> #include <jni.h>
QT_BEGIN_NAMESPACE
class AndroidSurfaceClient class AndroidSurfaceClient
{ {
public: public:
@ -55,4 +57,6 @@ protected:
QMutex m_surfaceMutex; QMutex m_surfaceMutex;
}; };
QT_END_NAMESPACE
#endif // ANDROIDSURFACECLIENT_H #endif // ANDROIDSURFACECLIENT_H

View File

@ -45,6 +45,8 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QVector> #include <QVector>
QT_BEGIN_NAMESPACE
typedef QVector<QString> FilesList; typedef QVector<QString> FilesList;
struct AndroidAssetDir struct AndroidAssetDir
@ -394,3 +396,5 @@ QAbstractFileEngine * AndroidAssetsFileEngineHandler::create(const QString &file
} }
return 0; return 0;
} }
QT_END_NAMESPACE

View File

@ -49,6 +49,8 @@
#include <android/asset_manager.h> #include <android/asset_manager.h>
QT_BEGIN_NAMESPACE
struct AndroidAssetDir; struct AndroidAssetDir;
class AndroidAssetsFileEngineHandler: public QAbstractFileEngineHandler class AndroidAssetsFileEngineHandler: public QAbstractFileEngineHandler
{ {
@ -67,4 +69,6 @@ private:
mutable bool m_hasTriedPrepopulatingCache; mutable bool m_hasTriedPrepopulatingCache;
}; };
QT_END_NAMESPACE
#endif // QANDROIDASSETSFILEENGINEHANDLER_H #endif // QANDROIDASSETSFILEENGINEHANDLER_H

View File

@ -47,6 +47,8 @@
#include <private/qguiapplication_p.h> #include <private/qguiapplication_p.h>
#include <qpa/qplatformtheme.h> #include <qpa/qplatformtheme.h>
QT_BEGIN_NAMESPACE
namespace QtAndroidDialogHelpers { namespace QtAndroidDialogHelpers {
static jclass g_messageDialogHelperClass = 0; static jclass g_messageDialogHelperClass = 0;
@ -172,3 +174,5 @@ bool registerNatives(JNIEnv *env)
return true; return true;
} }
} }
QT_END_NAMESPACE

View File

@ -46,6 +46,8 @@
#include <QEventLoop> #include <QEventLoop>
#include <private/qjni_p.h> #include <private/qjni_p.h>
QT_BEGIN_NAMESPACE
namespace QtAndroidDialogHelpers { namespace QtAndroidDialogHelpers {
class QAndroidPlatformMessageDialogHelper: public QPlatformMessageDialogHelper class QAndroidPlatformMessageDialogHelper: public QPlatformMessageDialogHelper
@ -74,4 +76,6 @@ bool registerNatives(JNIEnv *env);
} }
QT_END_NAMESPACE
#endif // QANDROIDPLATFORMDIALOGHELPERS_H #endif // QANDROIDPLATFORMDIALOGHELPERS_H

View File

@ -43,6 +43,8 @@
#include "qandroidplatformfontdatabase.h" #include "qandroidplatformfontdatabase.h"
QT_BEGIN_NAMESPACE
QString QAndroidPlatformFontDatabase::fontDir() const QString QAndroidPlatformFontDatabase::fontDir() const
{ {
return QLatin1String("/system/fonts"); return QLatin1String("/system/fonts");
@ -87,3 +89,5 @@ QStringList QAndroidPlatformFontDatabase::fallbacksForFamily(const QString &fami
return QString(qgetenv("QT_ANDROID_FONTS")).split(";") + m_fallbacks[script]; return QString(qgetenv("QT_ANDROID_FONTS")).split(";") + m_fallbacks[script];
} }
QT_END_NAMESPACE

View File

@ -44,6 +44,8 @@
#include <QtPlatformSupport/private/qbasicfontdatabase_p.h> #include <QtPlatformSupport/private/qbasicfontdatabase_p.h>
QT_BEGIN_NAMESPACE
class QAndroidPlatformFontDatabase: public QBasicFontDatabase class QAndroidPlatformFontDatabase: public QBasicFontDatabase
{ {
public: public:
@ -58,4 +60,6 @@ private:
QHash<QChar::Script, QStringList> m_fallbacks; QHash<QChar::Script, QStringList> m_fallbacks;
}; };
QT_END_NAMESPACE
#endif // QANDROIDPLATFORMFONTDATABASE_H #endif // QANDROIDPLATFORMFONTDATABASE_H

View File

@ -43,6 +43,8 @@
#include "qandroidplatformmenuitem.h" #include "qandroidplatformmenuitem.h"
#include "androidjnimenu.h" #include "androidjnimenu.h"
QT_BEGIN_NAMESPACE
QAndroidPlatformMenu::QAndroidPlatformMenu() QAndroidPlatformMenu::QAndroidPlatformMenu()
{ {
m_tag = reinterpret_cast<quintptr>(this); // QMenu will overwrite this later, but we need a unique ID for QtQuick m_tag = reinterpret_cast<quintptr>(this); // QMenu will overwrite this later, but we need a unique ID for QtQuick
@ -175,3 +177,5 @@ QMutex *QAndroidPlatformMenu::menuItemsMutex()
{ {
return &m_menuItemsMutex; return &m_menuItemsMutex;
} }
QT_END_NAMESPACE

View File

@ -46,6 +46,8 @@
#include <qvector.h> #include <qvector.h>
#include <qmutex.h> #include <qmutex.h>
QT_BEGIN_NAMESPACE
class QAndroidPlatformMenuItem; class QAndroidPlatformMenuItem;
class QAndroidPlatformMenu: public QPlatformMenu class QAndroidPlatformMenu: public QPlatformMenu
{ {
@ -89,4 +91,6 @@ private:
QMutex m_menuItemsMutex; QMutex m_menuItemsMutex;
}; };
QT_END_NAMESPACE
#endif // QANDROIDPLATFORMMENU_H #endif // QANDROIDPLATFORMMENU_H

View File

@ -43,6 +43,7 @@
#include "qandroidplatformmenu.h" #include "qandroidplatformmenu.h"
#include "androidjnimenu.h" #include "androidjnimenu.h"
QT_BEGIN_NAMESPACE
QAndroidPlatformMenuBar::QAndroidPlatformMenuBar() QAndroidPlatformMenuBar::QAndroidPlatformMenuBar()
{ {
@ -109,3 +110,5 @@ QMutex *QAndroidPlatformMenuBar::menusListMutex()
{ {
return &m_menusListMutex; return &m_menusListMutex;
} }
QT_END_NAMESPACE

View File

@ -46,6 +46,8 @@
#include <qvector.h> #include <qvector.h>
#include <qmutex.h> #include <qmutex.h>
QT_BEGIN_NAMESPACE
class QAndroidPlatformMenu; class QAndroidPlatformMenu;
class QAndroidPlatformMenuBar: public QPlatformMenuBar class QAndroidPlatformMenuBar: public QPlatformMenuBar
{ {
@ -71,4 +73,6 @@ private:
QMutex m_menusListMutex; QMutex m_menusListMutex;
}; };
QT_END_NAMESPACE
#endif // QANDROIDPLATFORMMENUBAR_H #endif // QANDROIDPLATFORMMENUBAR_H

View File

@ -42,6 +42,8 @@
#include "qandroidplatformmenuitem.h" #include "qandroidplatformmenuitem.h"
#include "qandroidplatformmenu.h" #include "qandroidplatformmenu.h"
QT_BEGIN_NAMESPACE
QAndroidPlatformMenuItem::QAndroidPlatformMenuItem() QAndroidPlatformMenuItem::QAndroidPlatformMenuItem()
{ {
m_tag = reinterpret_cast<quintptr>(this); // QMenu will overwrite this later, but we need a unique ID for QtQuick m_tag = reinterpret_cast<quintptr>(this); // QMenu will overwrite this later, but we need a unique ID for QtQuick
@ -178,3 +180,5 @@ bool QAndroidPlatformMenuItem::isEnabled() const
{ {
return m_isEnabled; return m_isEnabled;
} }
QT_END_NAMESPACE

View File

@ -43,6 +43,8 @@
#define QANDROIDPLATFORMMENUITEM_H #define QANDROIDPLATFORMMENUITEM_H
#include <qpa/qplatformmenu.h> #include <qpa/qplatformmenu.h>
QT_BEGIN_NAMESPACE
class QAndroidPlatformMenu; class QAndroidPlatformMenu;
class QAndroidPlatformMenuItem: public QPlatformMenuItem class QAndroidPlatformMenuItem: public QPlatformMenuItem
@ -96,4 +98,6 @@ private:
bool m_isEnabled; bool m_isEnabled;
}; };
QT_END_NAMESPACE
#endif // QANDROIDPLATFORMMENUITEM_H #endif // QANDROIDPLATFORMMENUITEM_H

View File

@ -44,6 +44,8 @@
#include <QDir> #include <QDir>
#include <QDebug> #include <QDebug>
QT_BEGIN_NAMESPACE
QAndroidPlatformServices::QAndroidPlatformServices() QAndroidPlatformServices::QAndroidPlatformServices()
{ {
QtAndroid::AttachedJNIEnv env; QtAndroid::AttachedJNIEnv env;
@ -77,3 +79,5 @@ QByteArray QAndroidPlatformServices::desktopEnvironment() const
{ {
return QByteArray("Android"); return QByteArray("Android");
} }
QT_END_NAMESPACE

View File

@ -46,6 +46,8 @@
#include "androidjnimain.h" #include "androidjnimain.h"
#include <jni.h> #include <jni.h>
QT_BEGIN_NAMESPACE
class QAndroidPlatformServices: public QPlatformServices class QAndroidPlatformServices: public QPlatformServices
{ {
public: public:
@ -58,4 +60,6 @@ private:
}; };
QT_END_NAMESPACE
#endif // ANDROIDPLATFORMDESKTOPSERVICE_H #endif // ANDROIDPLATFORMDESKTOPSERVICE_H

View File

@ -50,6 +50,8 @@
#include <private/qguiapplication_p.h> #include <private/qguiapplication_p.h>
#include <qandroidplatformintegration.h> #include <qandroidplatformintegration.h>
QT_BEGIN_NAMESPACE
QAndroidPlatformTheme::QAndroidPlatformTheme(QAndroidPlatformNativeInterface *androidPlatformNativeInterface) QAndroidPlatformTheme::QAndroidPlatformTheme(QAndroidPlatformNativeInterface *androidPlatformNativeInterface)
{ {
m_androidPlatformNativeInterface = androidPlatformNativeInterface; m_androidPlatformNativeInterface = androidPlatformNativeInterface;
@ -240,3 +242,5 @@ QPlatformDialogHelper *QAndroidPlatformTheme::createPlatformDialogHelper(QPlatfo
return 0; return 0;
} }
} }
QT_END_NAMESPACE

View File

@ -45,6 +45,8 @@
#include <qpa/qplatformtheme.h> #include <qpa/qplatformtheme.h>
#include <QtGui/qpalette.h> #include <QtGui/qpalette.h>
QT_BEGIN_NAMESPACE
class QAndroidPlatformNativeInterface; class QAndroidPlatformNativeInterface;
class QAndroidPlatformTheme: public QPlatformTheme class QAndroidPlatformTheme: public QPlatformTheme
{ {
@ -66,4 +68,6 @@ private:
QPalette m_defaultPalette; QPalette m_defaultPalette;
}; };
QT_END_NAMESPACE
#endif // QANDROIDPLATFORMTHEME_H #endif // QANDROIDPLATFORMTHEME_H