Commit 6aefaa1d authored by Sergey Galin's avatar Sergey Galin

Add namespace for Android Asset Handler

parent 300d34a2
...@@ -42,6 +42,10 @@ ...@@ -42,6 +42,10 @@
#include <QtCore/QVector> #include <QtCore/QVector>
#include "AndroidAssetsFileEngineHandler_p.h" #include "AndroidAssetsFileEngineHandler_p.h"
namespace QtAndroidAssets {
typedef QVector<QString> FilesList; typedef QVector<QString> FilesList;
struct AndroidAssetDir struct AndroidAssetDir
...@@ -393,3 +397,4 @@ QAbstractFileEngine * AndroidAssetsFileEngineHandler::create(const QString &file ...@@ -393,3 +397,4 @@ QAbstractFileEngine * AndroidAssetsFileEngineHandler::create(const QString &file
} }
} // namespace QtAndroidAssets
...@@ -66,6 +66,10 @@ ...@@ -66,6 +66,10 @@
#include <QtCore/QSharedPointer> #include <QtCore/QSharedPointer>
#include <android/asset_manager.h> #include <android/asset_manager.h>
namespace QtAndroidAssets {
struct AndroidAssetDir; struct AndroidAssetDir;
class AndroidAssetsFileEngineHandler: public QObject, public QAbstractFileEngineHandler class AndroidAssetsFileEngineHandler: public QObject, public QAbstractFileEngineHandler
...@@ -86,3 +90,5 @@ private: ...@@ -86,3 +90,5 @@ private:
mutable bool m_hasTriedPrepopulatingCache; mutable bool m_hasTriedPrepopulatingCache;
}; };
} // namespace QtAndroidAssets
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
#if defined(QTANDROIDASSETS_STATIC) #if defined(QTANDROIDASSETS_STATIC)
#define QTANDROIDASSETS_EXPORT #define QTANDROIDASSETS_EXPORT
#else #else
#define QTANDROIDASSETS_EXPORT Q_DECL_EXPORT #define QTANDROIDASSETS_EXPORT Q_DECL_EXPORT
#endif #endif
...@@ -39,12 +39,12 @@ QTANDROIDASSETS_EXPORT void installQAndroidAssetHandler(QJniObject & context); ...@@ -39,12 +39,12 @@ QTANDROIDASSETS_EXPORT void installQAndroidAssetHandler(QJniObject & context);
QTANDROIDASSETS_EXPORT void installQAndroidAssetHandler(QJniObject & context) QTANDROIDASSETS_EXPORT void installQAndroidAssetHandler(QJniObject & context)
{ {
static QScopedPointer<QObject> manager; static QScopedPointer<QObject> manager;
if (!manager) if (!manager)
{ {
QScopedPointer<QJniObject> assetmanager(context.callObject("getAssets", "android/content/res/AssetManager")); QScopedPointer<QJniObject> assetmanager(context.callObject("getAssets", "android/content/res/AssetManager"));
QJniEnvPtr jep; QJniEnvPtr jep;
AAssetManager * assetManager = AAssetManager_fromJava(jep.env(), assetmanager->jObject()); AAssetManager * assetManager = AAssetManager_fromJava(jep.env(), assetmanager->jObject());
manager.reset(new AndroidAssetsFileEngineHandler(assetManager)); manager.reset(new QtAndroidAssets::AndroidAssetsFileEngineHandler(assetManager));
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment