summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@digia.com>2014-03-27 12:21:23 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-27 16:44:24 +0100
commitccce4e3da24653f8ebd5f32f969cd67e875a22e1 (patch)
tree9087a4376f64d22c61bdbb1814e60e1a46cd52e8 /src/plugins
parent4ba7b223909d69fc443f1d536e0a884518227d0c (diff)
downloadqtmultimedia-ccce4e3da24653f8ebd5f32f969cd67e875a22e1.tar.gz
Android: Clean-up in jmultimediautils class.
Remove unused code. Change-Id: I2c0db45dd95e6a79387bba1b1ccd4b62b7d22aec Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/android/src/qandroidmediaserviceplugin.cpp1
-rw-r--r--src/plugins/android/src/wrappers/jmultimediautils.cpp43
-rw-r--r--src/plugins/android/src/wrappers/jmultimediautils.h7
3 files changed, 15 insertions, 36 deletions
diff --git a/src/plugins/android/src/qandroidmediaserviceplugin.cpp b/src/plugins/android/src/qandroidmediaserviceplugin.cpp
index b05a4ae0b..0af43210f 100644
--- a/src/plugins/android/src/qandroidmediaserviceplugin.cpp
+++ b/src/plugins/android/src/qandroidmediaserviceplugin.cpp
@@ -165,7 +165,6 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void * /*reserved*/)
if (!JMediaPlayer::initJNI(jniEnv) ||
!JCamera::initJNI(jniEnv) ||
- !JMultimediaUtils::initJNI(jniEnv) ||
!JMediaRecorder::initJNI(jniEnv)) {
return JNI_ERR;
}
diff --git a/src/plugins/android/src/wrappers/jmultimediautils.cpp b/src/plugins/android/src/wrappers/jmultimediautils.cpp
index a20d54477..d1b0830c7 100644
--- a/src/plugins/android/src/wrappers/jmultimediautils.cpp
+++ b/src/plugins/android/src/wrappers/jmultimediautils.cpp
@@ -45,51 +45,36 @@
QT_BEGIN_NAMESPACE
-static jclass g_qtMultimediaUtilsClass = 0;
-
-JMultimediaUtils::JMultimediaUtils()
- : QObject()
- , QJNIObjectPrivate(g_qtMultimediaUtilsClass)
-{
-}
void JMultimediaUtils::enableOrientationListener(bool enable)
{
- callStaticMethod<void>(g_qtMultimediaUtilsClass, "enableOrientationListener", "(Z)V", enable);
+ QJNIObjectPrivate::callStaticMethod<void>("org/qtproject/qt5/android/multimedia/QtMultimediaUtils",
+ "enableOrientationListener",
+ "(Z)V",
+ enable);
}
int JMultimediaUtils::getDeviceOrientation()
{
- return callStaticMethod<jint>(g_qtMultimediaUtilsClass, "getDeviceOrientation");
+ return QJNIObjectPrivate::callStaticMethod<jint>("org/qtproject/qt5/android/multimedia/QtMultimediaUtils",
+ "getDeviceOrientation");
}
QString JMultimediaUtils::getDefaultMediaDirectory(MediaType type)
{
- QJNIObjectPrivate path = callStaticObjectMethod(g_qtMultimediaUtilsClass,
- "getDefaultMediaDirectory",
- "(I)Ljava/lang/String;",
- jint(type));
+ QJNIObjectPrivate path = QJNIObjectPrivate::callStaticObjectMethod("org/qtproject/qt5/android/multimedia/QtMultimediaUtils",
+ "getDefaultMediaDirectory",
+ "(I)Ljava/lang/String;",
+ jint(type));
return path.toString();
}
void JMultimediaUtils::registerMediaFile(const QString &file)
{
- callStaticMethod<void>(g_qtMultimediaUtilsClass,
- "registerMediaFile",
- "(Ljava/lang/String;)V",
- QJNIObjectPrivate::fromString(file).object());
-}
-
-bool JMultimediaUtils::initJNI(JNIEnv *env)
-{
- jclass clazz = env->FindClass("org/qtproject/qt5/android/multimedia/QtMultimediaUtils");
- if (env->ExceptionCheck())
- env->ExceptionClear();
-
- if (clazz)
- g_qtMultimediaUtilsClass = static_cast<jclass>(env->NewGlobalRef(clazz));
-
- return true;
+ QJNIObjectPrivate::callStaticMethod<void>("org/qtproject/qt5/android/multimedia/QtMultimediaUtils",
+ "registerMediaFile",
+ "(Ljava/lang/String;)V",
+ QJNIObjectPrivate::fromString(file).object());
}
QT_END_NAMESPACE
diff --git a/src/plugins/android/src/wrappers/jmultimediautils.h b/src/plugins/android/src/wrappers/jmultimediautils.h
index 9896f7f31..b80ef4236 100644
--- a/src/plugins/android/src/wrappers/jmultimediautils.h
+++ b/src/plugins/android/src/wrappers/jmultimediautils.h
@@ -47,9 +47,8 @@
QT_BEGIN_NAMESPACE
-class JMultimediaUtils : public QObject, public QJNIObjectPrivate
+class JMultimediaUtils
{
- Q_OBJECT
public:
enum MediaType {
Music = 0,
@@ -58,14 +57,10 @@ public:
Sounds = 3
};
- JMultimediaUtils();
-
static void enableOrientationListener(bool enable);
static int getDeviceOrientation();
static QString getDefaultMediaDirectory(MediaType type);
static void registerMediaFile(const QString &file);
-
- static bool initJNI(JNIEnv *env);
};
QT_END_NAMESPACE