summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/src
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kde.org>2014-01-17 10:31:27 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-17 10:23:08 +0100
commit8a9bd001c947e6888d37e99fc456339fd2b51b36 (patch)
tree2b91044f316f1c501e4b781fb008b9dfee527d1d /src/plugins/platforms/android/src
parent338f4c9246fd4a85f3f90ca443fd786a008ba348 (diff)
Support multiple native surfaces on Android.
Support for multiple native surfaces is needed by applications that need to mix raster windows with GL windows. Rework the raster and opengl implementation, get rid of eglfs and fbconvenience dependencies. Create a single android platform plugin. [ChangeLog][Android] Rework the raster and opengl implementation. [ChangeLog][Android] Create a single android platform plugin. Task-number: QTBUG-34650 Change-Id: I9b1ab51554823329dda8cfbf8fef27c38f917c7b Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Diffstat (limited to 'src/plugins/platforms/android/src')
-rw-r--r--src/plugins/platforms/android/src/android.json3
-rw-r--r--src/plugins/platforms/android/src/androidjniaccessibility.cpp272
-rw-r--r--src/plugins/platforms/android/src/androidjniaccessibility.h51
-rw-r--r--src/plugins/platforms/android/src/androidjniclipboard.cpp120
-rw-r--r--src/plugins/platforms/android/src/androidjniclipboard.h61
-rw-r--r--src/plugins/platforms/android/src/androidjniinput.cpp606
-rw-r--r--src/plugins/platforms/android/src/androidjniinput.h59
-rw-r--r--src/plugins/platforms/android/src/androidjnimain.cpp884
-rw-r--r--src/plugins/platforms/android/src/androidjnimain.h124
-rw-r--r--src/plugins/platforms/android/src/androidjnimenu.cpp426
-rw-r--r--src/plugins/platforms/android/src/androidjnimenu.h69
-rw-r--r--src/plugins/platforms/android/src/androidplatformplugin.cpp66
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp95
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglcontext.h69
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp61
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.h60
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp178
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h91
-rw-r--r--src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp161
-rw-r--r--src/plugins/platforms/android/src/qandroidassetsfileenginehandler.cpp309
-rw-r--r--src/plugins/platforms/android/src/qandroidassetsfileenginehandler.h66
-rw-r--r--src/plugins/platforms/android/src/qandroidinputcontext.cpp762
-rw-r--r--src/plugins/platforms/android/src/qandroidinputcontext.h135
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformaccessibility.cpp58
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformaccessibility.h61
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformclipboard.cpp79
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformclipboard.h63
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp204
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformdialoghelpers.h77
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformfontdatabase.cpp79
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformfontdatabase.h58
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformintegration.cpp343
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformintegration.h184
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformmenu.cpp177
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformmenu.h92
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformmenubar.cpp111
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformmenubar.h74
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformmenuitem.cpp180
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformmenuitem.h99
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformservices.cpp79
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformservices.h61
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformtheme.cpp170
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformtheme.h65
-rw-r--r--src/plugins/platforms/android/src/qandroidsystemlocale.cpp177
-rw-r--r--src/plugins/platforms/android/src/qandroidsystemlocale.h67
-rw-r--r--src/plugins/platforms/android/src/raster/qandroidplatformscreen.cpp94
-rw-r--r--src/plugins/platforms/android/src/raster/qandroidplatformscreen.h62
-rw-r--r--src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp102
-rw-r--r--src/plugins/platforms/android/src/raster/qandroidplatformwindow.h64
-rw-r--r--src/plugins/platforms/android/src/raster/raster.pri7
-rw-r--r--src/plugins/platforms/android/src/src.pri55
51 files changed, 0 insertions, 7670 deletions
diff --git a/src/plugins/platforms/android/src/android.json b/src/plugins/platforms/android/src/android.json
deleted file mode 100644
index 6843bd3301..0000000000
--- a/src/plugins/platforms/android/src/android.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys": [ "android" ]
-}
diff --git a/src/plugins/platforms/android/src/androidjniaccessibility.cpp b/src/plugins/platforms/android/src/androidjniaccessibility.cpp
deleted file mode 100644
index b987c49c9c..0000000000
--- a/src/plugins/platforms/android/src/androidjniaccessibility.cpp
+++ /dev/null
@@ -1,272 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "androidjniaccessibility.h"
-#include "androidjnimain.h"
-#include "qandroidplatformintegration.h"
-#include "qpa/qplatformaccessibility.h"
-#include "qguiapplication.h"
-#include "qwindow.h"
-#include "qrect.h"
-#include "QtGui/qaccessible.h"
-
-#include "qdebug.h"
-
-static const char m_qtTag[] = "QtA11y";
-static const char m_classErrorMsg[] = "Can't find class \"%s\"";
-static const char m_methodErrorMsg[] = "Can't find method \"%s%s\"";
-
-namespace QtAndroidAccessibility
-{
- static void setActive(JNIEnv */*env*/, jobject /*thiz*/, jboolean active)
- {
- QAndroidPlatformIntegration *platformIntegration = QtAndroid::androidPlatformIntegration();
- if (platformIntegration)
- platformIntegration->accessibility()->setActive(active);
- else
- __android_log_print(ANDROID_LOG_WARN, m_qtTag, "Could not activate platform accessibility.");
- }
-
- QAccessibleInterface *interfaceFromId(jint objectId)
- {
- QAccessibleInterface *iface = 0;
- if (objectId == -1) {
- QWindow *win = qApp->focusWindow();
- if (win)
- iface = win->accessibleRoot();
- } else {
- iface = QAccessible::accessibleInterface(objectId);
- }
- return iface;
- }
-
- static jintArray childIdListForAccessibleObject(JNIEnv *env, jobject /*thiz*/, jint objectId)
- {
- QAccessibleInterface *iface = interfaceFromId(objectId);
- if (iface) {
- jintArray jArray = env->NewIntArray(jsize(iface->childCount()));
- for (int i = 0; i < iface->childCount(); ++i) {
- QAccessibleInterface *child = iface->child(i);
- if (child) {
- QAccessible::Id ifaceId = QAccessible::uniqueId(child);
- jint jid = ifaceId;
- env->SetIntArrayRegion(jArray, i, 1, &jid);
- }
- }
- return jArray;
- }
-
- return env->NewIntArray(jsize(0));
- }
-
- static jint parentId(JNIEnv */*env*/, jobject /*thiz*/, jint objectId)
- {
- QAccessibleInterface *iface = interfaceFromId(objectId);
- if (iface) {
- QAccessibleInterface *parent = iface->parent();
- if (parent) {
- if (parent->role() == QAccessible::Application)
- return -1;
- return QAccessible::uniqueId(parent);
- }
- }
- return -1;
- }
-
- static jobject screenRect(JNIEnv *env, jobject /*thiz*/, jint objectId)
- {
- QRect rect;
- QAccessibleInterface *iface = interfaceFromId(objectId);
- if (iface && iface->isValid()) {
- rect = iface->rect();
- }
-
- jclass rectClass = env->FindClass("android/graphics/Rect");
- jmethodID ctor = env->GetMethodID(rectClass, "<init>", "(IIII)V");
- jobject jrect = env->NewObject(rectClass, ctor, rect.left(), rect.top(), rect.right(), rect.bottom());
- return jrect;
- }
-
- static jint hitTest(JNIEnv */*env*/, jobject /*thiz*/, jfloat x, jfloat y)
- {
- QAccessibleInterface *root = interfaceFromId(-1);
- if (root) {
- QAccessibleInterface *child = root->childAt((int)x, (int)y);
- QAccessibleInterface *lastChild = 0;
- while (child && (child != lastChild)) {
- lastChild = child;
- child = child->childAt((int)x, (int)y);
- }
- if (lastChild)
- return QAccessible::uniqueId(lastChild);
- }
- return -1;
- }
-
- static jboolean clickAction(JNIEnv */*env*/, jobject /*thiz*/, jint objectId)
- {
-// qDebug() << "A11Y: CLICK: " << objectId;
- QAccessibleInterface *iface = interfaceFromId(objectId);
- if (iface && iface->actionInterface()) {
- if (iface->actionInterface()->actionNames().contains(QAccessibleActionInterface::pressAction()))
- iface->actionInterface()->doAction(QAccessibleActionInterface::pressAction());
- else
- iface->actionInterface()->doAction(QAccessibleActionInterface::toggleAction());
- }
- return false;
- }
-
-
-#define FIND_AND_CHECK_CLASS(CLASS_NAME) \
-clazz = env->FindClass(CLASS_NAME); \
-if (!clazz) { \
- __android_log_print(ANDROID_LOG_FATAL, m_qtTag, m_classErrorMsg, CLASS_NAME); \
- return JNI_FALSE; \
-}
-
- //__android_log_print(ANDROID_LOG_FATAL, m_qtTag, m_methodErrorMsg, METHOD_NAME, METHOD_SIGNATURE);
-
-#define CALL_METHOD(OBJECT, METHOD_NAME, METHOD_SIGNATURE, ...) \
-{ \
- jclass clazz = env->GetObjectClass(OBJECT); \
- jmethodID method = env->GetMethodID(clazz, METHOD_NAME, METHOD_SIGNATURE); \
- if (!method) { \
- __android_log_print(ANDROID_LOG_WARN, m_qtTag, m_methodErrorMsg, METHOD_NAME, METHOD_SIGNATURE); \
- return; \
- } \
- env->CallVoidMethod(OBJECT, method, __VA_ARGS__); \
-}
-
-
- static jstring descriptionForAccessibleObject(JNIEnv *env, jobject /*thiz*/, jint objectId)
- {
- QString desc;
- QAccessibleInterface *iface = interfaceFromId(objectId);
- if (iface && iface->isValid()) {
- desc = iface->text(QAccessible::Name);
- if (desc.isEmpty())
- desc = iface->text(QAccessible::Description);
-
- desc += QChar(' ') + QString::fromUtf8(qAccessibleRoleString(iface->role()));
- }
-
- jstring jdesc = env->NewString((jchar*) desc.constData(), (jsize) desc.size());
- return jdesc;
- }
-
- static void populateNode(JNIEnv *env, jobject /*thiz*/, jint objectId, jobject node)
- {
- QAccessibleInterface *iface = interfaceFromId(objectId);
- if (!iface || !iface->isValid()) {
- __android_log_print(ANDROID_LOG_WARN, m_qtTag, "Accessibility: populateNode for Invalid ID");
- return;
- }
- QAccessible::State state = iface->state();
-
- // try to fill in the text property, this is what the screen reader reads
- QString desc = iface->text(QAccessible::Value);
- if (desc.isEmpty())
- desc = iface->text(QAccessible::Name);
- if (desc.isEmpty())
- desc = iface->text(QAccessible::Description);
- if (QAccessibleTextInterface *textIface = iface->textInterface()) {
- if (textIface->selectionCount() > 0) {
- int startSelection;
- int endSelection;
- textIface->selection(0, &startSelection, &endSelection);
- CALL_METHOD(node, "setTextSelection", "(II)V", startSelection, endSelection)
- }
- }
-
- if ((iface->role() != QAccessible::NoRole) &&
- (iface->role() != QAccessible::Client) &&
- (iface->role() != QAccessible::Pane)) {
- desc += QChar(' ') + QString::fromUtf8(qAccessibleRoleString(iface->role()));
- }
-
- CALL_METHOD(node, "setEnabled", "(Z)V", !state.disabled)
- //CALL_METHOD(node, "setFocusable", "(Z)V", state.focusable)
- CALL_METHOD(node, "setFocusable", "(Z)V", true)
- //CALL_METHOD(node, "setFocused", "(Z)V", state.focused)
- CALL_METHOD(node, "setCheckable", "(Z)V", state.checkable)
- CALL_METHOD(node, "setChecked", "(Z)V", state.checked)
- CALL_METHOD(node, "setVisibleToUser", "(Z)V", !state.invisible)
-
- if (iface->actionInterface()) {
- QStringList actions = iface->actionInterface()->actionNames();
- bool clickable = actions.contains(QAccessibleActionInterface::pressAction());
- bool toggle = actions.contains(QAccessibleActionInterface::toggleAction());
- if (clickable || toggle) {
- CALL_METHOD(node, "setClickable", "(Z)V", clickable)
- CALL_METHOD(node, "addAction", "(I)V", 16) // ACTION_CLICK defined in AccessibilityNodeInfo
- }
- }
-
- jstring jdesc = env->NewString((jchar*) desc.constData(), (jsize) desc.size());
- //CALL_METHOD(node, "setText", "(Ljava/lang/CharSequence;)V", jdesc)
- CALL_METHOD(node, "setContentDescription", "(Ljava/lang/CharSequence;)V", jdesc)
- }
-
- static JNINativeMethod methods[] = {
- {"setActive","(Z)V",(void*)setActive},
- {"childIdListForAccessibleObject", "(I)[I", (jintArray)childIdListForAccessibleObject},
- {"parentId", "(I)I", (void*)parentId},
- {"descriptionForAccessibleObject", "(I)Ljava/lang/String;", (jstring)descriptionForAccessibleObject},
- {"screenRect", "(I)Landroid/graphics/Rect;", (jobject)screenRect},
- {"hitTest", "(FF)I", (void*)hitTest},
- {"populateNode", "(ILandroid/view/accessibility/AccessibilityNodeInfo;)V", (void*)populateNode},
- {"clickAction", "(I)Z", (void*)clickAction},
- };
-
- bool registerNatives(JNIEnv *env)
- {
- jclass clazz;
- FIND_AND_CHECK_CLASS("org/qtproject/qt5/android/accessibility/QtNativeAccessibility");
- jclass appClass = static_cast<jclass>(env->NewGlobalRef(clazz));
-
- if (env->RegisterNatives(appClass, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
- __android_log_print(ANDROID_LOG_FATAL,"Qt", "RegisterNatives failed");
- return false;
- }
-
- return true;
- }
-}
diff --git a/src/plugins/platforms/android/src/androidjniaccessibility.h b/src/plugins/platforms/android/src/androidjniaccessibility.h
deleted file mode 100644
index e708138c33..0000000000
--- a/src/plugins/platforms/android/src/androidjniaccessibility.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDJNIACCESSIBILITY_H
-#define ANDROIDJNIACCESSIBILITY_H
-#include <jni.h>
-
-namespace QtAndroidAccessibility
-{
- bool registerNatives(JNIEnv *env);
-}
-
-#endif // ANDROIDJNIINPUT_H
diff --git a/src/plugins/platforms/android/src/androidjniclipboard.cpp b/src/plugins/platforms/android/src/androidjniclipboard.cpp
deleted file mode 100644
index 05270ac374..0000000000
--- a/src/plugins/platforms/android/src/androidjniclipboard.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "androidjniclipboard.h"
-#include "androidjnimain.h"
-
-using namespace QtAndroid;
-namespace QtAndroidClipboard
-{
- // Clipboard support
- static jmethodID m_registerClipboardManagerMethodID = 0;
- static jmethodID m_setClipboardTextMethodID = 0;
- static jmethodID m_hasClipboardTextMethodID = 0;
- static jmethodID m_getClipboardTextMethodID = 0;
- // Clipboard support
-
- void setClipboardListener(QAndroidPlatformClipboard *listener)
- {
- Q_UNUSED(listener);
-
- AttachedJNIEnv env;
- if (!env.jniEnv)
- return;
-
- env.jniEnv->CallStaticVoidMethod(applicationClass(), m_registerClipboardManagerMethodID);
- }
-
- void setClipboardText(const QString &text)
- {
- AttachedJNIEnv env;
- if (!env.jniEnv)
- return;
-
- jstring jtext = env.jniEnv->NewString(reinterpret_cast<const jchar *>(text.data()),
- text.length());
- env.jniEnv->CallStaticVoidMethod(applicationClass(), m_setClipboardTextMethodID, jtext);
- env.jniEnv->DeleteLocalRef(jtext);
- }
-
- bool hasClipboardText()
- {
- AttachedJNIEnv env;
- if (!env.jniEnv)
- return false;
-
- return env.jniEnv->CallStaticBooleanMethod(applicationClass(), m_hasClipboardTextMethodID);
- }
-
- QString clipboardText()
- {
- AttachedJNIEnv env;
- if (!env.jniEnv)
- return QString();
-
- jstring text = reinterpret_cast<jstring>(env.jniEnv->CallStaticObjectMethod(applicationClass(),
- m_getClipboardTextMethodID));
- const jchar *jstr = env.jniEnv->GetStringChars(text, 0);
- QString str(reinterpret_cast<const QChar *>(jstr), env.jniEnv->GetStringLength(text));
- env.jniEnv->ReleaseStringChars(text, jstr);
- return str;
- }
-
-
-#define GET_AND_CHECK_STATIC_METHOD(VAR, CLASS, METHOD_NAME, METHOD_SIGNATURE) \
- VAR = env->GetStaticMethodID(CLASS, METHOD_NAME, METHOD_SIGNATURE); \
- if (!VAR) { \
- __android_log_print(ANDROID_LOG_FATAL, qtTagText(), methodErrorMsgFmt(), METHOD_NAME, METHOD_SIGNATURE); \
- return false; \
- }
-
- bool registerNatives(JNIEnv *env)
- {
- jclass appClass = QtAndroid::applicationClass();
-
- GET_AND_CHECK_STATIC_METHOD(m_registerClipboardManagerMethodID, appClass, "registerClipboardManager", "()V");
- GET_AND_CHECK_STATIC_METHOD(m_setClipboardTextMethodID, appClass, "setClipboardText", "(Ljava/lang/String;)V");
- GET_AND_CHECK_STATIC_METHOD(m_hasClipboardTextMethodID, appClass, "hasClipboardText", "()Z");
- GET_AND_CHECK_STATIC_METHOD(m_getClipboardTextMethodID, appClass, "getClipboardText", "()Ljava/lang/String;");
-
- return true;
- }
-}
diff --git a/src/plugins/platforms/android/src/androidjniclipboard.h b/src/plugins/platforms/android/src/androidjniclipboard.h
deleted file mode 100644
index 15cd93202e..0000000000
--- a/src/plugins/platforms/android/src/androidjniclipboard.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDJNICLIPBOARD_H
-#define ANDROIDJNICLIPBOARD_H
-
-#include <jni.h>
-#include <QString>
-
-class QAndroidPlatformClipboard;
-namespace QtAndroidClipboard
-{
- // Clipboard support
- void setClipboardListener(QAndroidPlatformClipboard *listener);
- void setClipboardText(const QString &text);
- bool hasClipboardText();
- QString clipboardText();
- // Clipboard support
-
- bool registerNatives(JNIEnv *env);
-}
-
-#endif // ANDROIDJNICLIPBOARD_H
diff --git a/src/plugins/platforms/android/src/androidjniinput.cpp b/src/plugins/platforms/android/src/androidjniinput.cpp
deleted file mode 100644
index 55d44b7377..0000000000
--- a/src/plugins/platforms/android/src/androidjniinput.cpp
+++ /dev/null
@@ -1,606 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "androidjniinput.h"
-#include "androidjnimain.h"
-#include "qandroidplatformintegration.h"
-
-#include <qpa/qwindowsysteminterface.h>
-#include <QTouchEvent>
-#include <QPointer>
-
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
-# include <QDebug>
-#endif
-
-using namespace QtAndroid;
-
-namespace QtAndroidInput
-{
- static jmethodID m_showSoftwareKeyboardMethodID = 0;
- static jmethodID m_resetSoftwareKeyboardMethodID = 0;
- static jmethodID m_hideSoftwareKeyboardMethodID = 0;
- static jmethodID m_isSoftwareKeyboardVisibleMethodID = 0;
- static jmethodID m_updateSelectionMethodID = 0;
-
- static bool m_ignoreMouseEvents = false;
-
- static QList<QWindowSystemInterface::TouchPoint> m_touchPoints;
-
- static QPointer<QWindow> m_mouseGrabber;
-
- static int m_lastCursorPos = -1;
-
- void updateSelection(int selStart, int selEnd, int candidatesStart, int candidatesEnd)
- {
- AttachedJNIEnv env;
- if (!env.jniEnv)
- return;
-
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << ">>> UPDATESELECTION" << selStart << selEnd << candidatesStart << candidatesEnd;
-#endif
- if (candidatesStart == -1 && candidatesEnd == -1 && selStart == selEnd) {
- // Qt only gives us position inside the block, so if we move to the
- // same position in another block, the Android keyboard will believe
- // we have not changed position, and be terribly confused.
- if (selStart == m_lastCursorPos) {
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << ">>> FAKEUPDATESELECTION" << selStart+1;
-#endif
- env.jniEnv->CallStaticVoidMethod(applicationClass(), m_updateSelectionMethodID,
- selStart+1, selEnd+1, candidatesStart, candidatesEnd);
- }
- m_lastCursorPos = selStart;
- } else {
- m_lastCursorPos = -1;
- }
- env.jniEnv->CallStaticVoidMethod(applicationClass(), m_updateSelectionMethodID,
- selStart, selEnd, candidatesStart, candidatesEnd);
- }
-
- void showSoftwareKeyboard(int left, int top, int width, int height, int inputHints)
- {
- AttachedJNIEnv env;
- if (!env.jniEnv)
- return;
-
- env.jniEnv->CallStaticVoidMethod(applicationClass(),
- m_showSoftwareKeyboardMethodID,
- left,
- top,
- width,
- height,
- inputHints);
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ SHOWSOFTWAREKEYBOARD" << left << top << width << height << inputHints;
-#endif
- }
-
- void resetSoftwareKeyboard()
- {
- AttachedJNIEnv env;
- if (!env.jniEnv)
- return;
-
- env.jniEnv->CallStaticVoidMethod(applicationClass(), m_resetSoftwareKeyboardMethodID);
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ RESETSOFTWAREKEYBOARD";
-#endif
- }
-
- void hideSoftwareKeyboard()
- {
- AttachedJNIEnv env;
- if (!env.jniEnv)
- return;
-
- env.jniEnv->CallStaticVoidMethod(applicationClass(), m_hideSoftwareKeyboardMethodID);
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ HIDESOFTWAREKEYBOARD";
-#endif
- }
-
- bool isSoftwareKeyboardVisible()
- {
- AttachedJNIEnv env;
- if (!env.jniEnv)
- return false;
-
- bool visibility = env.jniEnv->CallStaticBooleanMethod(applicationClass(), m_isSoftwareKeyboardVisibleMethodID);
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ ISSOFTWAREKEYBOARDVISIBLE" << visibility;
-#endif
- return visibility;
- }
-
-
- static void mouseDown(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint x, jint y)
- {
- if (m_ignoreMouseEvents)
- return;
-
- QPoint globalPos(x,y);
- QWindow *tlw = topLevelWindowAt(globalPos);
- m_mouseGrabber = tlw;
- QPoint localPos = tlw ? (globalPos - tlw->position()) : globalPos;
- QWindowSystemInterface::handleMouseEvent(tlw,
- localPos,
- globalPos,
- Qt::MouseButtons(Qt::LeftButton));
- }
-
- static void mouseUp(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint x, jint y)
- {
- QPoint globalPos(x,y);
- QWindow *tlw = m_mouseGrabber.data();
- if (!tlw)
- tlw = topLevelWindowAt(globalPos);
- QPoint localPos = tlw ? (globalPos -tlw->position()) : globalPos;
- QWindowSystemInterface::handleMouseEvent(tlw, localPos, globalPos
- , Qt::MouseButtons(Qt::NoButton));
- m_ignoreMouseEvents = false;
- m_mouseGrabber = 0;
- }
-
- static void mouseMove(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint x, jint y)
- {
-
- if (m_ignoreMouseEvents)
- return;
-
- QPoint globalPos(x,y);
- QWindow *tlw = m_mouseGrabber.data();
- if (!tlw)
- tlw = topLevelWindowAt(globalPos);
- QPoint localPos = tlw ? (globalPos-tlw->position()) : globalPos;
- QWindowSystemInterface::handleMouseEvent(tlw,
- localPos,
- globalPos,
- Qt::MouseButtons(Qt::LeftButton));
- }
-
- static void longPress(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint x, jint y)
- {
- //### TODO: add proper API for Qt 5.2
- static bool rightMouseFromLongPress = qgetenv("QT_NECESSITAS_COMPATIBILITY_LONG_PRESS").toInt();
- if (!rightMouseFromLongPress)
- return;
- m_ignoreMouseEvents = true;
- QPoint globalPos(x,y);
- QWindow *tlw = topLevelWindowAt(globalPos);
- QPoint localPos = tlw ? (globalPos-tlw->position()) : globalPos;
-
- // Release left button
- QWindowSystemInterface::handleMouseEvent(tlw,
- localPos,
- globalPos,
- Qt::MouseButtons(Qt::NoButton));
-
- // Press right button
- QWindowSystemInterface::handleMouseEvent(tlw,
- localPos,
- globalPos,
- Qt::MouseButtons(Qt::RightButton));
- }
-
- static void touchBegin(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/)
- {
- m_touchPoints.clear();
- }
-
- static void touchAdd(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint id, jint action, jboolean /*primary*/, jint x, jint y, jfloat size, jfloat pressure)
- {
- Qt::TouchPointState state = Qt::TouchPointStationary;
- switch (action) {
- case 0:
- state = Qt::TouchPointPressed;
- break;
- case 1:
- state = Qt::TouchPointMoved;
- break;
- case 2:
- state = Qt::TouchPointStationary;
- break;
- case 3:
- state = Qt::TouchPointReleased;
- break;
- }
-
- const int dw = desktopWidthPixels();
- const int dh = desktopHeightPixels();
- QWindowSystemInterface::TouchPoint touchPoint;
- touchPoint.id = id;
- touchPoint.pressure = pressure;
- touchPoint.normalPosition = QPointF(double(x / dw), double(y / dh));
- touchPoint.state = state;
- touchPoint.area = QRectF(x - double(dw*size) / 2.0,
- y - double(dh*size) / 2.0,
- double(dw*size),
- double(dh*size));
- m_touchPoints.push_back(touchPoint);
- }
-
- static void touchEnd(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint /*action*/)
- {
- if (m_touchPoints.isEmpty())
- return;
-
- QAndroidPlatformIntegration *platformIntegration = QtAndroid::androidPlatformIntegration();
- if (!platformIntegration)
- return;
-
- QTouchDevice *touchDevice = platformIntegration->touchDevice();
- if (touchDevice == 0) {
- touchDevice = new QTouchDevice;
- touchDevice->setType(QTouchDevice::TouchScreen);
- touchDevice->setCapabilities(QTouchDevice::Position
- | QTouchDevice::Area
- | QTouchDevice::Pressure
- | QTouchDevice::NormalizedPosition);
- QWindowSystemInterface::registerTouchDevice(touchDevice);
- platformIntegration->setTouchDevice(touchDevice);
- }
-
- QWindow *window = QtAndroid::topLevelWindowAt(m_touchPoints.at(0).area.center().toPoint());
- QWindowSystemInterface::handleTouchEvent(window, touchDevice, m_touchPoints);
- }
-
- static int mapAndroidKey(int key)
- {
- // 0--9 0x00000007 -- 0x00000010
- if (key >= 0x00000007 && key <= 0x00000010)
- return Qt::Key_0 + key - 0x00000007;
-
- // A--Z 0x0000001d -- 0x00000036
- if (key >= 0x0000001d && key <= 0x00000036)
- return Qt::Key_A + key - 0x0000001d;
-
- switch (key) {
- case 0x00000039:
- case 0x0000003a:
- return Qt::Key_Alt;
-
- case 0x0000004b:
- return Qt::Key_Apostrophe;
-
- case 0x00000004: // KEYCODE_BACK
- return Qt::Key_Back;
-
- case 0x00000049:
- return Qt::Key_Backslash;
-
- case 0x00000005:
- return Qt::Key_Call;
-
- case 0x0000001b: // KEYCODE_CAMERA
- return Qt::Key_Camera;
-
- case 0x0000001c:
- return Qt::Key_Clear;
-
- case 0x00000037:
- return Qt::Key_Comma;
-
- case 0x00000043: // KEYCODE_DEL
- return Qt::Key_Backspace;
-
- case 0x00000017: // KEYCODE_DPAD_CENTER
- return Qt::Key_Enter;
-
- case 0x00000014: // KEYCODE_DPAD_DOWN
- return Qt::Key_Down;
-
- case 0x00000015: //KEYCODE_DPAD_LEFT
- return Qt::Key_Left;
-
- case 0x00000016: //KEYCODE_DPAD_RIGHT
- return Qt::Key_Right;
-
- case 0x00000013: //KEYCODE_DPAD_UP
- return Qt::Key_Up;
-
- case 0x00000006: //KEYCODE_ENDCALL
- return Qt::Key_Hangup;
-
- case 0x00000042:
- return Qt::Key_Return;
-
- case 0x00000041: //KEYCODE_ENVELOPE
- return Qt::Key_LaunchMail;
-
- case 0x00000046:
- return Qt::Key_Equal;
-
- case 0x00000040:
- return Qt::Key_Explorer;
-
- case 0x00000003:
- return Qt::Key_Home;
-
- case 0x00000047:
- return Qt::Key_BracketLeft;
-
- case 0x0000005a: // KEYCODE_MEDIA_FAST_FORWARD
- return Qt::Key_AudioForward;
-
- case 0x00000057:
- return Qt::Key_MediaNext;
-
- case 0x00000055:
- return Qt::Key_MediaPlay;
-
- case 0x00000058:
- return Qt::Key_MediaPrevious;
-
- case 0x00000059: // KEYCODE_MEDIA_REWIND
- return Qt::Key_AudioRewind;
-
- case 0x00000056:
- return Qt::Key_MediaStop;
-
- case 0x00000052: //KEYCODE_MENU
- return Qt::Key_Menu;
-
- case 0x00000045:
- return Qt::Key_Minus;
-
- case 0x0000005b: // KEYCODE_MUTE
- return Qt::Key_MicMute;
-
- case 0x0000004e:
- return Qt::Key_NumLock;
-
- case 0x00000038:
- return Qt::Key_Period;
-
- case 0x00000051:
- return Qt::Key_Plus;
-
- case 0x0000001a:
- return Qt::Key_PowerOff;
-
- case 0x00000048:
- return Qt::Key_BracketRight;
-
- case 0x00000054:
- return Qt::Key_Search;
-
- case 0x0000004a:
- return Qt::Key_Semicolon;
-
- case 0x0000003b:
- case 0x0000003c:
- return Qt::Key_Shift;
-
- case 0x0000004c:
- return Qt::Key_Slash;
-
- case 0x00000001:
- return Qt::Key_Left;
-
- case 0x00000002:
- return Qt::Key_Right;
-
- case 0x0000003e:
- return Qt::Key_Space;
-
- case 0x0000003f: // KEYCODE_SYM
- return Qt::Key_Meta;
-
- case 0x0000003d:
- return Qt::Key_Tab;
-
- case 0x00000019:
- return Qt::Key_VolumeDown;
-
- case 0x000000a4: // KEYCODE_VOLUME_MUTE
- return Qt::Key_VolumeMute;
-
- case 0x00000018:
- return Qt::Key_VolumeUp;
-
- case 0x00000011: // KEYCODE_STAR
- return Qt::Key_Asterisk;
-
- case 0x00000012: // KEYCODE_POUND
- return Qt::Key_NumberSign;
-
- case 0x00000050: // KEYCODE_FOCUS
- return Qt::Key_CameraFocus;
-
- case 0x00000070: // KEYCODE_FORWARD_DEL
- return Qt::Key_Delete;
-
- case 0x00000080: // KEYCODE_MEDIA_CLOSE
- return Qt::Key_Close;
-
- case 0x00000081: // KEYCODE_MEDIA_EJECT
- return Qt::Key_Eject;
-
- case 0x00000082: // KEYCODE_MEDIA_RECORD
- return Qt::Key_MediaRecord;
-
- case 0x000000b7: // KEYCODE_PROG_RED
- return Qt::Key_Red;
-
- case 0x000000b8: // KEYCODE_PROG_GREEN
- return Qt::Key_Green;
-
- case 0x000000b9: // KEYCODE_PROG_YELLOW
- return Qt::Key_Yellow;
-
- case 0x000000ba: // KEYCODE_PROG_BLUE
- return Qt::Key_Blue;
-
- case 0x000000a5: // KEYCODE_INFO
- return Qt::Key_Info;
-
- case 0x000000a6: // KEYCODE_CHANNEL_UP
- return Qt::Key_ChannelUp;
-
- case 0x000000a7: // KEYCODE_CHANNEL_DOWN
- return Qt::Key_ChannelDown;
-
- case 0x000000a8: // KEYCODE_ZOOM_IN
- return Qt::Key_ZoomIn;
-
- case 0x000000a9: // KEYCODE_ZOOM_OUT
- return Qt::Key_ZoomOut;
-
- case 0x000000ac: // KEYCODE_GUIDE
- return Qt::Key_Guide;
-
- case 0x000000af: // KEYCODE_CAPTIONS
- return Qt::Key_Subtitle;
-
- case 0x000000b0: // KEYCODE_SETTINGS
- return Qt::Key_Settings;
-
- case 0x000000d0: // KEYCODE_CALENDAR
- return Qt::Key_Calendar;
-
- case 0x000000d1: // KEYCODE_MUSIC
- return Qt::Key_Music;
-
- case 0x000000d2: // KEYCODE_CALCULATOR
- return Qt::Key_Calculator;
-
- case 0x00000000: // KEYCODE_UNKNOWN
- return Qt::Key_unknown;
-
- case 0x00000053: // KEYCODE_NOTIFICATION ?!?!?
- case 0x0000004f: // KEYCODE_HEADSETHOOK ?!?!?
- case 0x00000044: // KEYCODE_GRAVE ?!?!?
- return Qt::Key_Any;
-
- default:
- return 0;
- }
- }
-
- static void keyDown(JNIEnv */*env*/, jobject /*thiz*/, jint key, jint unicode, jint modifier)
- {
- Qt::KeyboardModifiers modifiers;
- if (modifier & 1)
- modifiers |= Qt::ShiftModifier;
-
- if (modifier & 2)
- modifiers |= Qt::AltModifier;
-
- if (modifier & 4)
- modifiers |= Qt::MetaModifier;
-
- QWindowSystemInterface::handleKeyEvent(0,
- QEvent::KeyPress,
- mapAndroidKey(key),
- modifiers,
- QChar(unicode),
- false);
- }
-
- static void keyUp(JNIEnv */*env*/, jobject /*thiz*/, jint key, jint unicode, jint modifier)
- {
- Qt::KeyboardModifiers modifiers;
- if (modifier & 1)
- modifiers |= Qt::ShiftModifier;
-
- if (modifier & 2)
- modifiers |= Qt::AltModifier;
-
- if (modifier & 4)
- modifiers |= Qt::MetaModifier;
-
- QWindowSystemInterface::handleKeyEvent(0,
- QEvent::KeyRelease,
- mapAndroidKey(key),
- modifiers,
- QChar(unicode),
- false);
- }
-
- static void keyboardVisibilityChanged(JNIEnv */*env*/, jobject /*thiz*/, jboolean /*visibility*/)
- {
- QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext();
- if (inputContext)
- inputContext->emitInputPanelVisibleChanged();
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ KEYBOARDVISIBILITYCHANGED" << inputContext;
-#endif
- }
-
- static JNINativeMethod methods[] = {
- {"touchBegin","(I)V",(void*)touchBegin},
- {"touchAdd","(IIIZIIFF)V",(void*)touchAdd},
- {"touchEnd","(II)V",(void*)touchEnd},
- {"mouseDown", "(III)V", (void *)mouseDown},
- {"mouseUp", "(III)V", (void *)mouseUp},
- {"mouseMove", "(III)V", (void *)mouseMove},
- {"longPress", "(III)V", (void *)longPress},
- {"keyDown", "(III)V", (void *)keyDown},
- {"keyUp", "(III)V", (void *)keyUp},
- {"keyboardVisibilityChanged", "(Z)V", (void *)keyboardVisibilityChanged}
- };
-
-#define GET_AND_CHECK_STATIC_METHOD(VAR, CLASS, METHOD_NAME, METHOD_SIGNATURE) \
- VAR = env->GetStaticMethodID(CLASS, METHOD_NAME, METHOD_SIGNATURE); \
- if (!VAR) { \
- __android_log_print(ANDROID_LOG_FATAL, qtTagText(), methodErrorMsgFmt(), METHOD_NAME, METHOD_SIGNATURE); \
- return false; \
- }
-
- bool registerNatives(JNIEnv *env)
- {
- jclass appClass = QtAndroid::applicationClass();
-
- if (env->RegisterNatives(appClass, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
- __android_log_print(ANDROID_LOG_FATAL,"Qt", "RegisterNatives failed");
- return false;
- }
-
- GET_AND_CHECK_STATIC_METHOD(m_showSoftwareKeyboardMethodID, appClass, "showSoftwareKeyboard", "(IIIII)V");
- GET_AND_CHECK_STATIC_METHOD(m_resetSoftwareKeyboardMethodID, appClass, "resetSoftwareKeyboard", "()V");
- GET_AND_CHECK_STATIC_METHOD(m_hideSoftwareKeyboardMethodID, appClass, "hideSoftwareKeyboard", "()V");
- GET_AND_CHECK_STATIC_METHOD(m_isSoftwareKeyboardVisibleMethodID, appClass, "isSoftwareKeyboardVisible", "()Z");
- GET_AND_CHECK_STATIC_METHOD(m_updateSelectionMethodID, appClass, "updateSelection", "(IIII)V");
- return true;
- }
-}
diff --git a/src/plugins/platforms/android/src/androidjniinput.h b/src/plugins/platforms/android/src/androidjniinput.h
deleted file mode 100644
index a78c7519db..0000000000
--- a/src/plugins/platforms/android/src/androidjniinput.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDJNIINPUT_H
-#define ANDROIDJNIINPUT_H
-#include <jni.h>
-
-namespace QtAndroidInput
-{
- // Software keyboard support
- void showSoftwareKeyboard(int top, int left, int width, int height, int inputHints);
- void resetSoftwareKeyboard();
- void hideSoftwareKeyboard();
- bool isSoftwareKeyboardVisible();
- void updateSelection(int selStart, int selEnd, int candidatesStart, int candidatesEnd);
- // Software keyboard support
-
- bool registerNatives(JNIEnv *env);
-}
-
-#endif // ANDROIDJNIINPUT_H
diff --git a/src/plugins/platforms/android/src/androidjnimain.cpp b/src/plugins/platforms/android/src/androidjnimain.cpp
deleted file mode 100644
index 3064e5d4e2..0000000000
--- a/src/plugins/platforms/android/src/androidjnimain.cpp
+++ /dev/null
@@ -1,884 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui/private/qguiapplication_p.h>
-
-#include <dlfcn.h>
-#include <pthread.h>
-#include <qcoreapplication.h>
-#include <qimage.h>
-#include <qpoint.h>
-#include <qplugin.h>
-#include <qsemaphore.h>
-#include <qmutex.h>
-#include <qdebug.h>
-#include <qglobal.h>
-#include <qobjectdefs.h>
-#include <stdlib.h>
-
-#include "androidjnimain.h"
-#include "androidjniaccessibility.h"
-#include "androidjniinput.h"
-#include "androidjniclipboard.h"
-#include "androidjnimenu.h"
-#include "qandroidplatformdialoghelpers.h"
-#include "qandroidplatformintegration.h"
-#include <QtWidgets/QApplication>
-
-#include <qabstracteventdispatcher.h>
-
-#include <android/bitmap.h>
-#include <android/asset_manager_jni.h>
-#include "qandroidassetsfileenginehandler.h"
-#include <android/api-level.h>
-
-#include <qpa/qwindowsysteminterface.h>
-
-#ifdef ANDROID_PLUGIN_OPENGL
-# include "qandroidopenglplatformwindow.h"
-#endif
-
-#include <android/native_window_jni.h>
-
-static jmethodID m_redrawSurfaceMethodID = 0;
-
-Q_IMPORT_PLUGIN(QAndroidPlatformIntegrationPlugin)
-
-static JavaVM *m_javaVM = NULL;
-static jclass m_applicationClass = NULL;
-static jobject m_classLoaderObject = NULL;
-static jmethodID m_loadClassMethodID = NULL;
-static AAssetManager *m_assetManager = NULL;
-static jobject m_resourcesObj;
-static jobject m_activityObject = NULL;
-
-static bool m_activityActive = true; // defaults to true because when the platform plugin is
- // initialized, QtActivity::onResume() has already been called
-
-static jclass m_bitmapClass = 0;
-static jmethodID m_createBitmapMethodID = 0;
-static jobject m_ARGB_8888_BitmapConfigValue = 0;
-static jobject m_RGB_565_BitmapConfigValue = 0;
-
-jmethodID m_setFullScreenMethodID = 0;
-static bool m_statusBarShowing = true;
-
-static jclass m_bitmapDrawableClass = 0;
-static jmethodID m_bitmapDrawableConstructorMethodID = 0;
-
-extern "C" typedef int (*Main)(int, char **); //use the standard main method to start the application
-static Main m_main = NULL;
-static void *m_mainLibraryHnd = NULL;
-static QList<QByteArray> m_applicationParams;
-
-#ifndef ANDROID_PLUGIN_OPENGL
-static jobject m_surface = NULL;
-#else
-static EGLNativeWindowType m_nativeWindow = 0;
-static QSemaphore m_waitForWindowSemaphore;
-static bool m_waitForWindow = false;
-#endif
-
-
-static QSemaphore m_quitAppSemaphore;
-static QMutex m_surfaceMutex(QMutex::Recursive);
-static QSemaphore m_pauseApplicationSemaphore;
-static QMutex m_pauseApplicationMutex;
-
-static QAndroidPlatformIntegration *m_androidPlatformIntegration = 0;
-
-static int m_desktopWidthPixels = 0;
-static int m_desktopHeightPixels = 0;
-static double m_scaledDensity = 0;
-
-static volatile bool m_pauseApplication;
-
-static AndroidAssetsFileEngineHandler *m_androidAssetsFileEngineHandler = 0;
-
-
-
-static const char m_qtTag[] = "Qt";
-static const char m_classErrorMsg[] = "Can't find class \"%s\"";
-static const char m_methodErrorMsg[] = "Can't find method \"%s%s\"";
-
-static inline void checkPauseApplication()
-{
- m_pauseApplicationMutex.lock();
- if (m_pauseApplication) {
- m_pauseApplicationMutex.unlock();
- m_pauseApplicationSemaphore.acquire(); // wait until surface is created
-
- m_pauseApplicationMutex.lock();
- m_pauseApplication = false;
- m_pauseApplicationMutex.unlock();
-
- //FIXME
-// QWindowSystemInterface::handleScreenAvailableGeometryChange(0);
-// QWindowSystemInterface::handleScreenGeometryChange(0);
- } else {
- m_pauseApplicationMutex.unlock();
- }
-}
-
-namespace QtAndroid
-{
-#ifndef ANDROID_PLUGIN_OPENGL
- void flushImage(const QPoint &pos, const QImage &image, const QRect &destinationRect)
- {
- checkPauseApplication();
- QMutexLocker locker(&m_surfaceMutex);
- if (!m_surface)
- return;
- AttachedJNIEnv env;
- if (!env.jniEnv)
- return;
-
- int bpp = 2;
- AndroidBitmapInfo info;
- int ret;
-
- if ((ret = AndroidBitmap_getInfo(env.jniEnv, m_surface, &info)) < 0) {
- qWarning() << "AndroidBitmap_getInfo() failed ! error=" << ret;
- m_javaVM->DetachCurrentThread();
- return;
- }
-
- if (info.format != ANDROID_BITMAP_FORMAT_RGB_565) {
- qWarning() << "Bitmap format is not RGB_565!";
- m_javaVM->DetachCurrentThread();
- return;
- }
-
- void *pixels;
- unsigned char *screenBits;
- if ((ret = AndroidBitmap_lockPixels(env.jniEnv, m_surface, &pixels)) < 0) {
- qWarning() << "AndroidBitmap_lockPixels() failed! error=" << ret;
- m_javaVM->DetachCurrentThread();
- return;
- }
-
- screenBits = static_cast<unsigned char *>(pixels);
- int sbpl = info.stride;
- int swidth = info.width;
- int sheight = info.height;
-
- unsigned sposx = pos.x() + destinationRect.x();
- unsigned sposy = pos.y() + destinationRect.y();
-
- screenBits += sposy * sbpl;
-
- unsigned ibpl = image.bytesPerLine();
- unsigned iposx = destinationRect.x();
- unsigned iposy = destinationRect.y();
-
- const unsigned char *imageBits = static_cast<const unsigned char *>(image.bits());
- imageBits += iposy * ibpl;
-
- unsigned width = swidth - sposx < unsigned(destinationRect.width())
- ? (swidth-sposx)
- : destinationRect.width();
- unsigned height = sheight - sposy < unsigned(destinationRect.height())
- ? (sheight - sposy)
- : destinationRect.height();
-
- for (unsigned y = 0; y < height; y++) {
- memcpy(screenBits + y*sbpl + sposx*bpp,
- imageBits + y*ibpl + iposx*bpp,
- width*bpp);
- }
- AndroidBitmap_unlockPixels(env.jniEnv, m_surface);
-
- env.jniEnv->CallStaticVoidMethod(m_applicationClass,
- m_redrawSurfaceMethodID,
- jint(destinationRect.left()),
- jint(destinationRect.top()),
- jint(destinationRect.right() + 1),
- jint(destinationRect.bottom() + 1));
-#warning FIXME dirty hack, figure out why it needs to add 1 to right and bottom !!!!
- }
-
-#else // for #ifndef ANDROID_PLUGIN_OPENGL
- EGLNativeWindowType nativeWindow(bool waitForWindow)
- {
- m_surfaceMutex.lock();
- if (!m_nativeWindow && waitForWindow) {
- m_waitForWindow = true;
- m_surfaceMutex.unlock();
- m_waitForWindowSemaphore.acquire();
- m_waitForWindow = false;
- return m_nativeWindow;
- }
- m_surfaceMutex.unlock();
- return m_nativeWindow;
- }
-#endif
-
- void setAndroidPlatformIntegration(QAndroidPlatformIntegration *androidPlatformIntegration)
- {
- m_surfaceMutex.lock();
- m_androidPlatformIntegration = androidPlatformIntegration;
- m_surfaceMutex.unlock();
- }
-
- QAndroidPlatformIntegration *androidPlatformIntegration()
- {
- QMutexLocker locker(&m_surfaceMutex);
- return m_androidPlatformIntegration;
- }
-
- QWindow *topLevelWindowAt(const QPoint &globalPos)
- {
- return m_androidPlatformIntegration
- ? m_androidPlatformIntegration->screen()->topLevelAt(globalPos)
- : 0;
- }
-
- int desktopWidthPixels()
- {
- return m_desktopWidthPixels;
- }
-
- int desktopHeightPixels()
- {
- return m_desktopHeightPixels;
- }
-
- double scaledDensity()
- {
- return m_scaledDensity;
- }
-
- JavaVM *javaVM()
- {
- return m_javaVM;
- }
-
- jclass findClass(const QString &className, JNIEnv *env)
- {
- return static_cast<jclass>(env->CallObjectMethod(m_classLoaderObject,
- m_loadClassMethodID,
- env->NewString(reinterpret_cast<const jchar *>(className.constData()),
- jsize(className.length()))));
- }
-
- AAssetManager *assetManager()
- {
- return m_assetManager;
- }
-
- jclass applicationClass()
- {
- return m_applicationClass;
- }
-
- jobject activity()
- {
- return m_activityObject;
- }
-
- void showStatusBar()
- {
- if (m_statusBarShowing)
- return;
-
- QtAndroid::AttachedJNIEnv env;
- if (env.jniEnv == 0) {
- qWarning("Failed to get JNI Environment.");
- return;
- }
-
- env.jniEnv->CallStaticVoidMethod(m_applicationClass, m_setFullScreenMethodID, false);
- m_statusBarShowing = true;
- }
-
- void hideStatusBar()
- {
- if (!m_statusBarShowing)
- return;
-
- QtAndroid::AttachedJNIEnv env;
- if (env.jniEnv == 0) {
- qWarning("Failed to get JNI Environment.");
- return;
- }
-
- env.jniEnv->CallStaticVoidMethod(m_applicationClass, m_setFullScreenMethodID, true);
- m_statusBarShowing = false;
- }
-
- void setApplicationActive()
- {
- if (m_activityActive)
- QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationActive);
- }
-
- jobject createBitmap(QImage img, JNIEnv *env)
- {
- if (img.format() != QImage::Format_ARGB32 && img.format() != QImage::Format_RGB16)
- img = img.convertToFormat(QImage::Format_ARGB32);
-
- jobject bitmap = env->CallStaticObjectMethod(m_bitmapClass,
- m_createBitmapMethodID,
- img.width(),
- img.height(),
- img.format() == QImage::Format_ARGB32
- ? m_ARGB_8888_BitmapConfigValue
- : m_RGB_565_BitmapConfigValue);
- if (!bitmap)
- return 0;
-
- AndroidBitmapInfo info;
- if (AndroidBitmap_getInfo(env, bitmap, &info) < 0) {
- env->DeleteLocalRef(bitmap);
- return 0;
- }
-
- void *pixels;
- if (AndroidBitmap_lockPixels(env, bitmap, &pixels) < 0) {
- env->DeleteLocalRef(bitmap);
- return 0;
- }
-
- if (info.stride == uint(img.bytesPerLine())
- && info.width == uint(img.width())
- && info.height == uint(img.height())) {
- memcpy(pixels, img.constBits(), info.stride * info.height);
- } else {
- uchar *bmpPtr = static_cast<uchar *>(pixels);
- const unsigned width = qMin(info.width, (uint)img.width()); //should be the same
- const unsigned height = qMin(info.height, (uint)img.height()); //should be the same
- for (unsigned y = 0; y < height; y++, bmpPtr += info.stride)
- memcpy(bmpPtr, img.constScanLine(y), width);
- }
- AndroidBitmap_unlockPixels(env, bitmap);
- return bitmap;
- }
-
- jobject createBitmapDrawable(jobject bitmap, JNIEnv *env)
- {
- if (!bitmap)
- return 0;
-
- return env->NewObject(m_bitmapDrawableClass,
- m_bitmapDrawableConstructorMethodID,
- m_resourcesObj,
- bitmap);
- }
-
- const char *classErrorMsgFmt()
- {
- return m_classErrorMsg;
- }
-
- const char *methodErrorMsgFmt()
- {
- return m_methodErrorMsg;
- }
-
- const char *qtTagText()
- {
- return m_qtTag;
- }
-}
-
-static jboolean startQtAndroidPlugin(JNIEnv* /*env*/, jobject /*object*//*, jobject applicationAssetManager*/)
-{
-#ifndef ANDROID_PLUGIN_OPENGL
- m_surface = 0;
-#else
- m_nativeWindow = 0;
- m_waitForWindow = false;
-#endif
-
- m_androidPlatformIntegration = 0;
- m_androidAssetsFileEngineHandler = new AndroidAssetsFileEngineHandler();
-
-#ifdef ANDROID_PLUGIN_OPENGL
- return true;
-#else
- return false;
-#endif
-}
-
-static void *startMainMethod(void */*data*/)
-{
- QVarLengthArray<const char *> params(m_applicationParams.size());
- for (int i = 0; i < m_applicationParams.size(); i++)
- params[i] = static_cast<const char *>(m_applicationParams[i].constData());
-
- int ret = m_main(m_applicationParams.length(), const_cast<char **>(params.data()));
- Q_UNUSED(ret);
-
- if (m_mainLibraryHnd) {
- int res = dlclose(m_mainLibraryHnd);
- if (res < 0)
- qWarning() << "dlclose failed:" << dlerror();
- }
-
- QtAndroid::AttachedJNIEnv env;
- if (!env.jniEnv)
- return 0;
-
- if (m_applicationClass) {
- jmethodID quitApp = env.jniEnv->GetStaticMethodID(m_applicationClass, "quitApp", "()V");
- env.jniEnv->CallStaticVoidMethod(m_applicationClass, quitApp);
- }
-
- return 0;
-}
-
-static jboolean startQtApplication(JNIEnv *env, jobject /*object*/, jstring paramsString, jstring environmentString)
-{
- m_mainLibraryHnd = NULL;
- const char *nativeString = env->GetStringUTFChars(environmentString, 0);
- QByteArray string = nativeString;
- env->ReleaseStringUTFChars(environmentString, nativeString);
- m_applicationParams=string.split('\t');
- foreach (string, m_applicationParams) {
- if (!string.isEmpty() && putenv(string.constData()))
- qWarning() << "Can't set environment" << string;
- }
-
- nativeString = env->GetStringUTFChars(paramsString, 0);
- string = nativeString;
- env->ReleaseStringUTFChars(paramsString, nativeString);
-
- m_applicationParams=string.split('\t');
-
- // Go home
- QDir::setCurrent(QDir::homePath());
-
- //look for main()
- if (m_applicationParams.length()) {
- // Obtain a handle to the main library (the library that contains the main() function).
- // This library should already be loaded, and calling dlopen() will just return a reference to it.
- m_mainLibraryHnd = dlopen(m_applicationParams.first().data(), 0);
- if (m_mainLibraryHnd == NULL) {
- qCritical() << "dlopen failed:" << dlerror();
- return false;
- }
- m_main = (Main)dlsym(m_mainLibraryHnd, "main");
- } else {
- qWarning() << "No main library was specified; searching entire process (this is slow!)";
- m_main = (Main)dlsym(RTLD_DEFAULT, "main");
- }
-
- if (!m_main) {
- qCritical() << "dlsym failed:" << dlerror();
- qCritical() << "Could not find main method";
- return false;
- }
-
- pthread_t appThread;
- return pthread_create(&appThread, NULL, startMainMethod, NULL) == 0;
-}
-
-static void pauseQtApp(JNIEnv */*env*/, jobject /*thiz*/)
-{
- m_surfaceMutex.lock();
- m_pauseApplicationMutex.lock();
-
- if (m_androidPlatformIntegration)
- m_androidPlatformIntegration->pauseApp();
- m_pauseApplication = true;
-
- m_pauseApplicationMutex.unlock();
- m_surfaceMutex.unlock();
-}
-
-static void resumeQtApp(JNIEnv */*env*/, jobject /*thiz*/)
-{
- m_surfaceMutex.lock();
- m_pauseApplicationMutex.lock();
- if (m_androidPlatformIntegration)
- m_androidPlatformIntegration->resumeApp();
-
- if (m_pauseApplication)
- m_pauseApplicationSemaphore.release();
-
- m_pauseApplicationMutex.unlock();
- m_surfaceMutex.unlock();
-}
-
-static void quitQtAndroidPlugin(JNIEnv *env, jclass /*clazz*/)
-{
-#ifndef ANDROID_PLUGIN_OPENGL
- if (m_surface) {
- env->DeleteGlobalRef(m_surface);
- m_surface = 0;
- }
-#else
- Q_UNUSED(env);
-#endif
-
- m_androidPlatformIntegration = 0;
- delete m_androidAssetsFileEngineHandler;
-}
-
-static void terminateQt(JNIEnv *env, jclass /*clazz*/)
-{
-#ifndef ANDROID_PLUGIN_OPENGL
- if (m_surface)
- env->DeleteGlobalRef(m_surface);
-#endif
- env->DeleteGlobalRef(m_applicationClass);
- env->DeleteGlobalRef(m_classLoaderObject);
- env->DeleteGlobalRef(m_resourcesObj);
- env->DeleteGlobalRef(m_activityObject);
- env->DeleteGlobalRef(m_bitmapClass);
- env->DeleteGlobalRef(m_ARGB_8888_BitmapConfigValue);
- env->DeleteGlobalRef(m_RGB_565_BitmapConfigValue);
- env->DeleteGlobalRef(m_bitmapDrawableClass);
-}
-
-static void setSurface(JNIEnv *env, jobject /*thiz*/, jobject jSurface)
-{
-#ifndef ANDROID_PLUGIN_OPENGL
- if (m_surface)
- env->DeleteGlobalRef(m_surface);
- m_surface = env->NewGlobalRef(jSurface);
-#else
- m_surfaceMutex.lock();
- EGLNativeWindowType nativeWindow = ANativeWindow_fromSurface(env, jSurface);
- bool sameNativeWindow = (nativeWindow != 0 && nativeWindow == m_nativeWindow);
-
- m_nativeWindow = nativeWindow;
- if (m_waitForWindow)
- m_waitForWindowSemaphore.release();
-
- if (m_androidPlatformIntegration) {
- // Use the desktop size.
- // On some devices, the getters for the native window size gives wrong values
- QSize size = QAndroidPlatformIntegration::defaultDesktopSize();
-
- QPlatformScreen *screen = m_androidPlatformIntegration->screen();
- QRect geometry(QPoint(0, 0), size);
- if (screen) {
- QWindowSystemInterface::handleScreenAvailableGeometryChange(screen->screen(), geometry);
- QWindowSystemInterface::handleScreenGeometryChange(screen->screen(), geometry);
- }
-
- if (!sameNativeWindow) {
- m_surfaceMutex.unlock();
- m_androidPlatformIntegration->surfaceChanged();
- } else {
- // Resize all top level windows, since they share the same surface
- foreach (QWindow *w, QGuiApplication::topLevelWindows()) {
- QAndroidOpenGLPlatformWindow *window =
- static_cast<QAndroidOpenGLPlatformWindow *>(w->handle());
-
- if (window != 0) {
- window->lock();
- window->scheduleResize(size);
-
- QWindowSystemInterface::handleExposeEvent(window->window(),
- QRegion(window->window()->geometry()));
- window->unlock();
- }
- }
-
- m_surfaceMutex.unlock();
- }
-
- } else {
- m_surfaceMutex.unlock();
- }
-#endif // for #ifndef ANDROID_PLUGIN_OPENGL
-}
-
-static void destroySurface(JNIEnv *env, jobject /*thiz*/)
-{
-#ifndef ANDROID_PLUGIN_OPENGL
- if (m_surface) {
- env->DeleteGlobalRef(m_surface);
- m_surface = 0;
- }
-#else
- Q_UNUSED(env);
- m_nativeWindow = 0;
- if (m_androidPlatformIntegration != 0)
- m_androidPlatformIntegration->invalidateNativeSurface();
-#endif
-}
-
-static void setDisplayMetrics(JNIEnv */*env*/, jclass /*clazz*/,
- jint /*widthPixels*/, jint /*heightPixels*/,
- jint desktopWidthPixels, jint desktopHeightPixels,
- jdouble xdpi, jdouble ydpi, jdouble scaledDensity)
-{
- m_desktopWidthPixels = desktopWidthPixels;
- m_desktopHeightPixels = desktopHeightPixels;
- m_scaledDensity = scaledDensity;
-
- if (!m_androidPlatformIntegration) {
- QAndroidPlatformIntegration::setDefaultDisplayMetrics(desktopWidthPixels,desktopHeightPixels,
- qRound(double(desktopWidthPixels) / xdpi * 25.4),
- qRound(double(desktopHeightPixels) / ydpi * 25.4));
- } else {
- m_androidPlatformIntegration->setDisplayMetrics(qRound(double(desktopWidthPixels) / xdpi * 25.4),
- qRound(double(desktopHeightPixels) / ydpi * 25.4));
- m_androidPlatformIntegration->setDesktopSize(desktopWidthPixels, desktopHeightPixels);
- }
-}
-
-static void lockSurface(JNIEnv */*env*/, jobject /*thiz*/)
-{
- m_surfaceMutex.lock();
-}
-
-static void unlockSurface(JNIEnv */*env*/, jobject /*thiz*/)
-{
- m_surfaceMutex.unlock();
-}
-
-static void updateWindow(JNIEnv */*env*/, jobject /*thiz*/)
-{
- if (!m_androidPlatformIntegration)
- return;
-
- if (QGuiApplication::instance() != 0) {
- foreach (QWindow *w, QGuiApplication::topLevelWindows())
- QWindowSystemInterface::handleExposeEvent(w, QRegion(w->geometry()));
- }
-
-#ifndef ANDROID_PLUGIN_OPENGL
- QAndroidPlatformScreen *screen = static_cast<QAndroidPlatformScreen *>(m_androidPlatformIntegration->screen());
- QMetaObject::invokeMethod(screen, "setDirty", Qt::QueuedConnection, Q_ARG(QRect,screen->geometry()));
-#else
- qWarning("updateWindow: Dirty screen not implemented yet on OpenGL");
-#endif
-}
-
-static void updateApplicationState(JNIEnv */*env*/, jobject /*thiz*/, jint state)
-{
- m_activityActive = (state == Qt::ApplicationActive);
-
- if (!m_androidPlatformIntegration || !QGuiApplicationPrivate::platformIntegration())
- return;
-
- QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState(state));
-}
-
-static void handleOrientationChanged(JNIEnv */*env*/, jobject /*thiz*/, jint newRotation, jint nativeOrientation)
-{
- // Array of orientations rotated in 90 degree increments, counterclockwise
- // (same direction as Android measures angles)
- static const Qt::ScreenOrientation orientations[] = {
- Qt::PortraitOrientation,
- Qt::LandscapeOrientation,
- Qt::InvertedPortraitOrientation,
- Qt::InvertedLandscapeOrientation
- };
-
- // The Android API defines the following constants:
- // ROTATION_0 : 0
- // ROTATION_90 : 1
- // ROTATION_180 : 2
- // ROTATION_270 : 3
- // ORIENTATION_PORTRAIT : 1
- // ORIENTATION_LANDSCAPE : 2
-
- // and newRotation is how much the current orientation is rotated relative to nativeOrientation
-
- // which means that we can be really clever here :)
- Qt::ScreenOrientation screenOrientation = orientations[(nativeOrientation - 1 + newRotation) % 4];
- Qt::ScreenOrientation native = orientations[nativeOrientation - 1];
-
- QAndroidPlatformIntegration::setScreenOrientation(screenOrientation, native);
- if (m_androidPlatformIntegration) {
- QPlatformScreen *screen = m_androidPlatformIntegration->screen();
- QWindowSystemInterface::handleScreenOrientationChange(screen->screen(),
- screenOrientation);
- }
-}
-
-static JNINativeMethod methods[] = {
- {"startQtAndroidPlugin", "()Z", (void *)startQtAndroidPlugin},
- {"startQtApplication", "(Ljava/lang/String;Ljava/lang/String;)V", (void *)startQtApplication},
- {"pauseQtApp", "()V", (void *)pauseQtApp},
- {"resumeQtApp", "()V", (void *)resumeQtApp},
- {"quitQtAndroidPlugin", "()V", (void *)quitQtAndroidPlugin},
- {"terminateQt", "()V", (void *)terminateQt},
- {"setDisplayMetrics", "(IIIIDDD)V", (void *)setDisplayMetrics},
- {"setSurface", "(Ljava/lang/Object;)V", (void *)setSurface},
- {"destroySurface", "()V", (void *)destroySurface},
- {"lockSurface", "()V", (void *)lockSurface},
- {"unlockSurface", "()V", (void *)unlockSurface},
- {"updateWindow", "()V", (void *)updateWindow},
- {"updateApplicationState", "(I)V", (void *)updateApplicationState},
- {"handleOrientationChanged", "(II)V", (void *)handleOrientationChanged}
-};
-
-#define FIND_AND_CHECK_CLASS(CLASS_NAME) \
-clazz = env->FindClass(CLASS_NAME); \
-if (!clazz) { \
- __android_log_print(ANDROID_LOG_FATAL, m_qtTag, m_classErrorMsg, CLASS_NAME); \
- return JNI_FALSE; \
-}
-
-#define GET_AND_CHECK_METHOD(VAR, CLASS, METHOD_NAME, METHOD_SIGNATURE) \
-VAR = env->GetMethodID(CLASS, METHOD_NAME, METHOD_SIGNATURE); \
-if (!VAR) { \
- __android_log_print(ANDROID_LOG_FATAL, m_qtTag, m_methodErrorMsg, METHOD_NAME, METHOD_SIGNATURE); \
- return JNI_FALSE; \
-}
-
-#define GET_AND_CHECK_STATIC_METHOD(VAR, CLASS, METHOD_NAME, METHOD_SIGNATURE) \
-VAR = env->GetStaticMethodID(CLASS, METHOD_NAME, METHOD_SIGNATURE); \
-if (!VAR) { \
- __android_log_print(ANDROID_LOG_FATAL, m_qtTag, m_methodErrorMsg, METHOD_NAME, METHOD_SIGNATURE); \
- return JNI_FALSE; \
-}
-
-#define GET_AND_CHECK_FIELD(VAR, CLASS, FIELD_NAME, FIELD_SIGNATURE) \
-VAR = env->GetFieldID(CLASS, FIELD_NAME, FIELD_SIGNATURE); \
-if (!VAR) { \
- __android_log_print(ANDROID_LOG_FATAL, m_qtTag, m_methodErrorMsg, FIELD_NAME, FIELD_SIGNATURE); \
- return JNI_FALSE; \
-}
-
-#define GET_AND_CHECK_STATIC_FIELD(VAR, CLASS, FIELD_NAME, FIELD_SIGNATURE) \
-VAR = env->GetStaticFieldID(CLASS, FIELD_NAME, FIELD_SIGNATURE); \
-if (!VAR) { \
- __android_log_print(ANDROID_LOG_FATAL, m_qtTag, m_methodErrorMsg, FIELD_NAME, FIELD_SIGNATURE); \
- return JNI_FALSE; \
-}
-
-static int registerNatives(JNIEnv *env)
-{
- jclass clazz;
- FIND_AND_CHECK_CLASS("org/qtproject/qt5/android/QtNative");
- m_applicationClass = static_cast<jclass>(env->NewGlobalRef(clazz));
- GET_AND_CHECK_STATIC_METHOD(m_setFullScreenMethodID, m_applicationClass, "setFullScreen", "(Z)V");
-
- if (env->RegisterNatives(m_applicationClass, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
- __android_log_print(ANDROID_LOG_FATAL,"Qt", "RegisterNatives failed");
- return JNI_FALSE;
- }
-
- GET_AND_CHECK_STATIC_METHOD(m_redrawSurfaceMethodID, m_applicationClass, "redrawSurface", "(IIII)V");
-
- jmethodID methodID;
- GET_AND_CHECK_STATIC_METHOD(methodID, m_applicationClass, "activity", "()Landroid/app/Activity;");
- jobject activityObject = env->CallStaticObjectMethod(m_applicationClass, methodID);
- m_activityObject = env->NewGlobalRef(activityObject);
- GET_AND_CHECK_STATIC_METHOD(methodID, m_applicationClass, "classLoader", "()Ljava/lang/ClassLoader;");
- m_classLoaderObject = env->NewGlobalRef(env->CallStaticObjectMethod(m_applicationClass, methodID));
-
- clazz = env->GetObjectClass(m_classLoaderObject);
- GET_AND_CHECK_METHOD(m_loadClassMethodID, clazz, "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;");
-
- FIND_AND_CHECK_CLASS("android/content/ContextWrapper");
- GET_AND_CHECK_METHOD(methodID, clazz, "getAssets", "()Landroid/content/res/AssetManager;");
- m_assetManager = AAssetManager_fromJava(env, env->CallObjectMethod(activityObject, methodID));
-
- GET_AND_CHECK_METHOD(methodID, clazz, "getResources", "()Landroid/content/res/Resources;");
- m_resourcesObj = env->NewGlobalRef(env->CallObjectMethod(activityObject, methodID));
-
- FIND_AND_CHECK_CLASS("android/graphics/Bitmap");
- m_bitmapClass = static_cast<jclass>(env->NewGlobalRef(clazz));
- GET_AND_CHECK_STATIC_METHOD(m_createBitmapMethodID, m_bitmapClass
- , "createBitmap", "(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;");
-
- FIND_AND_CHECK_CLASS("android/graphics/Bitmap$Config");
- jfieldID fieldId;
- GET_AND_CHECK_STATIC_FIELD(fieldId, clazz, "ARGB_8888", "Landroid/graphics/Bitmap$Config;");
- m_ARGB_8888_BitmapConfigValue = env->NewGlobalRef(env->GetStaticObjectField(clazz, fieldId));
- GET_AND_CHECK_STATIC_FIELD(fieldId, clazz, "RGB_565", "Landroid/graphics/Bitmap$Config;");
- m_RGB_565_BitmapConfigValue = env->NewGlobalRef(env->GetStaticObjectField(clazz, fieldId));
-
- FIND_AND_CHECK_CLASS("android/graphics/drawable/BitmapDrawable");
- m_bitmapDrawableClass = static_cast<jclass>(env->NewGlobalRef(clazz));
- GET_AND_CHECK_METHOD(m_bitmapDrawableConstructorMethodID,
- m_bitmapDrawableClass,
- "<init>",
- "(Landroid/content/res/Resources;Landroid/graphics/Bitmap;)V");
-
- return JNI_TRUE;
-}
-
-jint androidApiLevel(JNIEnv *env)
-{
- jclass clazz;
- FIND_AND_CHECK_CLASS("android/os/Build$VERSION");
- jfieldID fieldId;
- GET_AND_CHECK_STATIC_FIELD(fieldId, clazz, "SDK_INT", "I");
- return env->GetStaticIntField(clazz, fieldId);
-}
-
-Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/)
-{
- typedef union {
- JNIEnv *nativeEnvironment;
- void *venv;
- } UnionJNIEnvToVoid;
-
- __android_log_print(ANDROID_LOG_INFO, "Qt", "qt start");
- UnionJNIEnvToVoid uenv;
- uenv.venv = NULL;
- m_javaVM = 0;
-
- if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) {
- __android_log_print(ANDROID_LOG_FATAL, "Qt", "GetEnv failed");
- return -1;
- }
-
- JNIEnv *env = uenv.nativeEnvironment;
- if (!registerNatives(env)
- || !QtAndroidInput::registerNatives(env)
- || !QtAndroidClipboard::registerNatives(env)
- || !QtAndroidMenu::registerNatives(env)
- || !QtAndroidAccessibility::registerNatives(env)
- || !QtAndroidDialogHelpers::registerNatives(env)) {
- __android_log_print(ANDROID_LOG_FATAL, "Qt", "registerNatives failed");
- return -1;
- }
-
- jint apiLevel = androidApiLevel(env);
- if (apiLevel >= 16 && !QtAndroidAccessibility::registerNatives(env)) {
- __android_log_print(ANDROID_LOG_FATAL, "Qt A11y", "registerNatives failed");
- return -1;
- }
-
- m_javaVM = vm;
- return JNI_VERSION_1_4;
-}
diff --git a/src/plugins/platforms/android/src/androidjnimain.h b/src/plugins/platforms/android/src/androidjnimain.h
deleted file mode 100644
index 11d3573404..0000000000
--- a/src/plugins/platforms/android/src/androidjnimain.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROID_APP_H
-#define ANDROID_APP_H
-
-#include <android/log.h>
-
-#ifdef ANDROID_PLUGIN_OPENGL
-# include <EGL/eglplatform.h>
-#endif
-
-#include <QtCore/qsize.h>
-
-#include <jni.h>
-#include <android/asset_manager.h>
-
-class QImage;
-class QRect;
-class QPoint;
-class QThread;
-class QAndroidPlatformIntegration;
-class QWidget;
-class QString;
-class QWindow;
-
-namespace QtAndroid
-{
- QAndroidPlatformIntegration *androidPlatformIntegration();
- void setAndroidPlatformIntegration(QAndroidPlatformIntegration *androidPlatformIntegration);
- void setQtThread(QThread *thread);
-
-#ifndef ANDROID_PLUGIN_OPENGL
- void flushImage(const QPoint &pos, const QImage &image, const QRect &rect);
-#else
- EGLNativeWindowType nativeWindow(bool waitToCreate = true);
-#endif
-
- QWindow *topLevelWindowAt(const QPoint &globalPos);
- int desktopWidthPixels();
- int desktopHeightPixels();
- double scaledDensity();
- JavaVM *javaVM();
- jclass findClass(const QString &className, JNIEnv *env);
- AAssetManager *assetManager();
- jclass applicationClass();
- jobject activity();
-
- void setApplicationActive();
-
- void showStatusBar();
- void hideStatusBar();
-
- jobject createBitmap(QImage img, JNIEnv *env = 0);
- jobject createBitmapDrawable(jobject bitmap, JNIEnv *env = 0);
-
- struct AttachedJNIEnv
- {
- AttachedJNIEnv()
- {
- attached = false;
- if (QtAndroid::javaVM()->GetEnv((void**)&jniEnv, JNI_VERSION_1_6) < 0) {
- if (QtAndroid::javaVM()->AttachCurrentThread(&jniEnv, NULL) < 0) {
- __android_log_print(ANDROID_LOG_ERROR, "Qt", "AttachCurrentThread failed");
- jniEnv = 0;
- return;
- }
- attached = true;
- }
- }
-
- ~AttachedJNIEnv()
- {
- if (attached)
- QtAndroid::javaVM()->DetachCurrentThread();
- }
- bool attached;
- JNIEnv *jniEnv;
- };
- const char *classErrorMsgFmt();
- const char *methodErrorMsgFmt();
- const char *qtTagText();
-
-}
-#endif // ANDROID_APP_H
diff --git a/src/plugins/platforms/android/src/androidjnimenu.cpp b/src/plugins/platforms/android/src/androidjnimenu.cpp
deleted file mode 100644
index dbdd7c9b8e..0000000000
--- a/src/plugins/platforms/android/src/androidjnimenu.cpp
+++ /dev/null
@@ -1,426 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "androidjnimenu.h"
-#include "androidjnimain.h"
-#include "qandroidplatformmenubar.h"
-#include "qandroidplatformmenu.h"
-#include "qandroidplatformmenuitem.h"
-
-#include <QMutex>
-#include <QSet>
-#include <QQueue>
-#include <QWindow>
-
-using namespace QtAndroid;
-
-namespace QtAndroidMenu
-{
- static QQueue<QAndroidPlatformMenu *> pendingContextMenus;
- static QAndroidPlatformMenu *visibleMenu = 0;
- static QMutex visibleMenuMutex(QMutex::Recursive);
-
- static QSet<QAndroidPlatformMenuBar *> menuBars;
- static QAndroidPlatformMenuBar *visibleMenuBar = 0;
- static QWindow *activeTopLevelWindow = 0;
- static QMutex menuBarMutex(QMutex::Recursive);
-
- static jmethodID openContextMenuMethodID = 0;
- static jmethodID closeContextMenuMethodID = 0;
- static jmethodID resetOptionsMenuMethodID = 0;
-
- static jmethodID clearMenuMethodID = 0;
- static jmethodID addMenuItemMethodID = 0;
- static int menuNoneValue = 0;
- static jmethodID setHeaderTitleContextMenuMethodID = 0;
-
- static jmethodID setCheckableMenuItemMethodID = 0;
- static jmethodID setCheckedMenuItemMethodID = 0;
- static jmethodID setEnabledMenuItemMethodID = 0;
- static jmethodID setIconMenuItemMethodID = 0;
- static jmethodID setVisibleMenuItemMethodID = 0;
-
- void resetMenuBar()
- {
- AttachedJNIEnv env;
- if (env.jniEnv)
- env.jniEnv->CallStaticVoidMethod(applicationClass(), resetOptionsMenuMethodID);
- }
-
- void showContextMenu(QAndroidPlatformMenu *menu, JNIEnv *env)
- {
- QMutexLocker lock(&visibleMenuMutex);
- if (visibleMenu) {
- pendingContextMenus.enqueue(menu);
- } else {
- visibleMenu = menu;
- menu->aboutToShow();
- if (env) {
- env->CallStaticVoidMethod(applicationClass(), openContextMenuMethodID);
- } else {
- AttachedJNIEnv aenv;
- if (aenv.jniEnv)
- aenv.jniEnv->CallStaticVoidMethod(applicationClass(), openContextMenuMethodID);
- }
- }
- }
-
- void hideContextMenu(QAndroidPlatformMenu *menu)
- {
- QMutexLocker lock(&visibleMenuMutex);
- if (visibleMenu == menu) {
- AttachedJNIEnv env;
- if (env.jniEnv)
- env.jniEnv->CallStaticVoidMethod(applicationClass(), openContextMenuMethodID);
- } else {
- pendingContextMenus.removeOne(menu);
- }
- }
-
- void syncMenu(QAndroidPlatformMenu */*menu*/)
- {
-// QMutexLocker lock(&visibleMenuMutex);
-// if (visibleMenu == menu)
-// {
-// hideContextMenu(menu);
-// showContextMenu(menu);
-// }
- }
-
- void androidPlatformMenuDestroyed(QAndroidPlatformMenu *menu)
- {
- QMutexLocker lock(&visibleMenuMutex);
- if (visibleMenu == menu)
- visibleMenu = 0;
- }
-
- void setMenuBar(QAndroidPlatformMenuBar *menuBar, QWindow *window)
- {
- if (activeTopLevelWindow == window && visibleMenuBar != menuBar) {
- visibleMenuBar = menuBar;
- resetMenuBar();
- }
- }
-
- void setActiveTopLevelWindow(QWindow *window)
- {
- Qt::WindowFlags flags = window ? window->flags() : Qt::WindowFlags();
- bool isNonRegularWindow = flags & (Qt::Desktop | Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window;
- if (isNonRegularWindow)
- return;
-
- QMutexLocker lock(&menuBarMutex);
- if (activeTopLevelWindow == window)
- return;
-
- visibleMenuBar = 0;
- activeTopLevelWindow = window;
- foreach (QAndroidPlatformMenuBar *menuBar, menuBars) {
- if (menuBar->parentWindow() == window) {
- visibleMenuBar = menuBar;
- resetMenuBar();
- break;
- }
- }
-
- }
-
- void addMenuBar(QAndroidPlatformMenuBar *menuBar)
- {
- QMutexLocker lock(&menuBarMutex);
- menuBars.insert(menuBar);
- }
-
- void removeMenuBar(QAndroidPlatformMenuBar *menuBar)
- {
- QMutexLocker lock(&menuBarMutex);
- menuBars.remove(menuBar);
- if (visibleMenuBar == menuBar) {
- visibleMenuBar = 0;
- resetMenuBar();
- }
- }
-
- static QString removeAmpersandEscapes(QString s)
- {
- int i = 0;
- while (i < s.size()) {
- ++i;
- if (s.at(i-1) != QLatin1Char('&'))
- continue;
- if (i < s.size() && s.at(i) == QLatin1Char('&'))
- ++i;
- s.remove(i-1,1);
- }
- return s.trimmed();
- }
-
- static void fillMenuItem(JNIEnv *env, jobject menuItem, bool checkable, bool checked, bool enabled, bool visible, const QIcon &icon=QIcon())
- {
- env->CallObjectMethod(menuItem, setCheckableMenuItemMethodID, checkable);
- env->CallObjectMethod(menuItem, setCheckedMenuItemMethodID, checked);
- env->CallObjectMethod(menuItem, setEnabledMenuItemMethodID, enabled);
-
- if (!icon.isNull()) { // isNull() only checks the d pointer, not the actual image data.
- int sz = qMax(36, qgetenv("QT_ANDROID_APP_ICON_SIZE").toInt());
- QImage img = icon.pixmap(QSize(sz,sz),
- enabled
- ? QIcon::Normal
- : QIcon::Disabled,
- QIcon::On).toImage();
- if (!img.isNull()) { // Make sure we have a valid image.
- env->CallObjectMethod(menuItem,
- setIconMenuItemMethodID,
- createBitmapDrawable(createBitmap(img, env), env));
- }
- }
-
- env->CallObjectMethod(menuItem, setVisibleMenuItemMethodID, visible);
- }
-
- static int addAllMenuItemsToMenu(JNIEnv *env, jobject menu, QAndroidPlatformMenu *platformMenu) {
- int order = 0;
- QMutexLocker lock(platformMenu->menuItemsMutex());
- foreach (QAndroidPlatformMenuItem *item, platformMenu->menuItems()) {
- if (item->isSeparator())
- continue;
- QString itemText = removeAmpersandEscapes(item->text());
- jstring jtext = env->NewString(reinterpret_cast<const jchar *>(itemText.data()),
- itemText.length());
- jobject menuItem = env->CallObjectMethod(menu,
- addMenuItemMethodID,
- menuNoneValue,
- int(item->tag()),
- order++,
- jtext);
- env->DeleteLocalRef(jtext);
- fillMenuItem(env,
- menuItem,
- item->isCheckable(),
- item->isChecked(),
- item->isEnabled(),
- item->isVisible(),
- item->icon());
- }
-
- return order;
- }
-
- static jboolean onPrepareOptionsMenu(JNIEnv *env, jobject /*thiz*/, jobject menu)
- {
- env->CallVoidMethod(menu, clearMenuMethodID);
- QMutexLocker lock(&menuBarMutex);
- if (!visibleMenuBar)
- return JNI_FALSE;
-
- const QAndroidPlatformMenuBar::PlatformMenusType &menus = visibleMenuBar->menus();
- int order = 0;
- QMutexLocker lockMenuBarMutex(visibleMenuBar->menusListMutex());
- if (menus.size() == 1) { // Expand the menu
- order = addAllMenuItemsToMenu(env, menu, static_cast<QAndroidPlatformMenu *>(menus.front()));
- } else {
- foreach (QAndroidPlatformMenu *item, menus) {
- QString itemText = removeAmpersandEscapes(item->text());
- jstring jtext = env->NewString(reinterpret_cast<const jchar *>(itemText.data()),
- itemText.length());
- jobject menuItem = env->CallObjectMethod(menu,
- addMenuItemMethodID,
- menuNoneValue,
- int(item->tag()),
- order++,
- jtext);
- env->DeleteLocalRef(jtext);
-
- fillMenuItem(env,
- menuItem,
- false,
- false,
- item->isEnabled(),
- item->isVisible(),
- item->icon());
- }
- }
- return order ? JNI_TRUE : JNI_FALSE;
- }
-
- static jboolean onOptionsItemSelected(JNIEnv *env, jobject /*thiz*/, jint menuId, jboolean checked)
- {
- QMutexLocker lock(&menuBarMutex);
- if (!visibleMenuBar)
- return JNI_FALSE;
-
- const QAndroidPlatformMenuBar::PlatformMenusType &menus = visibleMenuBar->menus();
- if (menus.size() == 1) { // Expanded menu
- QAndroidPlatformMenuItem *item = static_cast<QAndroidPlatformMenuItem *>(menus.front()->menuItemForTag(menuId));
- if (item) {
- if (item->menu()) {
- showContextMenu(item->menu(), env);
- } else {
- if (item->isCheckable())
- item->setChecked(checked);
- item->activated();
- }
- }
- } else {
- QAndroidPlatformMenu *menu = static_cast<QAndroidPlatformMenu *>(visibleMenuBar->menuForTag(menuId));
- if (menu)
- showContextMenu(menu, env);
- }
-
- return JNI_TRUE;
- }
-
- static void onOptionsMenuClosed(JNIEnv */*env*/, jobject /*thiz*/, jobject /*menu*/)
- {
- }
-
- static void onCreateContextMenu(JNIEnv *env, jobject /*thiz*/, jobject menu)
- {
- env->CallVoidMethod(menu, clearMenuMethodID);
- QMutexLocker lock(&visibleMenuMutex);
- if (!visibleMenu)
- return;
-
- QString menuText = removeAmpersandEscapes(visibleMenu->text());
- jstring jtext = env->NewString(reinterpret_cast<const jchar*>(menuText.data()),
- menuText.length());
- env->CallObjectMethod(menu, setHeaderTitleContextMenuMethodID, jtext);
- env->DeleteLocalRef(jtext);
- addAllMenuItemsToMenu(env, menu, visibleMenu);
- }
-
- static jboolean onContextItemSelected(JNIEnv *env, jobject /*thiz*/, jint menuId, jboolean checked)
- {
- QMutexLocker lock(&visibleMenuMutex);
- QAndroidPlatformMenuItem * item = static_cast<QAndroidPlatformMenuItem *>(visibleMenu->menuItemForTag(menuId));
- if (item) {
- if (item->menu()) {
- showContextMenu(item->menu(), env);
- } else {
- if (item->isCheckable())
- item->setChecked(checked);
- item->activated();
- }
- }
- return JNI_TRUE;
- }
-
- static void onContextMenuClosed(JNIEnv *env, jobject /*thiz*/, jobject /*menu*/)
- {
- QMutexLocker lock(&visibleMenuMutex);
- if (!visibleMenu)
- return;
- visibleMenu->aboutToHide();
- visibleMenu = 0;
- if (!pendingContextMenus.empty())
- showContextMenu(pendingContextMenus.dequeue(), env);
- }
-
- static JNINativeMethod methods[] = {
- {"onPrepareOptionsMenu", "(Landroid/view/Menu;)Z", (void *)onPrepareOptionsMenu},
- {"onOptionsItemSelected", "(IZ)Z", (void *)onOptionsItemSelected},
- {"onOptionsMenuClosed", "(Landroid/view/Menu;)V", (void*)onOptionsMenuClosed},
- {"onCreateContextMenu", "(Landroid/view/ContextMenu;)V", (void *)onCreateContextMenu},
- {"onContextItemSelected", "(IZ)Z", (void *)onContextItemSelected},
- {"onContextMenuClosed", "(Landroid/view/Menu;)V", (void*)onContextMenuClosed},
- };
-
-#define FIND_AND_CHECK_CLASS(CLASS_NAME) \
- clazz = env->FindClass(CLASS_NAME); \
- if (!clazz) { \
- __android_log_print(ANDROID_LOG_FATAL, qtTagText(), classErrorMsgFmt(), CLASS_NAME); \
- return false; \
- }
-
-#define GET_AND_CHECK_METHOD(VAR, CLASS, METHOD_NAME, METHOD_SIGNATURE) \
- VAR = env->GetMethodID(CLASS, METHOD_NAME, METHOD_SIGNATURE); \
- if (!VAR) { \
- __android_log_print(ANDROID_LOG_FATAL, qtTagText(), methodErrorMsgFmt(), METHOD_NAME, METHOD_SIGNATURE); \
- return false; \
- }
-
-#define GET_AND_CHECK_STATIC_METHOD(VAR, CLASS, METHOD_NAME, METHOD_SIGNATURE) \
- VAR = env->GetStaticMethodID(CLASS, METHOD_NAME, METHOD_SIGNATURE); \
- if (!VAR) { \
- __android_log_print(ANDROID_LOG_FATAL, qtTagText(), methodErrorMsgFmt(), METHOD_NAME, METHOD_SIGNATURE); \
- return false; \
- }
-
-#define GET_AND_CHECK_STATIC_FIELD(VAR, CLASS, FIELD_NAME, FIELD_SIGNATURE) \
- VAR = env->GetStaticFieldID(CLASS, FIELD_NAME, FIELD_SIGNATURE); \
- if (!VAR) { \
- __android_log_print(ANDROID_LOG_FATAL, qtTagText(), methodErrorMsgFmt(), FIELD_NAME, FIELD_SIGNATURE); \
- return false; \
- }
-
- bool registerNatives(JNIEnv *env)
- {
- jclass appClass = applicationClass();
-
- if (env->RegisterNatives(appClass, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
- __android_log_print(ANDROID_LOG_FATAL,"Qt", "RegisterNatives failed");
- return false;
- }
-
- GET_AND_CHECK_STATIC_METHOD(openContextMenuMethodID, appClass, "openContextMenu", "()V");
- GET_AND_CHECK_STATIC_METHOD(closeContextMenuMethodID, appClass, "closeContextMenu", "()V");
- GET_AND_CHECK_STATIC_METHOD(resetOptionsMenuMethodID, appClass, "resetOptionsMenu", "()V");
-
- jclass clazz;
- FIND_AND_CHECK_CLASS("android/view/Menu");
- GET_AND_CHECK_METHOD(clearMenuMethodID, clazz, "clear", "()V");
- GET_AND_CHECK_METHOD(addMenuItemMethodID, clazz, "add", "(IIILjava/lang/CharSequence;)Landroid/view/MenuItem;");
- jfieldID menuNoneFiledId;
- GET_AND_CHECK_STATIC_FIELD(menuNoneFiledId, clazz, "NONE", "I");
- menuNoneValue = env->GetStaticIntField(clazz, menuNoneFiledId);
-
- FIND_AND_CHECK_CLASS("android/view/ContextMenu");
- GET_AND_CHECK_METHOD(setHeaderTitleContextMenuMethodID, clazz, "setHeaderTitle","(Ljava/lang/CharSequence;)Landroid/view/ContextMenu;");
-
- FIND_AND_CHECK_CLASS("android/view/MenuItem");
- GET_AND_CHECK_METHOD(setCheckableMenuItemMethodID, clazz, "setCheckable", "(Z)Landroid/view/MenuItem;");
- GET_AND_CHECK_METHOD(setCheckedMenuItemMethodID, clazz, "setChecked", "(Z)Landroid/view/MenuItem;");
- GET_AND_CHECK_METHOD(setEnabledMenuItemMethodID, clazz, "setEnabled", "(Z)Landroid/view/MenuItem;");
- GET_AND_CHECK_METHOD(setIconMenuItemMethodID, clazz, "setIcon", "(Landroid/graphics/drawable/Drawable;)Landroid/view/MenuItem;");
- GET_AND_CHECK_METHOD(setVisibleMenuItemMethodID, clazz, "setVisible", "(Z)Landroid/view/MenuItem;");
- return true;
- }
-}
diff --git a/src/plugins/platforms/android/src/androidjnimenu.h b/src/plugins/platforms/android/src/androidjnimenu.h
deleted file mode 100644
index 7c5422f67b..0000000000
--- a/src/plugins/platforms/android/src/androidjnimenu.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDJNIMENU_H
-#define ANDROIDJNIMENU_H
-
-#include <jni.h>
-
-class QAndroidPlatformMenuBar;
-class QAndroidPlatformMenu;
-class QAndroidPlatformMenuItem;
-class QWindow;
-
-namespace QtAndroidMenu
-{
- // Menu support
- void showContextMenu(QAndroidPlatformMenu *menu, JNIEnv *env = 0);
- void hideContextMenu(QAndroidPlatformMenu *menu);
- void syncMenu(QAndroidPlatformMenu *menu);
- void androidPlatformMenuDestroyed(QAndroidPlatformMenu *menu);
-
- void setMenuBar(QAndroidPlatformMenuBar *menuBar, QWindow *window);
- void setActiveTopLevelWindow(QWindow *window);
- void addMenuBar(QAndroidPlatformMenuBar *menuBar);
- void removeMenuBar(QAndroidPlatformMenuBar *menuBar);
-
- // Menu support
- bool registerNatives(JNIEnv *env);
-}
-
-#endif // ANDROIDJNIMENU_H
diff --git a/src/plugins/platforms/android/src/androidplatformplugin.cpp b/src/plugins/platforms/android/src/androidplatformplugin.cpp
deleted file mode 100644
index 2cf5aa1e01..0000000000
--- a/src/plugins/platforms/android/src/androidplatformplugin.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qpa/qplatformintegrationplugin.h>
-#include "qandroidplatformintegration.h"
-
-QT_BEGIN_NAMESPACE
-
-class QAndroidPlatformIntegrationPlugin: public QPlatformIntegrationPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2" FILE "android.json")
-public:
- QPlatformIntegration *create(const QString &key, const QStringList &paramList);
-};
-
-
-QPlatformIntegration *QAndroidPlatformIntegrationPlugin::create(const QString &key, const QStringList &paramList)
-{
- Q_UNUSED(paramList);
- if (!key.compare(QLatin1String("android"), Qt::CaseInsensitive))
- return new QAndroidPlatformIntegration(paramList);
- return 0;
-}
-
-QT_END_NAMESPACE
-#include "androidplatformplugin.moc"
-
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp
deleted file mode 100644
index 6431914812..0000000000
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidopenglcontext.h"
-#include "qandroidopenglplatformwindow.h"
-#include "qandroidplatformintegration.h"
-
-#include <QtCore/qdebug.h>
-#include <qpa/qwindowsysteminterface.h>
-
-#include <QtGui/private/qopenglcontext_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QAndroidOpenGLContext::QAndroidOpenGLContext(const QAndroidPlatformIntegration *integration,
- const QSurfaceFormat &format,
- QPlatformOpenGLContext *share,
- EGLDisplay display,
- EGLenum eglApi)
- : QEglFSContext(format, share, display, eglApi)
- , m_platformIntegration(integration)
-{
-}
-
-void QAndroidOpenGLContext::swapBuffers(QPlatformSurface *surface)
-{
- QEglFSContext::swapBuffers(surface);
-
- if (surface->surface()->surfaceClass() == QSurface::Window) {
- QAndroidOpenGLPlatformWindow *window = static_cast<QAndroidOpenGLPlatformWindow *>(surface);
- window->lock();
- QSize size = window->scheduledResize();
- if (size.isValid()) {
- QRect geometry(QPoint(0, 0), size);
- window->setGeometry(geometry);
- QWindowSystemInterface::handleGeometryChange(window->window(), geometry);
- QWindowSystemInterface::handleExposeEvent(window->window(), QRegion(geometry));
- window->scheduleResize(QSize());
- }
- window->unlock();
- }
-}
-
-bool QAndroidOpenGLContext::makeCurrent(QPlatformSurface *surface)
-{
- bool ret = QEglFSContext::makeCurrent(surface);
-
- const char *rendererString = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
- if (rendererString != 0 && qstrncmp(rendererString, "Android Emulator", 16) == 0) {
- QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(context());
- ctx_d->workaround_missingPrecisionQualifiers = true;
- }
-
- return ret;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.h b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.h
deleted file mode 100644
index c419ae8392..0000000000
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDOPENGLCONTEXT_H
-#define QANDROIDOPENGLCONTEXT_H
-
-#include <QtCore/qreadwritelock.h>
-#include "qeglfscontext.h"
-
-QT_BEGIN_NAMESPACE
-
-class QAndroidPlatformIntegration;
-class QAndroidOpenGLContext : public QEglFSContext
-{
-public:
- QAndroidOpenGLContext(const QAndroidPlatformIntegration *integration,
- const QSurfaceFormat &format,
- QPlatformOpenGLContext *share,
- EGLDisplay display,
- EGLenum eglApi = EGL_OPENGL_ES_API);
-
- void swapBuffers(QPlatformSurface *surface);
- bool makeCurrent(QPlatformSurface *surface);
-
-private:
- const QAndroidPlatformIntegration *m_platformIntegration;
-};
-
-QT_END_NAMESPACE
-
-#endif // QANDROIDOPENGLCONTEXT_H
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp
deleted file mode 100644
index de4075feff..0000000000
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidopenglplatformscreen.h"
-#include "qandroidopenglplatformwindow.h"
-#include "androidjnimenu.h"
-
-QT_BEGIN_NAMESPACE
-
-QAndroidOpenGLPlatformScreen::QAndroidOpenGLPlatformScreen(EGLDisplay display)
- : QEglFSScreen(display)
-{
-}
-
-void QAndroidOpenGLPlatformScreen::topWindowChanged(QPlatformWindow *window)
-{
- QtAndroidMenu::setActiveTopLevelWindow(window->window());
- QAndroidOpenGLPlatformWindow *platformWindow = static_cast<QAndroidOpenGLPlatformWindow *>(window);
- if (platformWindow != 0)
- platformWindow->updateStatusBarVisibility();
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.h b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.h
deleted file mode 100644
index e9251592aa..0000000000
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDOPENGLPLATFORMSCREEN_H
-#define QANDROIDOPENGLPLATFORMSCREEN_H
-
-#include "qeglfsscreen.h"
-
-QT_BEGIN_NAMESPACE
-
-class QAndroidOpenGLPlatformScreen : public QEglFSScreen
-{
-public:
- QAndroidOpenGLPlatformScreen(EGLDisplay display);
-
-protected:
- void topWindowChanged(QPlatformWindow *window);
-};
-
-QT_END_NAMESPACE
-
-#endif // QANDROIDOPENGLPLATFORMSCREEN_H
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp
deleted file mode 100644
index 6ed805174b..0000000000
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp
+++ /dev/null
@@ -1,178 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidopenglplatformwindow.h"
-#include "androidjnimain.h"
-#include "qandroidplatformintegration.h"
-#include <qpa/qwindowsysteminterface.h>
-
-QT_BEGIN_NAMESPACE
-
-EGLSurface QAndroidOpenGLPlatformWindow::m_staticSurface = 0;
-EGLNativeWindowType QAndroidOpenGLPlatformWindow::m_staticNativeWindow = 0;
-QReadWriteLock QAndroidOpenGLPlatformWindow::m_staticSurfaceLock;
-QBasicAtomicInt QAndroidOpenGLPlatformWindow::m_referenceCount = Q_BASIC_ATOMIC_INITIALIZER(0);
-
-QAndroidOpenGLPlatformWindow::QAndroidOpenGLPlatformWindow(QWindow *window)
- : QEglFSWindow(window)
- , m_state(Qt::WindowNoState)
-{
-}
-
-QAndroidOpenGLPlatformWindow::~QAndroidOpenGLPlatformWindow()
-{
- destroy();
-}
-
-bool QAndroidOpenGLPlatformWindow::isExposed() const
-{
- return QtAndroid::nativeWindow(false) != 0 && QEglFSWindow::isExposed();
-}
-
-void QAndroidOpenGLPlatformWindow::invalidateSurface()
-{
- QWindowSystemInterface::handleExposeEvent(window(), QRegion()); // Obscure event
- QWindowSystemInterface::flushWindowSystemEvents();
-
- m_window = 0;
- m_surface = 0;
-
- if (!m_referenceCount.deref()){
- QWriteLocker locker(&m_staticSurfaceLock);
-
- EGLDisplay display = (static_cast<QEglFSScreen *>(window()->screen()->handle()))->display();
- eglDestroySurface(display, m_staticSurface);
-
- m_staticSurface = 0;
- m_staticNativeWindow = 0;
- }
-}
-
-void QAndroidOpenGLPlatformWindow::updateStaticNativeWindow()
-{
- QWriteLocker locker(&m_staticSurfaceLock);
- m_staticNativeWindow = QtAndroid::nativeWindow(false);
-}
-
-void QAndroidOpenGLPlatformWindow::resetSurface()
-{
- // Only add a reference if we're not already holding one, otherwise we're just updating
- // the native window pointer
- if (m_window == 0)
- m_referenceCount.ref();
-
- if (m_staticSurface == 0) {
- QWriteLocker locker(&m_staticSurfaceLock);
- QEglFSWindow::resetSurface();
- m_staticSurface = m_surface;
- m_staticNativeWindow = m_window;
- } else {
- QReadLocker locker(&m_staticSurfaceLock);
- m_window = m_staticNativeWindow;
- m_surface = m_staticSurface;
- }
-
- {
- lock();
- // Use the desktop size.
- // On some devices, the getters for the native window size gives wrong values
- scheduleResize(QAndroidPlatformIntegration::defaultDesktopSize());
- QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); // Expose event
- unlock();
- }
-
- QWindowSystemInterface::flushWindowSystemEvents();
-}
-
-void QAndroidOpenGLPlatformWindow::destroy()
-{
- if (!m_referenceCount.deref()) {
- QEglFSWindow::destroy();
- } else {
- m_window = 0;
- m_surface = 0;
- }
-}
-
-void QAndroidOpenGLPlatformWindow::updateStatusBarVisibility()
-{
- Qt::WindowFlags flags = window()->flags();
- bool isNonRegularWindow = flags & (Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window;
- if (!isNonRegularWindow) {
- if (m_state & Qt::WindowFullScreen)
- QtAndroid::hideStatusBar();
- else if (m_state & Qt::WindowMaximized)
- QtAndroid::showStatusBar();
- }
-}
-
-void QAndroidOpenGLPlatformWindow::raise()
-{
- updateStatusBarVisibility();
-}
-
-void QAndroidOpenGLPlatformWindow::setWindowState(Qt::WindowState state)
-{
- if (m_state == state)
- return;
-
- m_state = state;
- if (window()->isVisible())
- updateStatusBarVisibility();
-}
-
-void QAndroidOpenGLPlatformWindow::setVisible(bool visible)
-{
- if (visible)
- updateStatusBarVisibility();
-
- QEglFSWindow::setVisible(visible);
-
- // The Android Activity is activated before Qt is initialized, causing the application state to
- // never be set to 'active'. We explicitly set this state when the first window becomes visible.
- if (visible)
- QtAndroid::setApplicationActive();
-
- QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); // Expose event
- QWindowSystemInterface::flushWindowSystemEvents();
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h
deleted file mode 100644
index e4ff0444d4..0000000000
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDOPENGLPLATFORMWINDOW_H
-#define QANDROIDOPENGLPLATFORMWINDOW_H
-
-#include "qeglfswindow.h"
-#include <QtCore/qmutex.h>
-#include <QtCore/qreadwritelock.h>
-
-QT_BEGIN_NAMESPACE
-
-class QAndroidOpenGLPlatformWindow : public QEglFSWindow
-{
-public:
- QAndroidOpenGLPlatformWindow(QWindow *window);
- ~QAndroidOpenGLPlatformWindow();
-
- QSize scheduledResize() const { return m_scheduledResize; }
- void scheduleResize(const QSize &size) { m_scheduledResize = size; }
-
- void lock() { m_lock.lock(); }
- void unlock() { m_lock.unlock(); }
-
- bool isExposed() const;
-
- void raise();
-
- void invalidateSurface();
- void resetSurface();
- void setWindowState(Qt::WindowState state);
-
- void setVisible(bool visible);
-
- void destroy();
-
- static void updateStaticNativeWindow();
- void updateStatusBarVisibility();
-
-private:
- QSize m_scheduledResize;
- QMutex m_lock;
- Qt::WindowState m_state;
-
- static QReadWriteLock m_staticSurfaceLock;
- static EGLSurface m_staticSurface;
- static EGLNativeWindowType m_staticNativeWindow;
- static QBasicAtomicInt m_referenceCount;
-};
-
-QT_END_NAMESPACE
-
-#endif // QANDROIDOPENGLPLATFORMWINDOW_H
diff --git a/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp b/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp
deleted file mode 100644
index 278cd553f4..0000000000
--- a/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qeglfshooks.h"
-#include "androidjnimain.h"
-#include "qandroidplatformintegration.h"
-
-#include <android/native_window.h>
-#include <jni.h>
-
-QT_BEGIN_NAMESPACE
-
-class QEglFSAndroidHooks: public QEglFSHooks
-{
-public:
- void platformInit();
- void platformDestroy();
- EGLNativeDisplayType platformDisplay() const;
- QSize screenSize() const;
- QSizeF physicalScreenSize() const;
- QDpi logicalDpi() const;
- Qt::ScreenOrientation orientation() const;
- Qt::ScreenOrientation nativeOrientation() const;
- int screenDepth() const;
- QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const;
- EGLNativeWindowType createNativeWindow(QPlatformWindow *platformWindow, const QSize &size, const QSurfaceFormat &format);
- void destroyNativeWindow(EGLNativeWindowType window);
- bool hasCapability(QPlatformIntegration::Capability cap) const;
- QEglFSCursor *createCursor(QEglFSScreen *screen) const;
-};
-
-void QEglFSAndroidHooks::platformInit()
-{
-}
-
-void QEglFSAndroidHooks::platformDestroy()
-{
-}
-
-EGLNativeDisplayType QEglFSAndroidHooks::platformDisplay() const
-{
- return EGL_DEFAULT_DISPLAY;
-}
-
-QSize QEglFSAndroidHooks::screenSize() const
-{
- return QAndroidPlatformIntegration::defaultDesktopSize();
-}
-
-QSizeF QEglFSAndroidHooks::physicalScreenSize() const
-{
- return QSizeF(QAndroidPlatformIntegration::m_defaultPhysicalSizeWidth, QAndroidPlatformIntegration::m_defaultPhysicalSizeHeight);
-}
-
-QDpi QEglFSAndroidHooks::logicalDpi() const
-{
- qreal lDpi = QtAndroid::scaledDensity() * 72;
- return QDpi(lDpi, lDpi);
-}
-
-Qt::ScreenOrientation QEglFSAndroidHooks::orientation() const
-{
- return QAndroidPlatformIntegration::m_orientation;
-}
-
-Qt::ScreenOrientation QEglFSAndroidHooks::nativeOrientation() const
-{
- return QAndroidPlatformIntegration::m_nativeOrientation;
-}
-
-EGLNativeWindowType QEglFSAndroidHooks::createNativeWindow(QPlatformWindow *platformWindow, const QSize &size, const QSurfaceFormat &format)
-{
- Q_UNUSED(platformWindow);
- Q_UNUSED(size);
- Q_UNUSED(format);
- ANativeWindow *window = QtAndroid::nativeWindow();
- if (window != 0)
- ANativeWindow_acquire(window);
-
- return window;
-}
-
-void QEglFSAndroidHooks::destroyNativeWindow(EGLNativeWindowType window)
-{
- if (window != 0)
- ANativeWindow_release(window);
-}
-
-bool QEglFSAndroidHooks::hasCapability(QPlatformIntegration::Capability capability) const
-{
- switch (capability) {
- case QPlatformIntegration::OpenGL: return true;
- case QPlatformIntegration::ThreadedOpenGL: return true;
- default: return false;
- };
-}
-
-int QEglFSAndroidHooks::screenDepth() const
-{
- // ### Hardcoded
- return 32;
-}
-
-QSurfaceFormat QEglFSAndroidHooks::surfaceFormatFor(const QSurfaceFormat &inputFormat) const
-{
- QSurfaceFormat ret(inputFormat);
- ret.setAlphaBufferSize(8);
- ret.setRedBufferSize(8);
- ret.setGreenBufferSize(8);
- ret.setBlueBufferSize(8);
- return ret;
-}
-
-QEglFSCursor *QEglFSAndroidHooks::createCursor(QEglFSScreen *screen) const
-{
- Q_UNUSED(screen);
- return 0;
-}
-
-static QEglFSAndroidHooks eglFSAndroidHooks;
-QEglFSHooks *platformHooks = &eglFSAndroidHooks;
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.cpp b/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.cpp
deleted file mode 100644
index 95844fc649..0000000000
--- a/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.cpp
+++ /dev/null
@@ -1,309 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidassetsfileenginehandler.h"
-#include "androidjnimain.h"
-
-#include <QCoreApplication>
-#include <QVector>
-
-typedef QVector<QString> FilesList;
-
-struct AndroidAssetDir
-{
- AndroidAssetDir(AAssetDir* ad)
- {
- const char *fileName;
- while ((fileName = AAssetDir_getNextFileName(ad)))
- m_items.push_back(QString::fromUtf8(fileName));
- AAssetDir_close(ad);
- }
- FilesList m_items;
-};
-
-class AndroidAbstractFileEngineIterator: public QAbstractFileEngineIterator
-{
-public:
- AndroidAbstractFileEngineIterator(QDir::Filters filters,
- const QStringList &nameFilters,
- QSharedPointer<AndroidAssetDir> asset,
- const QString &path)
- : QAbstractFileEngineIterator(filters, nameFilters)
- {
- m_items = asset->m_items;
- m_index = -1;
- m_path = path;
- }
-
- virtual QFileInfo currentFileInfo() const
- {
- return QFileInfo(currentFilePath());
- }
-
- virtual QString currentFileName() const
- {
- if (m_index < 0 || m_index >= m_items.size())
- return QString();
- return m_items[m_index];
- }
-
- virtual QString currentFilePath() const
- {
- return m_path + currentFileName();
- }
-
- virtual bool hasNext() const
- {
- return m_items.size() && (m_index < m_items.size() - 1);
- }
-
- virtual QString next()
- {
- if (!hasNext())
- return QString();
- m_index++;
- return currentFileName();
- }
-
-private:
- QString m_path;
- FilesList m_items;
- int m_index;
-};
-
-class AndroidAbstractFileEngine: public QAbstractFileEngine
-{
-public:
- explicit AndroidAbstractFileEngine(AAsset *asset, const QString &fileName)
- {
- m_assetFile = asset;
- m_fileName = fileName;
- }
-
- explicit AndroidAbstractFileEngine(QSharedPointer<AndroidAssetDir> asset, const QString &fileName)
- {
- m_assetFile = 0;
- m_assetDir = asset;
- m_fileName = fileName;
- if (!m_fileName.endsWith(QChar(QLatin1Char('/'))))
- m_fileName += "/";
- }
-
- ~AndroidAbstractFileEngine()
- {
- close();
- }
-
- virtual bool open(QIODevice::OpenMode openMode)
- {
- if (m_assetFile)
- return openMode & QIODevice::ReadOnly;
- return false;
- }
-
- virtual bool close()
- {
- if (m_assetFile) {
- AAsset_close(m_assetFile);
- m_assetFile = 0;
- return true;
- }
- return false;
- }
-
- virtual qint64 size() const
- {
- if (m_assetFile)
- return AAsset_getLength(m_assetFile);
- return -1;
- }
-
- virtual qint64 pos() const
- {
- if (m_assetFile)
- return AAsset_seek(m_assetFile, 0, SEEK_CUR);
- return -1;
- }
-
- virtual bool seek(qint64 pos)
- {
- if (m_assetFile)
- return pos == AAsset_seek(m_assetFile, pos, SEEK_SET);
- return false;
- }
-
- virtual qint64 read(char *data, qint64 maxlen)
- {
- if (m_assetFile)
- return AAsset_read(m_assetFile, data, maxlen);
- return -1;
- }
-
- virtual bool isSequential() const
- {
- return false;
- }
-
- virtual bool caseSensitive() const
- {
- return true;
- }
-
- virtual bool isRelativePath() const
- {
- return false;
- }
-
- virtual FileFlags fileFlags(FileFlags type = FileInfoAll) const
- {
- FileFlags flags(ReadOwnerPerm|ReadUserPerm|ReadGroupPerm|ReadOtherPerm|ExistsFlag);
- if (m_assetFile)
- flags |= FileType;
- if (!m_assetDir.isNull())
- flags |= DirectoryType;
-
- return type & flags;
- }
-
- virtual QString fileName(FileName file = DefaultName) const
- {
- int pos;
- switch (file) {
- case DefaultName:
- case AbsoluteName:
- case CanonicalName:
- return m_fileName;
- case BaseName:
- if ((pos = m_fileName.lastIndexOf(QChar(QLatin1Char('/')))) != -1)
- return m_fileName.mid(pos);
- else
- return m_fileName;
- case PathName:
- case AbsolutePathName:
- case CanonicalPathName:
- if ((pos = m_fileName.lastIndexOf(QChar(QLatin1Char('/')))) != -1)
- return m_fileName.left(pos);
- else
- return m_fileName;
- default:
- return QString();
- }
- }
-
- virtual void setFileName(const QString &file)
- {
- if (file == m_fileName)
- return;
-
- m_fileName = file;
- if (!m_fileName.endsWith(QChar(QLatin1Char('/'))))
- m_fileName += "/";
-
- close();
- }
-
- virtual Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames)
- {
- if (!m_assetDir.isNull())
- return new AndroidAbstractFileEngineIterator(filters, filterNames, m_assetDir, m_fileName);
- return 0;
- }
-
-private:
- AAsset *m_assetFile;
- QSharedPointer<AndroidAssetDir> m_assetDir;
- QString m_fileName;
-};
-
-
-AndroidAssetsFileEngineHandler::AndroidAssetsFileEngineHandler():m_assetsCache(std::max(5, qgetenv("QT_ANDROID_MAX_ASSETS_CACHE_SIZE").toInt()))
-{
- m_assetManager = QtAndroid::assetManager();
-}
-
-AndroidAssetsFileEngineHandler::~AndroidAssetsFileEngineHandler()
-{
-}
-
-QAbstractFileEngine * AndroidAssetsFileEngineHandler::create(const QString &fileName) const
-{
- if (fileName.isEmpty())
- return 0;
-
- if (!fileName.startsWith(QLatin1String("assets:/")))
- return 0;
-
- int prefixSize=8;
-
- QByteArray path;
- if (!fileName.endsWith(QLatin1Char('/'))) {
- path = fileName.toUtf8();
- AAsset *asset = AAssetManager_open(m_assetManager,
- path.constData() + prefixSize,
- AASSET_MODE_BUFFER);
- if (asset)
- return new AndroidAbstractFileEngine(asset, fileName);
- }
-
- if (!path.size())
- path = fileName.left(fileName.length() - 1).toUtf8();
-
- m_assetsCacheMutext.lock();
- QSharedPointer<AndroidAssetDir> *aad = m_assetsCache.object(path);
- m_assetsCacheMutext.unlock();
- if (!aad) {
- AAssetDir *assetDir = AAssetManager_openDir(m_assetManager, path.constData() + prefixSize);
- if (assetDir) {
- if (AAssetDir_getNextFileName(assetDir)) {
- aad = new QSharedPointer<AndroidAssetDir>(new AndroidAssetDir(assetDir));
- m_assetsCacheMutext.lock();
- m_assetsCache.insert(path, aad);
- m_assetsCacheMutext.unlock();
- return new AndroidAbstractFileEngine(*aad, fileName);
- } else {
- AAssetDir_close(assetDir);
- }
- }
- } else {
- return new AndroidAbstractFileEngine(*aad, fileName);
- }
- return 0;
-}
diff --git a/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.h b/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.h
deleted file mode 100644
index 7bd560886c..0000000000
--- a/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDASSETSFILEENGINEHANDLER_H
-#define QANDROIDASSETSFILEENGINEHANDLER_H
-
-#include <QtCore/private/qabstractfileengine_p.h>
-#include <QCache>
-#include <QMutex>
-#include <QSharedPointer>
-
-#include <android/asset_manager.h>
-
-struct AndroidAssetDir;
-class AndroidAssetsFileEngineHandler: public QAbstractFileEngineHandler
-{
-public:
- AndroidAssetsFileEngineHandler();
- virtual ~AndroidAssetsFileEngineHandler();
- QAbstractFileEngine *create(const QString &fileName) const;
-
-private:
- AAssetManager *m_assetManager;
- mutable QCache<QByteArray, QSharedPointer<AndroidAssetDir>> m_assetsCache;
- mutable QMutex m_assetsCacheMutext;
-};
-
-#endif // QANDROIDASSETSFILEENGINEHANDLER_H
diff --git a/src/plugins/platforms/android/src/qandroidinputcontext.cpp b/src/plugins/platforms/android/src/qandroidinputcontext.cpp
deleted file mode 100644
index 326972e71e..0000000000
--- a/src/plugins/platforms/android/src/qandroidinputcontext.cpp
+++ /dev/null
@@ -1,762 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <android/log.h>
-
-#include "qandroidinputcontext.h"
-#include "androidjnimain.h"
-#include "androidjniinput.h"
-#include <QDebug>
-#include <qevent.h>
-#include <qguiapplication.h>
-#include <qsharedpointer.h>
-#include <qthread.h>
-#include <qinputmethod.h>
-#include <qwindow.h>
-
-#include <QTextCharFormat>
-
-#include <QDebug>
-
-QT_BEGIN_NAMESPACE
-
-static QAndroidInputContext *m_androidInputContext = 0;
-static char const *const QtNativeInputConnectionClassName = "org.qtproject.qt5.android.QtNativeInputConnection";
-static char const *const QtExtractedTextClassName = "org.qtproject.qt5.android.QtExtractedText";
-static jclass m_extractedTextClass = 0;
-static jmethodID m_classConstructorMethodID = 0;
-static jfieldID m_partialEndOffsetFieldID = 0;
-static jfieldID m_partialStartOffsetFieldID = 0;
-static jfieldID m_selectionEndFieldID = 0;
-static jfieldID m_selectionStartFieldID = 0;
-static jfieldID m_startOffsetFieldID = 0;
-static jfieldID m_textFieldID = 0;
-
-static jboolean commitText(JNIEnv *env, jobject /*thiz*/, jstring text, jint newCursorPosition)
-{
- if (!m_androidInputContext)
- return JNI_FALSE;
-
- jboolean isCopy;
- const jchar *jstr = env->GetStringChars(text, &isCopy);
- QString str(reinterpret_cast<const QChar *>(jstr), env->GetStringLength(text));
- env->ReleaseStringChars(text, jstr);
-
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ COMMIT" << str;
-#endif
- return m_androidInputContext->commitText(str, newCursorPosition);
-}
-
-static jboolean deleteSurroundingText(JNIEnv */*env*/, jobject /*thiz*/, jint leftLength, jint rightLength)
-{
- if (!m_androidInputContext)
- return JNI_FALSE;
-
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ DELETE" << leftLength << rightLength;
-#endif
- return m_androidInputContext->deleteSurroundingText(leftLength, rightLength);
-}
-
-static jboolean finishComposingText(JNIEnv */*env*/, jobject /*thiz*/)
-{
- if (!m_androidInputContext)
- return JNI_FALSE;
-
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ FINISH";
-#endif
- return m_androidInputContext->finishComposingText();
-}
-
-static jint getCursorCapsMode(JNIEnv */*env*/, jobject /*thiz*/, jint reqModes)
-{
- if (!m_androidInputContext)
- return 0;
-
- return m_androidInputContext->getCursorCapsMode(reqModes);
-}
-
-static jobject getExtractedText(JNIEnv *env, jobject /*thiz*/, int hintMaxChars, int hintMaxLines, jint flags)
-{
- if (!m_androidInputContext)
- return 0;
-
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ GETEX";
-#endif
- const QAndroidInputContext::ExtractedText &extractedText =
- m_androidInputContext->getExtractedText(hintMaxChars, hintMaxLines, flags);
-
- jobject object = env->NewObject(m_extractedTextClass, m_classConstructorMethodID);
- env->SetIntField(object, m_partialStartOffsetFieldID, extractedText.partialStartOffset);
- env->SetIntField(object, m_partialEndOffsetFieldID, extractedText.partialEndOffset);
- env->SetIntField(object, m_selectionStartFieldID, extractedText.selectionStart);
- env->SetIntField(object, m_selectionEndFieldID, extractedText.selectionEnd);
- env->SetIntField(object, m_startOffsetFieldID, extractedText.startOffset);
- env->SetObjectField(object,
- m_textFieldID,
- env->NewString(reinterpret_cast<const jchar *>(extractedText.text.constData()),
- jsize(extractedText.text.length())));
-
- return object;
-}
-
-static jstring getSelectedText(JNIEnv *env, jobject /*thiz*/, jint flags)
-{
- if (!m_androidInputContext)
- return 0;
-
- const QString &text = m_androidInputContext->getSelectedText(flags);
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ GETSEL" << text;
-#endif
- return env->NewString(reinterpret_cast<const jchar *>(text.constData()), jsize(text.length()));
-}
-
-static jstring getTextAfterCursor(JNIEnv *env, jobject /*thiz*/, jint length, jint flags)
-{
- if (!m_androidInputContext)
- return 0;
-
- const QString &text = m_androidInputContext->getTextAfterCursor(length, flags);
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ GET" << length << text;
-#endif
- return env->NewString(reinterpret_cast<const jchar *>(text.constData()), jsize(text.length()));
-}
-
-static jstring getTextBeforeCursor(JNIEnv *env, jobject /*thiz*/, jint length, jint flags)
-{
- if (!m_androidInputContext)
- return 0;
-
- const QString &text = m_androidInputContext->getTextBeforeCursor(length, flags);
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ GET" << length << text;
-#endif
- return env->NewString(reinterpret_cast<const jchar *>(text.constData()), jsize(text.length()));
-}
-
-static jboolean setComposingText(JNIEnv *env, jobject /*thiz*/, jstring text, jint newCursorPosition)
-{
- if (!m_androidInputContext)
- return JNI_FALSE;
-
- jboolean isCopy;
- const jchar *jstr = env->GetStringChars(text, &isCopy);
- QString str(reinterpret_cast<const QChar *>(jstr), env->GetStringLength(text));
- env->ReleaseStringChars(text, jstr);
-
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ SET" << str;
-#endif
- return m_androidInputContext->setComposingText(str, newCursorPosition);
-}
-
-static jboolean setComposingRegion(JNIEnv */*env*/, jobject /*thiz*/, jint start, jint end)
-{
- if (!m_androidInputContext)
- return JNI_FALSE;
-
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ SETR" << start << end;
-#endif
- return m_androidInputContext->setComposingRegion(start, end);
-}
-
-
-static jboolean setSelection(JNIEnv */*env*/, jobject /*thiz*/, jint start, jint end)
-{
- if (!m_androidInputContext)
- return JNI_FALSE;
-
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ SETSEL" << start << end;
-#endif
- return m_androidInputContext->setSelection(start, end);
-}
-
-static jboolean selectAll(JNIEnv */*env*/, jobject /*thiz*/)
-{
- if (!m_androidInputContext)
- return JNI_FALSE;
-
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ SELALL";
-#endif
- return m_androidInputContext->selectAll();
-}
-
-static jboolean cut(JNIEnv */*env*/, jobject /*thiz*/)
-{
- if (!m_androidInputContext)
- return JNI_FALSE;
-
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@";
-#endif
- return m_androidInputContext->cut();
-}
-
-static jboolean copy(JNIEnv */*env*/, jobject /*thiz*/)
-{
- if (!m_androidInputContext)
- return JNI_FALSE;
-
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@";
-#endif
- return m_androidInputContext->copy();
-}
-
-static jboolean copyURL(JNIEnv */*env*/, jobject /*thiz*/)
-{
- if (!m_androidInputContext)
- return JNI_FALSE;
-
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@";
-#endif
- return m_androidInputContext->copyURL();
-}
-
-static jboolean paste(JNIEnv */*env*/, jobject /*thiz*/)
-{
- if (!m_androidInputContext)
- return JNI_FALSE;
-
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@";
-#endif
- return m_androidInputContext->paste();
-}
-
-
-static JNINativeMethod methods[] = {
- {"commitText", "(Ljava/lang/String;I)Z", (void *)commitText},
- {"deleteSurroundingText", "(II)Z", (void *)deleteSurroundingText},
- {"finishComposingText", "()Z", (void *)finishComposingText},
- {"getCursorCapsMode", "(I)I", (void *)getCursorCapsMode},
- {"getExtractedText", "(III)Lorg/qtproject/qt5/android/QtExtractedText;", (void *)getExtractedText},
- {"getSelectedText", "(I)Ljava/lang/String;", (void *)getSelectedText},
- {"getTextAfterCursor", "(II)Ljava/lang/String;", (void *)getTextAfterCursor},
- {"getTextBeforeCursor", "(II)Ljava/lang/String;", (void *)getTextBeforeCursor},
- {"setComposingText", "(Ljava/lang/String;I)Z", (void *)setComposingText},
- {"setComposingRegion", "(II)Z", (void *)setComposingRegion},
- {"setSelection", "(II)Z", (void *)setSelection},
- {"selectAll", "()Z", (void *)selectAll},
- {"cut", "()Z", (void *)cut},
- {"copy", "()Z", (void *)copy},
- {"copyURL", "()Z", (void *)copyURL},
- {"paste", "()Z", (void *)paste}
-};
-
-
-QAndroidInputContext::QAndroidInputContext()
- : QPlatformInputContext(), m_blockUpdateSelection(false)
-{
- QtAndroid::AttachedJNIEnv env;
- if (!env.jniEnv)
- return;
-
- jclass clazz = QtAndroid::findClass(QtNativeInputConnectionClassName, env.jniEnv);
- if (clazz == NULL) {
- qCritical() << "Native registration unable to find class '"
- << QtNativeInputConnectionClassName
- << "'";
- return;
- }
-
- if (env.jniEnv->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
- qCritical() << "RegisterNatives failed for '"
- << QtNativeInputConnectionClassName
- << "'";
- return;
- }
-
- clazz = QtAndroid::findClass(QtExtractedTextClassName, env.jniEnv);
- if (clazz == NULL) {
- qCritical() << "Native registration unable to find class '"
- << QtExtractedTextClassName
- << "'";
- return;
- }
-
- m_extractedTextClass = static_cast<jclass>(env.jniEnv->NewGlobalRef(clazz));
- m_classConstructorMethodID = env.jniEnv->GetMethodID(m_extractedTextClass, "<init>", "()V");
- if (m_classConstructorMethodID == NULL) {
- qCritical() << "GetMethodID failed";
- return;
- }
-
- m_partialEndOffsetFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "partialEndOffset", "I");
- if (m_partialEndOffsetFieldID == NULL) {
- qCritical() << "Can't find field partialEndOffset";
- return;
- }
-
- m_partialStartOffsetFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "partialStartOffset", "I");
- if (m_partialStartOffsetFieldID == NULL) {
- qCritical() << "Can't find field partialStartOffset";
- return;
- }
-
- m_selectionEndFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "selectionEnd", "I");
- if (m_selectionEndFieldID == NULL) {
- qCritical() << "Can't find field selectionEnd";
- return;
- }
-
- m_selectionStartFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "selectionStart", "I");
- if (m_selectionStartFieldID == NULL) {
- qCritical() << "Can't find field selectionStart";
- return;
- }
-
- m_startOffsetFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "startOffset", "I");
- if (m_startOffsetFieldID == NULL) {
- qCritical() << "Can't find field startOffset";
- return;
- }
-
- m_textFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "text", "Ljava/lang/String;");
- if (m_textFieldID == NULL) {
- qCritical() << "Can't find field text";
- return;
- }
- qRegisterMetaType<QInputMethodEvent *>("QInputMethodEvent*");
- qRegisterMetaType<QInputMethodQueryEvent *>("QInputMethodQueryEvent*");
- m_androidInputContext = this;
-}
-
-QAndroidInputContext::~QAndroidInputContext()
-{
- m_androidInputContext = 0;
- m_extractedTextClass = 0;
- m_partialEndOffsetFieldID = 0;
- m_partialStartOffsetFieldID = 0;
- m_selectionEndFieldID = 0;
- m_selectionStartFieldID = 0;
- m_startOffsetFieldID = 0;
- m_textFieldID = 0;
-}
-
-QAndroidInputContext *QAndroidInputContext::androidInputContext()
-{
- return m_androidInputContext;
-}
-
-void QAndroidInputContext::reset()
-{
- clear();
- if (qGuiApp->focusObject())
- QtAndroidInput::resetSoftwareKeyboard();
- else
- QtAndroidInput::hideSoftwareKeyboard();
-}
-
-void QAndroidInputContext::commit()
-{
- finishComposingText();
-}
-
-void QAndroidInputContext::updateCursorPosition()
-{
- QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery();
- if (!query.isNull() && !m_blockUpdateSelection) {
- const int cursorPos = query->value(Qt::ImCursorPosition).toInt();
- QtAndroidInput::updateSelection(cursorPos, cursorPos, -1, -1); //selection empty and no pre-edit text
- }
-}
-
-void QAndroidInputContext::update(Qt::InputMethodQueries queries)
-{
- QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery(queries);
- if (query.isNull())
- return;
-#warning TODO extract the needed data from query
-}
-
-void QAndroidInputContext::invokeAction(QInputMethod::Action action, int cursorPosition)
-{
-#warning TODO Handle at least QInputMethod::ContextMenu action
- Q_UNUSED(action)
- Q_UNUSED(cursorPosition)
-
- if (action == QInputMethod::Click)
- commit();
-}
-
-QRectF QAndroidInputContext::keyboardRect() const
-{
- return QPlatformInputContext::keyboardRect();
-}
-
-bool QAndroidInputContext::isAnimating() const
-{
- return false;
-}
-
-void QAndroidInputContext::showInputPanel()
-{
- QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery();
- if (query.isNull())
- return;
-
- disconnect(m_updateCursorPosConnection);
- if (qGuiApp->focusObject()->metaObject()->indexOfSignal("cursorPositionChanged(int,int)") >= 0) // QLineEdit breaks the pattern
- m_updateCursorPosConnection = connect(qGuiApp->focusObject(), SIGNAL(cursorPositionChanged(int,int)), this, SLOT(updateCursorPosition()));
- else
- m_updateCursorPosConnection = connect(qGuiApp->focusObject(), SIGNAL(cursorPositionChanged()), this, SLOT(updateCursorPosition()));
- QRectF itemRect = qGuiApp->inputMethod()->inputItemRectangle();
- QRect rect = qGuiApp->inputMethod()->inputItemTransform().mapRect(itemRect).toRect();
- QWindow *window = qGuiApp->focusWindow();
- if (window)
- rect = QRect(window->mapToGlobal(rect.topLeft()), rect.size());
-
- QtAndroidInput::showSoftwareKeyboard(rect.left(),
- rect.top(),
- rect.width(),
- rect.height(),
- query->value(Qt::ImHints).toUInt());
-}
-
-void QAndroidInputContext::hideInputPanel()
-{
- QtAndroidInput::hideSoftwareKeyboard();
-}
-
-bool QAndroidInputContext::isInputPanelVisible() const
-{
- return QtAndroidInput::isSoftwareKeyboardVisible();
-}
-
-bool QAndroidInputContext::isComposing() const
-{
- return m_composingText.length();
-}
-
-void QAndroidInputContext::clear()
-{
- m_composingText.clear();
- m_extractedText.clear();
-}
-
-void QAndroidInputContext::sendEvent(QObject *receiver, QInputMethodEvent *event)
-{
- QCoreApplication::sendEvent(receiver, event);
-}
-
-void QAndroidInputContext::sendEvent(QObject *receiver, QInputMethodQueryEvent *event)
-{
- QCoreApplication::sendEvent(receiver, event);
-}
-
-jboolean QAndroidInputContext::commitText(const QString &text, jint /*newCursorPosition*/)
-{
- m_composingText = text;
- return finishComposingText();
-}
-
-jboolean QAndroidInputContext::deleteSurroundingText(jint leftLength, jint rightLength)
-{
- QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery();
- if (query.isNull())
- return JNI_TRUE;
-
- m_composingText.clear();
-
- QInputMethodEvent event;
- event.setCommitString(QString(), -leftLength, leftLength+rightLength);
- sendInputMethodEvent(&event);
- clear();
-
- return JNI_TRUE;
-}
-
-jboolean QAndroidInputContext::finishComposingText()
-{
- QInputMethodEvent event;
- event.setCommitString(m_composingText);
- sendInputMethodEvent(&event);
- clear();
-
- return JNI_TRUE;
-}
-
-jint QAndroidInputContext::getCursorCapsMode(jint /*reqModes*/)
-{
- jint res = 0;
- QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery();
- if (query.isNull())
- return res;
-
- const uint qtInputMethodHints = query->value(Qt::ImHints).toUInt();
-
- if (qtInputMethodHints & Qt::ImhPreferUppercase)
- res = CAP_MODE_SENTENCES;
-
- if (qtInputMethodHints & Qt::ImhUppercaseOnly)
- res = CAP_MODE_CHARACTERS;
-
- return res;
-}
-
-const QAndroidInputContext::ExtractedText &QAndroidInputContext::getExtractedText(jint hintMaxChars, jint /*hintMaxLines*/, jint /*flags*/)
-{
- QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery();
- if (query.isNull())
- return m_extractedText;
-
- if (hintMaxChars)
- m_extractedText.text = query->value(Qt::ImSurroundingText).toString().right(hintMaxChars);
-
- m_extractedText.startOffset = query->value(Qt::ImCursorPosition).toInt();
- const QString &selection = query->value(Qt::ImCurrentSelection).toString();
- const int selLen = selection.length();
- if (selLen) {
- m_extractedText.selectionStart = query->value(Qt::ImAnchorPosition).toInt();
- m_extractedText.selectionEnd = m_extractedText.startOffset;
- }
-
- return m_extractedText;
-}
-
-QString QAndroidInputContext::getSelectedText(jint /*flags*/)
-{
- QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery();
- if (query.isNull())
- return QString();
-
- return query->value(Qt::ImCurrentSelection).toString();
-}
-
-QString QAndroidInputContext::getTextAfterCursor(jint length, jint /*flags*/)
-{
- QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery();
- if (query.isNull())
- return QString();
-
- QString text = query->value(Qt::ImSurroundingText).toString();
- if (!text.length())
- return text;
-
- int cursorPos = query->value(Qt::ImCursorPosition).toInt();
- return text.mid(cursorPos, length);
-}
-
-QString QAndroidInputContext::getTextBeforeCursor(jint length, jint /*flags*/)
-{
- QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery();
- if (query.isNull())
- return QString();
-
- QString text = query->value(Qt::ImSurroundingText).toString();
- if (!text.length())
- return text;
-
- int cursorPos = query->value(Qt::ImCursorPosition).toInt();
- const int wordLeftPos = cursorPos - length;
- return text.mid(wordLeftPos > 0 ? wordLeftPos : 0, cursorPos);
-}
-
-jboolean QAndroidInputContext::setComposingText(const QString &text, jint newCursorPosition)
-{
- if (newCursorPosition > 0)
- newCursorPosition += text.length() - 1;
- m_composingText = text;
- QList<QInputMethodEvent::Attribute> attributes;
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor,
- newCursorPosition,
- 1,
- QVariant()));
- // Show compose text underlined
- QTextCharFormat underlined;
- underlined.setFontUnderline(true);
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat,0, text.length(),
- QVariant(underlined)));
-
- QInputMethodEvent event(m_composingText, attributes);
- sendInputMethodEvent(&event);
-
- QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery();
- if (!query.isNull() && !m_blockUpdateSelection) {
- int cursorPos = query->value(Qt::ImCursorPosition).toInt();
- int preeditLength = text.length();
- QtAndroidInput::updateSelection(cursorPos+preeditLength, cursorPos+preeditLength, cursorPos, cursorPos+preeditLength);
- }
-
- return JNI_TRUE;
-}
-
-// Android docs say:
-// * start may be after end, same meaning as if swapped
-// * this function must not trigger updateSelection
-// * if start == end then we should stop composing
-jboolean QAndroidInputContext::setComposingRegion(jint start, jint end)
-{
- QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery();
- if (query.isNull())
- return JNI_FALSE;
-
- if (start > end)
- qSwap(start, end);
-
- /*
- start and end are cursor positions, not character positions,
- i.e. selecting the first character is done by start == 0 and end == 1,
- and start == end means no character selected
-
- Therefore, the length of the region is end - start
- */
- int length = end - start;
-
- bool updateSelectionWasBlocked = m_blockUpdateSelection;
- m_blockUpdateSelection = true;
-
- QString text = query->value(Qt::ImSurroundingText).toString();
- m_composingText = text.mid(start, length);
-
- //in the Qt text controls, cursor pos is the start of the preedit
- int cursorPos = query->value(Qt::ImCursorPosition).toInt();
- int relativeStart = start - cursorPos;
-
- QList<QInputMethodEvent::Attribute> attributes;
-
- // Show compose text underlined
- QTextCharFormat underlined;
- underlined.setFontUnderline(true);
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat,0, length,
- QVariant(underlined)));
-
- QInputMethodEvent event(m_composingText, attributes);
- event.setCommitString(QString(), relativeStart, length);
- sendInputMethodEvent(&event);
-
- m_blockUpdateSelection = updateSelectionWasBlocked;
- return JNI_TRUE;
-}
-
-jboolean QAndroidInputContext::setSelection(jint start, jint end)
-{
- QList<QInputMethodEvent::Attribute> attributes;
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection,
- start,
- end - start,
- QVariant()));
-
- QInputMethodEvent event(QString(), attributes);
- sendInputMethodEvent(&event);
- return JNI_TRUE;
-}
-
-jboolean QAndroidInputContext::selectAll()
-{
-#warning TODO
- return JNI_FALSE;
-}
-
-jboolean QAndroidInputContext::cut()
-{
-#warning TODO
- return JNI_FALSE;
-}
-
-jboolean QAndroidInputContext::copy()
-{
-#warning TODO
- return JNI_FALSE;
-}
-
-jboolean QAndroidInputContext::copyURL()
-{
-#warning TODO
- return JNI_FALSE;
-}
-
-jboolean QAndroidInputContext::paste()
-{
-#warning TODO
- return JNI_FALSE;
-}
-
-QSharedPointer<QInputMethodQueryEvent> QAndroidInputContext::focusObjectInputMethodQuery(Qt::InputMethodQueries queries)
-{
-#warning TODO make qGuiApp->focusObject() thread safe !!!
- QObject *focusObject = qGuiApp->focusObject();
- if (!focusObject)
- return QSharedPointer<QInputMethodQueryEvent>();
-
- QSharedPointer<QInputMethodQueryEvent> ret = QSharedPointer<QInputMethodQueryEvent>(new QInputMethodQueryEvent(queries));
- if (qGuiApp->thread()==QThread::currentThread()) {
- QCoreApplication::sendEvent(focusObject, ret.data());
- } else {
- QMetaObject::invokeMethod(this,
- "sendEvent",
- Qt::BlockingQueuedConnection,
- Q_ARG(QObject*, focusObject),
- Q_ARG(QInputMethodQueryEvent*, ret.data()));
- }
-
- return ret;
-}
-
-void QAndroidInputContext::sendInputMethodEvent(QInputMethodEvent *event)
-{
-#warning TODO make qGuiApp->focusObject() thread safe !!!
- QObject *focusObject = qGuiApp->focusObject();
- if (!focusObject)
- return;
-
- if (qGuiApp->thread() == QThread::currentThread()) {
- QCoreApplication::sendEvent(focusObject, event);
- } else {
- QMetaObject::invokeMethod(this,
- "sendEvent",
- Qt::BlockingQueuedConnection,
- Q_ARG(QObject*, focusObject),
- Q_ARG(QInputMethodEvent*, event));
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/src/qandroidinputcontext.h b/src/plugins/platforms/android/src/qandroidinputcontext.h
deleted file mode 100644
index 041bd0dc49..0000000000
--- a/src/plugins/platforms/android/src/qandroidinputcontext.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDINPUTCONTEXT_H
-#define ANDROIDINPUTCONTEXT_H
-
-#include <qpa/qplatforminputcontext.h>
-#include <jni.h>
-#include <qevent.h>
-
-QT_BEGIN_NAMESPACE
-
-class QAndroidInputContext: public QPlatformInputContext
-{
- Q_OBJECT
- enum CapsMode
- {
- CAP_MODE_CHARACTERS = 0x00001000,
- CAP_MODE_SENTENCES = 0x00004000,
- CAP_MODE_WORDS = 0x00002000
- };
-
-public:
- struct ExtractedText
- {
- ExtractedText() { clear(); }
-
- void clear()
- {
- partialEndOffset = partialStartOffset = selectionEnd = selectionStart = startOffset = -1;
- text.clear();
- }
-
- int partialEndOffset;
- int partialStartOffset;
- int selectionEnd;
- int selectionStart;
- int startOffset;
- QString text;
- };
-
-public:
- QAndroidInputContext();
- ~QAndroidInputContext();
- static QAndroidInputContext * androidInputContext();
- bool isValid() const { return true; }
-
- void reset();
- void commit();
- void update(Qt::InputMethodQueries queries);
- void invokeAction(QInputMethod::Action action, int cursorPosition);
- QRectF keyboardRect() const;
- bool isAnimating() const;
- void showInputPanel();
- void hideInputPanel();
- bool isInputPanelVisible() const;
-
- bool isComposing() const;
- void clear();
-
- //---------------//
- jboolean commitText(const QString &text, jint newCursorPosition);
- jboolean deleteSurroundingText(jint leftLength, jint rightLength);
- jboolean finishComposingText();
- jint getCursorCapsMode(jint reqModes);
- const ExtractedText &getExtractedText(jint hintMaxChars, jint hintMaxLines, jint flags);
- QString getSelectedText(jint flags);
- QString getTextAfterCursor(jint length, jint flags);
- QString getTextBeforeCursor(jint length, jint flags);
- jboolean setComposingText(const QString &text, jint newCursorPosition);
- jboolean setComposingRegion(jint start, jint end);
- jboolean setSelection(jint start, jint end);
- jboolean selectAll();
- jboolean cut();
- jboolean copy();
- jboolean copyURL();
- jboolean paste();
-
-private:
- QSharedPointer<QInputMethodQueryEvent> focusObjectInputMethodQuery(Qt::InputMethodQueries queries = Qt::ImQueryAll);
- void sendInputMethodEvent(QInputMethodEvent *event);
-
-private slots:
- virtual void sendEvent(QObject *receiver, QInputMethodEvent *event);
- virtual void sendEvent(QObject *receiver, QInputMethodQueryEvent *event);
- void updateCursorPosition();
-
-private:
- ExtractedText m_extractedText;
- QString m_composingText;
- QMetaObject::Connection m_updateCursorPosConnection;
- bool m_blockUpdateSelection;
-};
-
-QT_END_NAMESPACE
-
-#endif // ANDROIDINPUTCONTEXT_H
diff --git a/src/plugins/platforms/android/src/qandroidplatformaccessibility.cpp b/src/plugins/platforms/android/src/qandroidplatformaccessibility.cpp
deleted file mode 100644
index 229368345b..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformaccessibility.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include "qandroidplatformaccessibility.h"
-
-QT_BEGIN_NAMESPACE
-
-QAndroidPlatformAccessibility::QAndroidPlatformAccessibility()
-{}
-
-QAndroidPlatformAccessibility::~QAndroidPlatformAccessibility()
-{}
-
-void QAndroidPlatformAccessibility::notifyAccessibilityUpdate(QAccessibleEvent */*event*/)
-{
- // FIXME send events
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/src/qandroidplatformaccessibility.h b/src/plugins/platforms/android/src/qandroidplatformaccessibility.h
deleted file mode 100644
index 1b87f11919..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformaccessibility.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QANDROIDPLATFORMACCESSIBILITY_H
-#define QANDROIDPLATFORMACCESSIBILITY_H
-
-#include <qpa/qplatformaccessibility.h>
-
-QT_BEGIN_NAMESPACE
-
-class QAndroidPlatformAccessibility: public QPlatformAccessibility
-{
-public:
- QAndroidPlatformAccessibility();
- ~QAndroidPlatformAccessibility();
-
- virtual void notifyAccessibilityUpdate(QAccessibleEvent *event);
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/platforms/android/src/qandroidplatformclipboard.cpp b/src/plugins/platforms/android/src/qandroidplatformclipboard.cpp
deleted file mode 100644
index bc48b4935b..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformclipboard.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidplatformclipboard.h"
-#include "androidjniclipboard.h"
-#ifndef QT_NO_CLIPBOARD
-#include <QMimeData>
-
-QT_BEGIN_NAMESPACE
-
-QAndroidPlatformClipboard::QAndroidPlatformClipboard()
-{
- QtAndroidClipboard::setClipboardListener(this);
-}
-
-QMimeData *QAndroidPlatformClipboard::mimeData(QClipboard::Mode mode)
-{
- if (QClipboard::Clipboard != mode || !QtAndroidClipboard::hasClipboardText())
- return 0;
-
- QMimeData *mimeData = new QMimeData();
- mimeData->setText(QtAndroidClipboard::clipboardText());
- return mimeData;
-}
-
-void QAndroidPlatformClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
-{
- if (!data || !data->hasText() || QClipboard::Clipboard != mode)
- return;
-
- QtAndroidClipboard::setClipboardText(data->text());
-}
-
-bool QAndroidPlatformClipboard::supportsMode(QClipboard::Mode mode) const
-{
- return QClipboard::Clipboard == mode;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_CLIPBOARD
diff --git a/src/plugins/platforms/android/src/qandroidplatformclipboard.h b/src/plugins/platforms/android/src/qandroidplatformclipboard.h
deleted file mode 100644
index 644f326934..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformclipboard.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDPLATFORMCLIPBOARD_H
-#define QANDROIDPLATFORMCLIPBOARD_H
-
-#include <qpa/qplatformclipboard.h>
-
-#ifndef QT_NO_CLIPBOARD
-QT_BEGIN_NAMESPACE
-
-class QAndroidPlatformClipboard: public QPlatformClipboard
-{
-public:
- QAndroidPlatformClipboard();
-
- virtual QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard);
- virtual void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard);
- virtual bool supportsMode(QClipboard::Mode mode) const;
-};
-
-QT_END_NAMESPACE
-#endif // QT_NO_CLIPBOARD
-
-#endif // QANDROIDPLATFORMCLIPBOARD_H
diff --git a/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp
deleted file mode 100644
index 4c91e76e0f..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets/QApplication>
-#include <QtWidgets/QStyle>
-#include "qandroidplatformdialoghelpers.h"
-#include "androidjnimain.h"
-
-namespace QtAndroidDialogHelpers {
-static jclass g_messageDialogHelperClass = 0;
-
-QAndroidPlatformMessageDialogHelper::QAndroidPlatformMessageDialogHelper()
- :m_buttonId(-1)
- ,m_javaMessageDialog(g_messageDialogHelperClass, "(Landroid/app/Activity;)V", QtAndroid::activity())
- ,m_shown(false)
-{
-}
-
-void QAndroidPlatformMessageDialogHelper::exec()
-{
- if (!m_shown)
- show(Qt::Dialog, Qt::ApplicationModal, 0);
- m_loop.exec();
-}
-
-static QString standardButtonText(int sbutton)
-{
- switch (sbutton) {
- case QMessageDialogOptions::Ok:
- return QAndroidPlatformMessageDialogHelper::tr("OK");
- case QMessageDialogOptions::Save:
- return QAndroidPlatformMessageDialogHelper::tr("Save");
- case QMessageDialogOptions::Open:
- return QAndroidPlatformMessageDialogHelper::tr("Open");
- case QMessageDialogOptions::Cancel:
- return QAndroidPlatformMessageDialogHelper::tr("Cancel");
- case QMessageDialogOptions::Close:
- return QAndroidPlatformMessageDialogHelper::tr("Close");
- case QMessageDialogOptions::Apply:
- return QAndroidPlatformMessageDialogHelper::tr("Apply");
- case QMessageDialogOptions::Reset:
- return QAndroidPlatformMessageDialogHelper::tr("Reset");
- case QMessageDialogOptions::Help:
- return QAndroidPlatformMessageDialogHelper::tr("Help");
- case QMessageDialogOptions::Discard:
- return QAndroidPlatformMessageDialogHelper::tr("Discard");
- case QMessageDialogOptions::Yes:
- return QAndroidPlatformMessageDialogHelper::tr("Yes");
- case QMessageDialogOptions::YesToAll:
- return QAndroidPlatformMessageDialogHelper::tr("Yes to All");
- case QMessageDialogOptions::No:
- return QAndroidPlatformMessageDialogHelper::tr("No");
- case QMessageDialogOptions::NoToAll:
- return QAndroidPlatformMessageDialogHelper::tr("No to All");
- case QMessageDialogOptions::SaveAll:
- return QAndroidPlatformMessageDialogHelper::tr("Save All");
- case QMessageDialogOptions::Abort:
- return QAndroidPlatformMessageDialogHelper::tr("Abort");
- case QMessageDialogOptions::Retry:
- return QAndroidPlatformMessageDialogHelper::tr("Retry");
- case QMessageDialogOptions::Ignore:
- return QAndroidPlatformMessageDialogHelper::tr("Ignore");
- case QMessageDialogOptions::RestoreDefaults:
- return QAndroidPlatformMessageDialogHelper::tr("Restore Defaults");
- } // switch
- return QString();
-}
-
-bool QAndroidPlatformMessageDialogHelper::show(Qt::WindowFlags windowFlags
- , Qt::WindowModality windowModality
- , QWindow *parent)
-{
- Q_UNUSED(windowFlags)
- Q_UNUSED(windowModality)
- Q_UNUSED(parent)
- QSharedPointer<QMessageDialogOptions> opt = options();
- if (!opt.data())
- return false;
-
- m_javaMessageDialog.callMethod<void>("setIcon", "(I)V", opt->icon());
-
- QString str = opt->windowTitle();
- if (!str.isEmpty())
- m_javaMessageDialog.callMethod<void>("setTile", "(Ljava/lang/String;)V", QJNIObjectPrivate::fromString(str).object());
-
- str = opt->text();
- if (!str.isEmpty())
- m_javaMessageDialog.callMethod<void>("setText", "(Ljava/lang/String;)V", QJNIObjectPrivate::fromString(str).object());
-
- str = opt->informativeText();
- if (!str.isEmpty())
- m_javaMessageDialog.callMethod<void>("setInformativeText", "(Ljava/lang/String;)V", QJNIObjectPrivate::fromString(str).object());
-
- str = opt->detailedText();
- if (!str.isEmpty())
- m_javaMessageDialog.callMethod<void>("setDetailedText", "(Ljava/lang/String;)V", QJNIObjectPrivate::fromString(str).object());
-
- for (int i = QMessageDialogOptions::FirstButton; i < QMessageDialogOptions::LastButton; i<<=1) {
- if ( opt->standardButtons() & i )
- m_javaMessageDialog.callMethod<void>("addButton", "(ILjava/lang/String;)V", i, QJNIObjectPrivate::fromString(standardButtonText(i)).object());
- }
-
- m_javaMessageDialog.callMethod<void>("show", "(J)V", jlong(static_cast<QObject*>(this)));
- m_shown = true;
- return true;
-}
-
-void QAndroidPlatformMessageDialogHelper::hide()
-{
- m_javaMessageDialog.callMethod<void>("hide", "()V");
- m_shown = false;
-}
-
-void QAndroidPlatformMessageDialogHelper::dialogResult(int buttonID)
-{
- m_buttonId = buttonID;
- if (m_loop.isRunning())
- m_loop.exit();
- if (m_buttonId < 0) {
- emit reject();
- return;
- }
-
- QMessageDialogOptions::StandardButton standardButton = static_cast<QMessageDialogOptions::StandardButton>(buttonID);
- QMessageDialogOptions::ButtonRole role = QMessageDialogOptions::buttonRole(standardButton);
- emit clicked(standardButton, role);
-}
-
-static void dialogResult(JNIEnv * /*env*/, jobject /*thiz*/, jlong handler, int buttonID)
-{
- QObject *object = reinterpret_cast<QObject *>(handler);
- QMetaObject::invokeMethod(object, "dialogResult", Qt::QueuedConnection, Q_ARG(int, buttonID));
-}
-
-static JNINativeMethod methods[] = {
- {"dialogResult", "(JI)V", (void *)dialogResult}
-};
-
-
-#define FIND_AND_CHECK_CLASS(CLASS_NAME) \
- clazz = env->FindClass(CLASS_NAME); \
- if (!clazz) { \
- __android_log_print(ANDROID_LOG_FATAL, QtAndroid::qtTagText(), QtAndroid::classErrorMsgFmt(), CLASS_NAME); \
- return false; \
- }
-
-bool registerNatives(JNIEnv *env)
-{
- jclass clazz = QtAndroid::findClass("org.qtproject.qt5.android.QtMessageDialogHelper", env);
- if (!clazz) {
- __android_log_print(ANDROID_LOG_FATAL, QtAndroid::qtTagText(), QtAndroid::classErrorMsgFmt()
- , "org/qtproject/qt5/android/QtMessageDialogHelper");
- return false;
- }
- g_messageDialogHelperClass = static_cast<jclass>(env->NewGlobalRef(clazz));
- FIND_AND_CHECK_CLASS("org/qtproject/qt5/android/QtNativeDialogHelper");
- jclass appClass = static_cast<jclass>(env->NewGlobalRef(clazz));
-
- if (env->RegisterNatives(appClass, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
- __android_log_print(ANDROID_LOG_FATAL, "Qt", "RegisterNatives failed");
- return false;
- }
-
- return true;
-}
-}
diff --git a/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.h b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.h
deleted file mode 100644
index 88ec91d936..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDPLATFORMDIALOGHELPERS_H
-#define QANDROIDPLATFORMDIALOGHELPERS_H
-#include <jni.h>
-#include <qpa/qplatformdialoghelper.h>
-#include <QEventLoop>
-#include <private/qjni_p.h>
-
-namespace QtAndroidDialogHelpers {
-
-class QAndroidPlatformMessageDialogHelper: public QPlatformMessageDialogHelper
-{
- Q_OBJECT
-public:
- QAndroidPlatformMessageDialogHelper();
- void exec();
- bool show(Qt::WindowFlags windowFlags,
- Qt::WindowModality windowModality,
- QWindow *parent);
- void hide();
-
-public slots:
- void dialogResult(int buttonID);
-
-private:
- int m_buttonId;
- QEventLoop m_loop;
- QJNIObjectPrivate m_javaMessageDialog;
- bool m_shown;
-};
-
-
-bool registerNatives(JNIEnv *env);
-
-}
-
-#endif // QANDROIDPLATFORMDIALOGHELPERS_H
diff --git a/src/plugins/platforms/android/src/qandroidplatformfontdatabase.cpp b/src/plugins/platforms/android/src/qandroidplatformfontdatabase.cpp
deleted file mode 100644
index 7f68b44ed8..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformfontdatabase.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QDir>
-
-#include "qandroidplatformfontdatabase.h"
-
-QString QAndroidPlatformFontDatabase::fontDir() const
-{
- return QLatin1String("/system/fonts");
-}
-
-void QAndroidPlatformFontDatabase::populateFontDatabase()
-{
- QString fontpath = fontDir();
-
- if (!QFile::exists(fontpath)) {
- qFatal("QFontDatabase: Cannot find font directory %s - is Qt installed correctly?",
- qPrintable(fontpath));
- }
-
- QDir dir(fontpath, QLatin1String("*.ttf"));
- for (int i = 0; i < int(dir.count()); ++i) {
- const QByteArray file = QFile::encodeName(dir.absoluteFilePath(dir[i]));
- addTTFile(QByteArray(), file);
- }
-}
-
-QStringList QAndroidPlatformFontDatabase::fallbacksForFamily(const QString &family,
- QFont::Style style,
- QFont::StyleHint styleHint,
- QChar::Script script) const
-{
- Q_UNUSED(family);
- Q_UNUSED(style);
- Q_UNUSED(script);
- if (styleHint == QFont::Monospace)
- return QString(qgetenv("QT_ANDROID_FONTS_MONOSPACE")).split(";");
-
- return QString(qgetenv("QT_ANDROID_FONTS")).split(";");
-}
diff --git a/src/plugins/platforms/android/src/qandroidplatformfontdatabase.h b/src/plugins/platforms/android/src/qandroidplatformfontdatabase.h
deleted file mode 100644
index 3cbfe95d36..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformfontdatabase.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDPLATFORMFONTDATABASE_H
-#define QANDROIDPLATFORMFONTDATABASE_H
-
-#include <QtPlatformSupport/private/qbasicfontdatabase_p.h>
-
-class QAndroidPlatformFontDatabase: public QBasicFontDatabase
-{
-public:
- QString fontDir() const;
- void populateFontDatabase();
- QStringList fallbacksForFamily(const QString &family,
- QFont::Style style,
- QFont::StyleHint styleHint,
- QChar::Script script) const;
-};
-
-#endif // QANDROIDPLATFORMFONTDATABASE_H
diff --git a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp
deleted file mode 100644
index ae3e257d3c..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp
+++ /dev/null
@@ -1,343 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidplatformintegration.h"
-#include "qabstracteventdispatcher.h"
-#include "androidjnimain.h"
-#include <QtGui/qguiapplication.h>
-#include <qpa/qwindowsysteminterface.h>
-#include <QThread>
-#include <qpa/qplatformwindow.h>
-#include "qandroidplatformservices.h"
-#include "qandroidplatformfontdatabase.h"
-#include "qandroidplatformclipboard.h"
-#include "qandroidplatformaccessibility.h"
-#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
-
-#ifndef ANDROID_PLUGIN_OPENGL
-# include "qandroidplatformscreen.h"
-# include "qandroidplatformwindow.h"
-# include <QtPlatformSupport/private/qfbbackingstore_p.h>
-#else
-# include "qeglfswindow.h"
-# include "androidjnimenu.h"
-# include "qandroidopenglcontext.h"
-# include "qandroidopenglplatformwindow.h"
-# include "qandroidopenglplatformscreen.h"
-# include "qeglfshooks.h"
-# include <QtGui/qopenglcontext.h>
-#endif
-
-#include "qandroidplatformtheme.h"
-#include "qandroidsystemlocale.h"
-
-QT_BEGIN_NAMESPACE
-
-int QAndroidPlatformIntegration::m_defaultGeometryWidth = 320;
-int QAndroidPlatformIntegration::m_defaultGeometryHeight = 455;
-int QAndroidPlatformIntegration::m_defaultPhysicalSizeWidth = 50;
-int QAndroidPlatformIntegration::m_defaultPhysicalSizeHeight = 71;
-
-Qt::ScreenOrientation QAndroidPlatformIntegration::m_orientation = Qt::PrimaryOrientation;
-Qt::ScreenOrientation QAndroidPlatformIntegration::m_nativeOrientation = Qt::PrimaryOrientation;
-
-void *QAndroidPlatformNativeInterface::nativeResourceForIntegration(const QByteArray &resource)
-{
- if (resource=="JavaVM")
- return QtAndroid::javaVM();
- if (resource == "QtActivity")
- return QtAndroid::activity();
- if (resource == "AndroidStylePalettes")
- return &m_palettes;
- if (resource == "AndroidStyleFonts")
- return &m_fonts;
- return 0;
-}
-
-QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList &paramList)
- : m_touchDevice(0)
-#ifndef QT_NO_ACCESSIBILITY
- , m_accessibility(0)
-#endif
-{
- Q_UNUSED(paramList);
-
- m_androidPlatformNativeInterface = new QAndroidPlatformNativeInterface();
-
-#ifndef ANDROID_PLUGIN_OPENGL
- m_primaryScreen = new QAndroidPlatformScreen();
- screenAdded(m_primaryScreen);
- m_primaryScreen->setPhysicalSize(QSize(m_defaultPhysicalSizeWidth, m_defaultPhysicalSizeHeight));
- m_primaryScreen->setGeometry(QRect(0, 0, m_defaultGeometryWidth, m_defaultGeometryHeight));
-#endif
-
- m_mainThread = QThread::currentThread();
- QtAndroid::setAndroidPlatformIntegration(this);
-
- m_androidFDB = new QAndroidPlatformFontDatabase();
- m_androidPlatformServices = new QAndroidPlatformServices();
- m_androidPlatformClipboard = new QAndroidPlatformClipboard();
-
- m_androidSystemLocale = new QAndroidSystemLocale;
-}
-
-bool QAndroidPlatformIntegration::hasCapability(Capability cap) const
-{
- switch (cap) {
- case ThreadedPixmaps: return true;
- case ApplicationState: return true;
- case NativeWidgets: return false;
- default:
-#ifndef ANDROID_PLUGIN_OPENGL
- return QPlatformIntegration::hasCapability(cap);
-#else
- return QEglFSIntegration::hasCapability(cap);
-#endif
- }
-}
-
-#ifndef ANDROID_PLUGIN_OPENGL
-QPlatformBackingStore *QAndroidPlatformIntegration::createPlatformBackingStore(QWindow *window) const
-{
- return new QFbBackingStore(window);
-}
-
-QPlatformWindow *QAndroidPlatformIntegration::createPlatformWindow(QWindow *window) const
-{
- QAndroidPlatformWindow *platformWindow = new QAndroidPlatformWindow(window);
- platformWindow->setWindowState(window->windowState());
-
- return platformWindow;
-}
-
-QAbstractEventDispatcher *QAndroidPlatformIntegration::createEventDispatcher() const
-{
- return createUnixEventDispatcher();
-}
-#else // !ANDROID_PLUGIN_OPENGL
-QPlatformWindow *QAndroidPlatformIntegration::createPlatformWindow(QWindow *window) const
-{
- QAndroidOpenGLPlatformWindow *platformWindow = new QAndroidOpenGLPlatformWindow(window);
- platformWindow->create();
- platformWindow->requestActivateWindow();
- platformWindow->setWindowState(window->windowState());
- QtAndroidMenu::setActiveTopLevelWindow(window);
-
- return platformWindow;
-}
-
-void QAndroidPlatformIntegration::invalidateNativeSurface()
-{
- foreach (QWindow *w, QGuiApplication::topLevelWindows()) {
- QAndroidOpenGLPlatformWindow *window =
- static_cast<QAndroidOpenGLPlatformWindow *>(w->handle());
- if (window != 0)
- window->invalidateSurface();
- }
-}
-
-void QAndroidPlatformIntegration::surfaceChanged()
-{
- QAndroidOpenGLPlatformWindow::updateStaticNativeWindow();
- foreach (QWindow *w, QGuiApplication::topLevelWindows()) {
- QAndroidOpenGLPlatformWindow *window =
- static_cast<QAndroidOpenGLPlatformWindow *>(w->handle());
- if (window != 0)
- window->resetSurface();
- }
-}
-
-QPlatformOpenGLContext *QAndroidPlatformIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
-{
- return new QAndroidOpenGLContext(this,
- QEglFSHooks::hooks()->surfaceFormatFor(context->format()),
- context->shareHandle(),
- display());
-}
-#endif // ANDROID_PLUGIN_OPENGL
-
-QAndroidPlatformIntegration::~QAndroidPlatformIntegration()
-{
- delete m_androidPlatformNativeInterface;
- delete m_androidFDB;
- delete m_androidSystemLocale;
- QtAndroid::setAndroidPlatformIntegration(NULL);
-}
-QPlatformFontDatabase *QAndroidPlatformIntegration::fontDatabase() const
-{
- return m_androidFDB;
-}
-
-#ifndef QT_NO_CLIPBOARD
-QPlatformClipboard *QAndroidPlatformIntegration::clipboard() const
-{
-static QAndroidPlatformClipboard *clipboard = 0;
- if (!clipboard)
- clipboard = new QAndroidPlatformClipboard;
-
- return clipboard;
-}
-#endif
-
-QPlatformInputContext *QAndroidPlatformIntegration::inputContext() const
-{
- return &m_platformInputContext;
-}
-
-QPlatformNativeInterface *QAndroidPlatformIntegration::nativeInterface() const
-{
- return m_androidPlatformNativeInterface;
-}
-
-QPlatformServices *QAndroidPlatformIntegration::services() const
-{
- return m_androidPlatformServices;
-}
-
-QVariant QAndroidPlatformIntegration::styleHint(StyleHint hint) const
-{
- switch (hint) {
- case ShowIsMaximized:
- return true;
- default:
- return QPlatformIntegration::styleHint(hint);
- }
-}
-
-Qt::WindowState QAndroidPlatformIntegration::defaultWindowState(Qt::WindowFlags flags) const
-{
- // Don't maximize dialogs on Android
- if (flags & Qt::Dialog & ~Qt::Window)
- return Qt::WindowNoState;
-
- return QPlatformIntegration::defaultWindowState(flags);
-}
-
-static const QLatin1String androidThemeName("android");
-QStringList QAndroidPlatformIntegration::themeNames() const
-{
- return QStringList(QString(androidThemeName));
-}
-
-QPlatformTheme *QAndroidPlatformIntegration::createPlatformTheme(const QString &name) const
-{
- if (androidThemeName == name)
- return new QAndroidPlatformTheme(m_androidPlatformNativeInterface);
-
- return 0;
-}
-
-void QAndroidPlatformIntegration::setDefaultDisplayMetrics(int gw, int gh, int sw, int sh)
-{
- m_defaultGeometryWidth = gw;
- m_defaultGeometryHeight = gh;
- m_defaultPhysicalSizeWidth = sw;
- m_defaultPhysicalSizeHeight = sh;
-}
-
-void QAndroidPlatformIntegration::setDefaultDesktopSize(int gw, int gh)
-{
- m_defaultGeometryWidth = gw;
- m_defaultGeometryHeight = gh;
-}
-
-void QAndroidPlatformIntegration::setScreenOrientation(Qt::ScreenOrientation currentOrientation,
- Qt::ScreenOrientation nativeOrientation)
-{
- m_orientation = currentOrientation;
- m_nativeOrientation = nativeOrientation;
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-QPlatformAccessibility *QAndroidPlatformIntegration::accessibility() const
-{
- if (!m_accessibility)
- m_accessibility = new QAndroidPlatformAccessibility();
- return m_accessibility;
-}
-#endif
-
-
-#ifndef ANDROID_PLUGIN_OPENGL
-void QAndroidPlatformIntegration::setDesktopSize(int width, int height)
-{
- if (m_primaryScreen)
- QMetaObject::invokeMethod(m_primaryScreen, "setGeometry", Qt::AutoConnection, Q_ARG(QRect, QRect(0,0,width, height)));
-}
-
-void QAndroidPlatformIntegration::setDisplayMetrics(int width, int height)
-{
- if (m_primaryScreen)
- QMetaObject::invokeMethod(m_primaryScreen, "setPhysicalSize", Qt::AutoConnection, Q_ARG(QSize, QSize(width, height)));
-}
-#else
-void QAndroidPlatformIntegration::setDesktopSize(int width, int height)
-{
- m_defaultGeometryWidth = width;
- m_defaultGeometryHeight = height;
-}
-
-void QAndroidPlatformIntegration::setDisplayMetrics(int width, int height)
-{
- m_defaultPhysicalSizeWidth = width;
- m_defaultPhysicalSizeHeight = height;
-}
-
-QEglFSScreen *QAndroidPlatformIntegration::createScreen() const
-{
- return new QAndroidOpenGLPlatformScreen(display());
-}
-
-#endif
-
-void QAndroidPlatformIntegration::pauseApp()
-{
- if (QAbstractEventDispatcher::instance(m_mainThread))
- QAbstractEventDispatcher::instance(m_mainThread)->interrupt();
-}
-
-void QAndroidPlatformIntegration::resumeApp()
-{
- if (QAbstractEventDispatcher::instance(m_mainThread))
- QAbstractEventDispatcher::instance(m_mainThread)->wakeUp();
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/src/qandroidplatformintegration.h b/src/plugins/platforms/android/src/qandroidplatformintegration.h
deleted file mode 100644
index bd08ad694c..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformintegration.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDPLATFORMINTERATION_H
-#define QANDROIDPLATFORMINTERATION_H
-
-#include <qpa/qplatformintegration.h>
-#include <qpa/qplatformmenu.h>
-#include <qpa/qplatformnativeinterface.h>
-#include <QtWidgets/QAction>
-
-#include <jni.h>
-#include "qandroidinputcontext.h"
-
-#ifndef ANDROID_PLUGIN_OPENGL
-# include "qandroidplatformscreen.h"
-#else
-# include "qeglfsintegration.h"
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class QDesktopWidget;
-class QAndroidPlatformServices;
-class QAndroidSystemLocale;
-class QPlatformAccessibility;
-
-#ifdef ANDROID_PLUGIN_OPENGL
-class QAndroidOpenGLPlatformWindow;
-#endif
-
-class QAndroidPlatformNativeInterface: public QPlatformNativeInterface
-{
-public:
- void *nativeResourceForIntegration(const QByteArray &resource);
- QHash<int, QPalette> m_palettes;
- QHash<int, QFont> m_fonts;
-};
-
-class QAndroidPlatformIntegration
-#ifndef ANDROID_PLUGIN_OPENGL
- : public QPlatformIntegration
-#else
- : public QEglFSIntegration
-#endif
-{
- friend class QAndroidPlatformScreen;
-
-public:
- QAndroidPlatformIntegration(const QStringList &paramList);
- ~QAndroidPlatformIntegration();
-
- bool hasCapability(QPlatformIntegration::Capability cap) const;
-
-#ifndef ANDROID_PLUGIN_OPENGL
- QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
- QPlatformWindow *createPlatformWindow(QWindow *window) const;
- QAbstractEventDispatcher *createEventDispatcher() const;
- QAndroidPlatformScreen *screen() { return m_primaryScreen; }
-#else
- QPlatformWindow *createPlatformWindow(QWindow *window) const;
- void invalidateNativeSurface();
- void surfaceChanged();
- QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
-#endif
-
- virtual void setDesktopSize(int width, int height);
- virtual void setDisplayMetrics(int width, int height);
- bool isVirtualDesktop() { return true; }
-
- QPlatformFontDatabase *fontDatabase() const;
-
-#ifndef QT_NO_CLIPBOARD
- QPlatformClipboard *clipboard() const;
-#endif
-
- QPlatformInputContext *inputContext() const;
- QPlatformNativeInterface *nativeInterface() const;
- QPlatformServices *services() const;
-
-#ifndef QT_NO_ACCESSIBILITY
- virtual QPlatformAccessibility *accessibility() const;
-#endif
-
- QVariant styleHint(StyleHint hint) const;
- Qt::WindowState defaultWindowState(Qt::WindowFlags flags) const Q_DECL_OVERRIDE;
-
- QStringList themeNames() const;
- QPlatformTheme *createPlatformTheme(const QString &name) const;
-
- void pauseApp();
- void resumeApp();
- static void setDefaultDisplayMetrics(int gw, int gh, int sw, int sh);
- static void setDefaultDesktopSize(int gw, int gh);
- static void setScreenOrientation(Qt::ScreenOrientation currentOrientation,
- Qt::ScreenOrientation nativeOrientation);
-
- static QSize defaultDesktopSize()
- {
- return QSize(m_defaultGeometryWidth, m_defaultGeometryHeight);
- }
-
- QTouchDevice *touchDevice() const { return m_touchDevice; }
- void setTouchDevice(QTouchDevice *touchDevice) { m_touchDevice = touchDevice; }
-
-#ifdef ANDROID_PLUGIN_OPENGL
- QEglFSScreen *createScreen() const;
-#endif
-
-private:
-
- friend class QEglFSAndroidHooks;
-
- QTouchDevice *m_touchDevice;
-
-#ifndef ANDROID_PLUGIN_OPENGL
- QAndroidPlatformScreen *m_primaryScreen;
-#endif
-
- QThread *m_mainThread;
-
- static int m_defaultGeometryWidth;
- static int m_defaultGeometryHeight;
- static int m_defaultPhysicalSizeWidth;
- static int m_defaultPhysicalSizeHeight;
-
- static Qt::ScreenOrientation m_orientation;
- static Qt::ScreenOrientation m_nativeOrientation;
-
- QPlatformFontDatabase *m_androidFDB;
- QImage *m_FbScreenImage;
- QPainter *m_compositePainter;
- QAndroidPlatformNativeInterface *m_androidPlatformNativeInterface;
- QAndroidPlatformServices *m_androidPlatformServices;
- QPlatformClipboard *m_androidPlatformClipboard;
- QAndroidSystemLocale *m_androidSystemLocale;
-#ifndef QT_NO_ACCESSIBILITY
- mutable QPlatformAccessibility *m_accessibility;
-#endif
-
- mutable QAndroidInputContext m_platformInputContext;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/platforms/android/src/qandroidplatformmenu.cpp b/src/plugins/platforms/android/src/qandroidplatformmenu.cpp
deleted file mode 100644
index 1ecabb25e2..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformmenu.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidplatformmenu.h"
-#include "qandroidplatformmenuitem.h"
-#include "androidjnimenu.h"
-
-QAndroidPlatformMenu::QAndroidPlatformMenu()
-{
- m_tag = reinterpret_cast<quintptr>(this); // QMenu will overwrite this later, but we need a unique ID for QtQuick
- m_enabled = true;
- m_isVisible = true;
-}
-
-QAndroidPlatformMenu::~QAndroidPlatformMenu()
-{
- QtAndroidMenu::androidPlatformMenuDestroyed(this);
-}
-
-void QAndroidPlatformMenu::insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before)
-{
- QMutexLocker lock(&m_menuItemsMutex);
- m_menuItems.insert(qFind(m_menuItems.begin(),
- m_menuItems.end(),
- static_cast<QAndroidPlatformMenuItem *>(before)),
- static_cast<QAndroidPlatformMenuItem *>(menuItem));
-}
-
-void QAndroidPlatformMenu::removeMenuItem(QPlatformMenuItem *menuItem)
-{
- QMutexLocker lock(&m_menuItemsMutex);
- PlatformMenuItemsType::iterator it = qFind(m_menuItems.begin(),
- m_menuItems.end(),
- static_cast<QAndroidPlatformMenuItem *>(menuItem));
- if (it != m_menuItems.end())
- m_menuItems.erase(it);
-}
-
-void QAndroidPlatformMenu::syncMenuItem(QPlatformMenuItem *menuItem)
-{
- PlatformMenuItemsType::iterator it;
- for (it = m_menuItems.begin(); it != m_menuItems.end(); ++it) {
- if ((*it)->tag() == menuItem->tag())
- break;
- }
-
- if (it != m_menuItems.end())
- QtAndroidMenu::syncMenu(this);
-}
-
-void QAndroidPlatformMenu::syncSeparatorsCollapsible(bool enable)
-{
- Q_UNUSED(enable)
-}
-
-void QAndroidPlatformMenu::setTag(quintptr tag)
-{
- m_tag = tag;
-}
-
-quintptr QAndroidPlatformMenu::tag() const
-{
- return m_tag;
-}
-
-void QAndroidPlatformMenu::setText(const QString &text)
-{
- m_text = text;
-}
-
-QString QAndroidPlatformMenu::text() const
-{
- return m_text;
-}
-
-void QAndroidPlatformMenu::setIcon(const QIcon &icon)
-{
- m_icon = icon;
-}
-
-QIcon QAndroidPlatformMenu::icon() const
-{
- return m_icon;
-}
-
-void QAndroidPlatformMenu::setEnabled(bool enabled)
-{
- m_enabled = enabled;
-}
-
-bool QAndroidPlatformMenu::isEnabled() const
-{
- return m_enabled;
-}
-
-void QAndroidPlatformMenu::setVisible(bool visible)
-{
- m_isVisible = visible;
-}
-
-bool QAndroidPlatformMenu::isVisible() const
-{
- return m_isVisible;
-}
-
-void QAndroidPlatformMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatformMenuItem *item)
-{
- Q_UNUSED(parentWindow);
- Q_UNUSED(pos);
- Q_UNUSED(item);
- setVisible(true);
- QtAndroidMenu::showContextMenu(this);
-}
-
-QPlatformMenuItem *QAndroidPlatformMenu::menuItemAt(int position) const
-{
- if (position < m_menuItems.size())
- return m_menuItems[position];
- return 0;
-}
-
-QPlatformMenuItem *QAndroidPlatformMenu::menuItemForTag(quintptr tag) const
-{
- foreach (QPlatformMenuItem *menuItem, m_menuItems) {
- if (menuItem->tag() == tag)
- return menuItem;
- }
- return 0;
-}
-
-QAndroidPlatformMenu::PlatformMenuItemsType QAndroidPlatformMenu::menuItems() const
-{
- return m_menuItems;
-}
-
-QMutex *QAndroidPlatformMenu::menuItemsMutex()
-{
- return &m_menuItemsMutex;
-}
diff --git a/src/plugins/platforms/android/src/qandroidplatformmenu.h b/src/plugins/platforms/android/src/qandroidplatformmenu.h
deleted file mode 100644
index 305b64168a..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformmenu.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDPLATFORMMENU_H
-#define QANDROIDPLATFORMMENU_H
-
-#include <qpa/qplatformmenu.h>
-#include <qvector.h>
-#include <qmutex.h>
-
-class QAndroidPlatformMenuItem;
-class QAndroidPlatformMenu: public QPlatformMenu
-{
-public:
- typedef QVector<QAndroidPlatformMenuItem *> PlatformMenuItemsType;
-
-public:
- QAndroidPlatformMenu();
- ~QAndroidPlatformMenu();
-
- void insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before);
- void removeMenuItem(QPlatformMenuItem *menuItem);
- void syncMenuItem(QPlatformMenuItem *menuItem);
- void syncSeparatorsCollapsible(bool enable);
-
- void setTag(quintptr tag);
- quintptr tag() const;
- void setText(const QString &text);
- QString text() const;
- void setIcon(const QIcon &icon);
- QIcon icon() const;
- void setEnabled(bool enabled);
- bool isEnabled() const;
- void setVisible(bool visible);
- bool isVisible() const;
- void showPopup(const QWindow *parentWindow, QPoint pos, const QPlatformMenuItem *item);
-
- QPlatformMenuItem *menuItemAt(int position) const;
- QPlatformMenuItem *menuItemForTag(quintptr tag) const;
-
- PlatformMenuItemsType menuItems() const;
- QMutex *menuItemsMutex();
-
-private:
- PlatformMenuItemsType m_menuItems;
- quintptr m_tag;
- QString m_text;
- QIcon m_icon;
- bool m_enabled;
- bool m_isVisible;
- QMutex m_menuItemsMutex;
-};
-
-#endif // QANDROIDPLATFORMMENU_H
diff --git a/src/plugins/platforms/android/src/qandroidplatformmenubar.cpp b/src/plugins/platforms/android/src/qandroidplatformmenubar.cpp
deleted file mode 100644
index 134062fb32..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformmenubar.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidplatformmenubar.h"
-#include "qandroidplatformmenu.h"
-#include "androidjnimenu.h"
-
-
-QAndroidPlatformMenuBar::QAndroidPlatformMenuBar()
-{
- m_parentWindow = 0;
- QtAndroidMenu::addMenuBar(this);
-}
-
-QAndroidPlatformMenuBar::~QAndroidPlatformMenuBar()
-{
- QtAndroidMenu::removeMenuBar(this);
-}
-
-void QAndroidPlatformMenuBar::insertMenu(QPlatformMenu *menu, QPlatformMenu *before)
-{
- QMutexLocker lock(&m_menusListMutex);
- m_menus.insert(qFind(m_menus.begin(),
- m_menus.end(),
- static_cast<QAndroidPlatformMenu *>(before)),
- static_cast<QAndroidPlatformMenu *>(menu));
-}
-
-void QAndroidPlatformMenuBar::removeMenu(QPlatformMenu *menu)
-{
- QMutexLocker lock(&m_menusListMutex);
- m_menus.erase(qFind(m_menus.begin(),
- m_menus.end(),
- static_cast<QAndroidPlatformMenu *>(menu)));
-}
-
-void QAndroidPlatformMenuBar::syncMenu(QPlatformMenu *menu)
-{
- QtAndroidMenu::syncMenu(static_cast<QAndroidPlatformMenu *>(menu));
-}
-
-void QAndroidPlatformMenuBar::handleReparent(QWindow *newParentWindow)
-{
- if (m_parentWindow == newParentWindow)
- return;
- m_parentWindow = newParentWindow;
- QtAndroidMenu::setMenuBar(this, newParentWindow);
-}
-
-QPlatformMenu *QAndroidPlatformMenuBar::menuForTag(quintptr tag) const
-{
- foreach (QPlatformMenu *menu, m_menus) {
- if (menu->tag() == tag)
- return menu;
- }
-
- return 0;
-}
-
-QWindow *QAndroidPlatformMenuBar::parentWindow() const
-{
- return m_parentWindow;
-}
-
-QAndroidPlatformMenuBar::PlatformMenusType QAndroidPlatformMenuBar::menus() const
-{
- return m_menus;
-}
-
-QMutex *QAndroidPlatformMenuBar::menusListMutex()
-{
- return &m_menusListMutex;
-}
diff --git a/src/plugins/platforms/android/src/qandroidplatformmenubar.h b/src/plugins/platforms/android/src/qandroidplatformmenubar.h
deleted file mode 100644
index 56915335c2..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformmenubar.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDPLATFORMMENUBAR_H
-#define QANDROIDPLATFORMMENUBAR_H
-
-#include <qpa/qplatformmenu.h>
-#include <qvector.h>
-#include <qmutex.h>
-
-class QAndroidPlatformMenu;
-class QAndroidPlatformMenuBar: public QPlatformMenuBar
-{
-public:
- typedef QVector<QAndroidPlatformMenu *> PlatformMenusType;
-public:
- QAndroidPlatformMenuBar();
- ~QAndroidPlatformMenuBar();
-
- void insertMenu(QPlatformMenu *menu, QPlatformMenu *before);
- void removeMenu(QPlatformMenu *menu);
- void syncMenu(QPlatformMenu *menu);
- void handleReparent(QWindow *newParentWindow);
- QPlatformMenu *menuForTag(quintptr tag) const;
-
- QWindow *parentWindow() const;
- PlatformMenusType menus() const;
- QMutex *menusListMutex();
-
-private:
- PlatformMenusType m_menus;
- QWindow *m_parentWindow;
- QMutex m_menusListMutex;
-};
-
-#endif // QANDROIDPLATFORMMENUBAR_H
diff --git a/src/plugins/platforms/android/src/qandroidplatformmenuitem.cpp b/src/plugins/platforms/android/src/qandroidplatformmenuitem.cpp
deleted file mode 100644
index bd37834d2a..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformmenuitem.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidplatformmenuitem.h"
-#include "qandroidplatformmenu.h"
-
-QAndroidPlatformMenuItem::QAndroidPlatformMenuItem()
-{
- m_tag = reinterpret_cast<quintptr>(this); // QMenu will overwrite this later, but we need a unique ID for QtQuick
- m_menu = 0;
- m_isVisible = true;
- m_isSeparator = false;
- m_role = NoRole;
- m_isCheckable = false;
- m_isChecked = false;
- m_isEnabled = true;
-}
-
-void QAndroidPlatformMenuItem::setTag(quintptr tag)
-{
- m_tag = tag;
-}
-
-quintptr QAndroidPlatformMenuItem::tag() const
-{
- return m_tag;
-}
-
-void QAndroidPlatformMenuItem::setText(const QString &text)
-{
- m_text = text;
- if (m_menu)
- m_menu->setText(m_text);
-}
-
-QString QAndroidPlatformMenuItem::text() const
-{
- return m_text;
-}
-
-void QAndroidPlatformMenuItem::setIcon(const QIcon &icon)
-{
- m_icon = icon;
- if (m_menu)
- m_menu->setIcon(m_icon);
-}
-
-QIcon QAndroidPlatformMenuItem::icon() const
-{
- return m_icon;
-}
-
-void QAndroidPlatformMenuItem::setMenu(QPlatformMenu *menu)
-{
- m_menu = static_cast<QAndroidPlatformMenu *>(menu);
- if (!m_menu)
- return;
-
- m_menu->setText(m_text);
- m_menu->setIcon(m_icon);
- m_menu->setVisible(m_isVisible);
- m_menu->setEnabled(m_isEnabled);
-}
-
-QAndroidPlatformMenu *QAndroidPlatformMenuItem::menu() const
-{
- return m_menu;
-}
-
-void QAndroidPlatformMenuItem::setVisible(bool isVisible)
-{
- m_isVisible = isVisible;
- if (m_menu)
- m_menu->setVisible(m_isVisible);
-}
-
-bool QAndroidPlatformMenuItem::isVisible() const
-{
- return m_isVisible;
-}
-
-void QAndroidPlatformMenuItem::setIsSeparator(bool isSeparator)
-{
- m_isSeparator = isSeparator;
-}
-
-bool QAndroidPlatformMenuItem::isSeparator() const
-{
- return m_isSeparator;
-}
-
-void QAndroidPlatformMenuItem::setFont(const QFont &font)
-{
- Q_UNUSED(font)
-}
-
-void QAndroidPlatformMenuItem::setRole(QPlatformMenuItem::MenuRole role)
-{
- m_role = role;
-}
-
-QPlatformMenuItem::MenuRole QAndroidPlatformMenuItem::role() const
-{
- return m_role;
-}
-
-void QAndroidPlatformMenuItem::setCheckable(bool checkable)
-{
- m_isCheckable = checkable;
-}
-
-bool QAndroidPlatformMenuItem::isCheckable() const
-{
- return m_isCheckable;
-}
-
-void QAndroidPlatformMenuItem::setChecked(bool isChecked)
-{
- m_isChecked = isChecked;
-}
-
-bool QAndroidPlatformMenuItem::isChecked() const
-{
- return m_isChecked;
-}
-
-void QAndroidPlatformMenuItem::setShortcut(const QKeySequence &shortcut)
-{
- Q_UNUSED(shortcut)
-}
-
-void QAndroidPlatformMenuItem::setEnabled(bool enabled)
-{
- m_isEnabled = enabled;
- if (m_menu)
- m_menu->setEnabled(m_isEnabled);
-}
-
-bool QAndroidPlatformMenuItem::isEnabled() const
-{
- return m_isEnabled;
-}
diff --git a/src/plugins/platforms/android/src/qandroidplatformmenuitem.h b/src/plugins/platforms/android/src/qandroidplatformmenuitem.h
deleted file mode 100644
index 5861e8e195..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformmenuitem.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDPLATFORMMENUITEM_H
-#define QANDROIDPLATFORMMENUITEM_H
-#include <qpa/qplatformmenu.h>
-
-class QAndroidPlatformMenu;
-
-class QAndroidPlatformMenuItem: public QPlatformMenuItem
-{
-public:
- QAndroidPlatformMenuItem();
- void setTag(quintptr tag);
- quintptr tag() const;
-
- void setText(const QString &text);
- QString text() const;
-
- void setIcon(const QIcon &icon);
- QIcon icon() const;
-
- void setMenu(QPlatformMenu *menu);
- QAndroidPlatformMenu *menu() const;
-
- void setVisible(bool isVisible);
- bool isVisible() const;
-
- void setIsSeparator(bool isSeparator);
- bool isSeparator() const;
-
- void setFont(const QFont &font);
-
- void setRole(MenuRole role);
- MenuRole role() const;
-
- void setCheckable(bool checkable);
- bool isCheckable() const;
-
- void setChecked(bool isChecked);
- bool isChecked() const;
-
- void setShortcut(const QKeySequence &shortcut);
-
- void setEnabled(bool enabled);
- bool isEnabled() const;
-
-private:
- quintptr m_tag;
- QString m_text;
- QIcon m_icon;
- QAndroidPlatformMenu *m_menu;
- bool m_isVisible;
- bool m_isSeparator;
- MenuRole m_role;
- bool m_isCheckable;
- bool m_isChecked;
- bool m_isEnabled;
-};
-
-#endif // QANDROIDPLATFORMMENUITEM_H
diff --git a/src/plugins/platforms/android/src/qandroidplatformservices.cpp b/src/plugins/platforms/android/src/qandroidplatformservices.cpp
deleted file mode 100644
index 0df882f1f0..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformservices.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidplatformservices.h"
-#include <QUrl>
-#include <QDir>
-#include <QDebug>
-
-QAndroidPlatformServices::QAndroidPlatformServices()
-{
- QtAndroid::AttachedJNIEnv env;
- if (!env.jniEnv)
- return;
-
- m_openURIMethodID = env.jniEnv->GetStaticMethodID(QtAndroid::applicationClass(),
- "openURL",
- "(Ljava/lang/String;)V");
-}
-
-bool QAndroidPlatformServices::openUrl(const QUrl &url)
-{
- QtAndroid::AttachedJNIEnv env;
- if (!env.jniEnv)
- return false;
-
- jstring string = env.jniEnv->NewString(reinterpret_cast<const jchar *>(url.toString().constData()),
- url.toString().length());
- env.jniEnv->CallStaticVoidMethod(QtAndroid::applicationClass(), m_openURIMethodID, string);
- env.jniEnv->DeleteLocalRef(string);
- return true;
-}
-
-bool QAndroidPlatformServices::openDocument(const QUrl &url)
-{
- return openUrl(url);
-}
-
-QByteArray QAndroidPlatformServices::desktopEnvironment() const
-{
- return QByteArray("Android");
-}
diff --git a/src/plugins/platforms/android/src/qandroidplatformservices.h b/src/plugins/platforms/android/src/qandroidplatformservices.h
deleted file mode 100644
index 8368b19043..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformservices.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDPLATFORMDESKTOPSERVICE_H
-#define ANDROIDPLATFORMDESKTOPSERVICE_H
-
-#include <qpa/qplatformservices.h>
-#include "androidjnimain.h"
-#include <jni.h>
-
-class QAndroidPlatformServices: public QPlatformServices
-{
-public:
- QAndroidPlatformServices();
- bool openUrl(const QUrl &url);
- bool openDocument(const QUrl &url);
- QByteArray desktopEnvironment() const;
-private:
- jmethodID m_openURIMethodID;
-
-};
-
-#endif // ANDROIDPLATFORMDESKTOPSERVICE_H
diff --git a/src/plugins/platforms/android/src/qandroidplatformtheme.cpp b/src/plugins/platforms/android/src/qandroidplatformtheme.cpp
deleted file mode 100644
index 308bb70faf..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformtheme.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidplatformtheme.h"
-#include "qandroidplatformmenubar.h"
-#include "qandroidplatformmenu.h"
-#include "qandroidplatformmenuitem.h"
-#include "qandroidplatformdialoghelpers.h"
-#include <QVariant>
-#include <QFileInfo>
-#include <qandroidplatformintegration.h>
-
-QAndroidPlatformTheme::QAndroidPlatformTheme(QAndroidPlatformNativeInterface *androidPlatformNativeInterface)
-{
- m_androidPlatformNativeInterface = androidPlatformNativeInterface;
-}
-
-QPlatformMenuBar *QAndroidPlatformTheme::createPlatformMenuBar() const
-{
- return new QAndroidPlatformMenuBar;
-}
-
-QPlatformMenu *QAndroidPlatformTheme::createPlatformMenu() const
-{
- return new QAndroidPlatformMenu;
-}
-
-QPlatformMenuItem *QAndroidPlatformTheme::createPlatformMenuItem() const
-{
- return new QAndroidPlatformMenuItem;
-}
-
-static inline int paletteType(QPlatformTheme::Palette type)
-{
- switch (type) {
- case QPlatformTheme::ToolButtonPalette:
- case QPlatformTheme::ButtonPalette:
- return QPlatformTheme::ButtonPalette;
-
- case QPlatformTheme::CheckBoxPalette:
- return QPlatformTheme::CheckBoxPalette;
-
- case QPlatformTheme::RadioButtonPalette:
- return QPlatformTheme::RadioButtonPalette;
-
- case QPlatformTheme::ComboBoxPalette:
- return QPlatformTheme::ComboBoxPalette;
-
- case QPlatformTheme::TextEditPalette:
- case QPlatformTheme::TextLineEditPalette:
- return QPlatformTheme::TextLineEditPalette;
-
- case QPlatformTheme::ItemViewPalette:
- return QPlatformTheme::ItemViewPalette;
-
- default:
- return QPlatformTheme::SystemPalette;
- }
-}
-
-const QPalette *QAndroidPlatformTheme::palette(Palette type) const
-{
- QHash<int, QPalette>::const_iterator it = m_androidPlatformNativeInterface->m_palettes.find(paletteType(type));
- if (it != m_androidPlatformNativeInterface->m_palettes.end())
- return &(it.value());
- return 0;
-}
-
-static inline int fontType(QPlatformTheme::Font type)
-{
- switch (type) {
- case QPlatformTheme::LabelFont:
- return QPlatformTheme::SystemFont;
-
- case QPlatformTheme::ToolButtonFont:
- return QPlatformTheme::PushButtonFont;
-
- default:
- return type;
- }
-}
-
-const QFont *QAndroidPlatformTheme::font(Font type) const
-{
- QHash<int, QFont>::const_iterator it = m_androidPlatformNativeInterface->m_fonts.find(fontType(type));
- if (it != m_androidPlatformNativeInterface->m_fonts.end())
- return &(it.value());
-
- // default in case the style has not set a font
- static QFont systemFont("Roboto", 14.0 * 100 / 72); // keep default size the same after changing from 100 dpi to 72 dpi
- if (type == QPlatformTheme::SystemFont)
- return &systemFont;
- return 0;
-}
-
-static const QLatin1String STYLES_PATH("/data/data/org.kde.necessitas.ministro/files/dl/style/");
-static const QLatin1String STYLE_FILE("/style.json");
-
-QVariant QAndroidPlatformTheme::themeHint(ThemeHint hint) const
-{
- switch (hint) {
- case StyleNames:
- if (qgetenv("QT_USE_ANDROID_NATIVE_STYLE").toInt()
- && (!qgetenv("MINISTRO_ANDROID_STYLE_PATH").isEmpty()
- || QFileInfo(STYLES_PATH
- + QLatin1String(qgetenv("QT_ANDROID_THEME_DISPLAY_DPI"))
- + STYLE_FILE).exists())) {
- return QStringList("android");
- }
- return QStringList("fusion");
- break;
- default:
- return QPlatformTheme::themeHint(hint);
- }
-}
-
-bool QAndroidPlatformTheme::usePlatformNativeDialog(QPlatformTheme::DialogType type) const
-{
- if (type == MessageDialog)
- return qgetenv("QT_USE_ANDROID_NATIVE_DIALOGS").toInt() == 1;
- return false;
-}
-
-QPlatformDialogHelper *QAndroidPlatformTheme::createPlatformDialogHelper(QPlatformTheme::DialogType type) const
-{
- switch (type) {
- case MessageDialog:
- return new QtAndroidDialogHelpers::QAndroidPlatformMessageDialogHelper;
- default:
- return 0;
- }
-}
diff --git a/src/plugins/platforms/android/src/qandroidplatformtheme.h b/src/plugins/platforms/android/src/qandroidplatformtheme.h
deleted file mode 100644
index ec259a9b0a..0000000000
--- a/src/plugins/platforms/android/src/qandroidplatformtheme.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDPLATFORMTHEME_H
-#define QANDROIDPLATFORMTHEME_H
-
-#include <qpa/qplatformtheme.h>
-class QAndroidPlatformNativeInterface;
-class QAndroidPlatformTheme: public QPlatformTheme
-{
-public:
- QAndroidPlatformTheme(QAndroidPlatformNativeInterface * androidPlatformNativeInterface);
- virtual QPlatformMenuBar *createPlatformMenuBar() const;
- virtual QPlatformMenu *createPlatformMenu() const;
- virtual QPlatformMenuItem *createPlatformMenuItem() const;
- virtual const QPalette *palette(Palette type = SystemPalette) const;
- virtual const QFont *font(Font type = SystemFont) const;
- virtual QVariant themeHint(ThemeHint hint) const;
- virtual bool usePlatformNativeDialog(DialogType type) const;
- virtual QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const;
-
-
-private:
- QAndroidPlatformNativeInterface * m_androidPlatformNativeInterface;
-};
-
-#endif // QANDROIDPLATFORMTHEME_H
diff --git a/src/plugins/platforms/android/src/qandroidsystemlocale.cpp b/src/plugins/platforms/android/src/qandroidsystemlocale.cpp
deleted file mode 100644
index a20f970a44..0000000000
--- a/src/plugins/platforms/android/src/qandroidsystemlocale.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidsystemlocale.h"
-#include "androidjnimain.h"
-#include <QtCore/private/qjni_p.h>
-#include "qdatetime.h"
-#include "qstringlist.h"
-#include "qvariant.h"
-
-QT_BEGIN_NAMESPACE
-
-QAndroidSystemLocale::QAndroidSystemLocale() : m_locale(QLocale::C)
-{
-}
-
-void QAndroidSystemLocale::getLocaleFromJava() const
-{
- QWriteLocker locker(&m_lock);
-
- QJNIObjectPrivate javaLocaleObject;
- QJNIObjectPrivate javaActivity(QtAndroid::activity());
- if (javaActivity.isValid()) {
- QJNIObjectPrivate resources = javaActivity.callObjectMethod("getResources", "()Landroid/content/res/Resources;");
- QJNIObjectPrivate configuration = resources.callObjectMethod("getConfiguration", "()Landroid/content/res/Configuration;");
-
- javaLocaleObject = configuration.getObjectField("locale", "Ljava/util/Locale;");
- } else {
- javaLocaleObject = QJNIObjectPrivate::callStaticObjectMethod("java/util/Locale", "getDefault", "()Ljava/util/Locale;");
- }
-
- QString languageCode = javaLocaleObject.callObjectMethod("getLanguage", "()Ljava/lang/String;").toString();
- QString countryCode = javaLocaleObject.callObjectMethod("getCountry", "()Ljava/lang/String;").toString();
-
- m_locale = QLocale(languageCode + QLatin1Char('_') + countryCode);
-}
-
-QVariant QAndroidSystemLocale::query(QueryType type, QVariant in) const
-{
- if (type == LocaleChanged) {
- getLocaleFromJava();
- return QVariant();
- }
-
- QReadLocker locker(&m_lock);
-
- switch (type) {
- case DecimalPoint:
- return m_locale.decimalPoint();
- case GroupSeparator:
- return m_locale.groupSeparator();
- case ZeroDigit:
- return m_locale.zeroDigit();
- case NegativeSign:
- return m_locale.negativeSign();
- case DateFormatLong:
- return m_locale.dateFormat(QLocale::LongFormat);
- case DateFormatShort:
- return m_locale.dateFormat(QLocale::ShortFormat);
- case TimeFormatLong:
- return m_locale.timeFormat(QLocale::LongFormat);
- case TimeFormatShort:
- return m_locale.timeFormat(QLocale::ShortFormat);
- case DayNameLong:
- return m_locale.dayName(in.toInt(), QLocale::LongFormat);
- case DayNameShort:
- return m_locale.dayName(in.toInt(), QLocale::ShortFormat);
- case MonthNameLong:
- return m_locale.monthName(in.toInt(), QLocale::LongFormat);
- case MonthNameShort:
- return m_locale.monthName(in.toInt(), QLocale::ShortFormat);
- case StandaloneMonthNameLong:
- return m_locale.standaloneMonthName(in.toInt(), QLocale::LongFormat);
- case StandaloneMonthNameShort:
- return m_locale.standaloneMonthName(in.toInt(), QLocale::ShortFormat);
- case DateToStringLong:
- return m_locale.toString(in.toDate(), QLocale::LongFormat);
- case DateToStringShort:
- return m_locale.toString(in.toDate(), QLocale::ShortFormat);
- case TimeToStringLong:
- return m_locale.toString(in.toTime(), QLocale::LongFormat);
- case TimeToStringShort:
- return m_locale.toString(in.toTime(), QLocale::ShortFormat);
- case DateTimeFormatLong:
- return m_locale.dateTimeFormat(QLocale::LongFormat);
- case DateTimeFormatShort:
- return m_locale.dateTimeFormat(QLocale::ShortFormat);
- case DateTimeToStringLong:
- return m_locale.toString(in.toDateTime(), QLocale::LongFormat);
- case DateTimeToStringShort:
- return m_locale.toString(in.toDateTime(), QLocale::ShortFormat);
- case PositiveSign:
- return m_locale.positiveSign();
- case AMText:
- return m_locale.amText();
- case PMText:
- return m_locale.pmText();
- case FirstDayOfWeek:
- return m_locale.firstDayOfWeek();
- case CurrencySymbol:
- return m_locale .currencySymbol(QLocale::CurrencySymbolFormat(in.toUInt()));
- case CurrencyToString: {
- switch (in.type()) {
- case QVariant::Int:
- return m_locale .toCurrencyString(in.toInt());
- case QVariant::UInt:
- return m_locale .toCurrencyString(in.toUInt());
- case QVariant::Double:
- return m_locale .toCurrencyString(in.toDouble());
- case QVariant::LongLong:
- return m_locale .toCurrencyString(in.toLongLong());
- case QVariant::ULongLong:
- return m_locale .toCurrencyString(in.toULongLong());
- default:
- break;
- }
- return QString();
- }
- case StringToStandardQuotation:
- return m_locale.quoteString(in.value<QStringRef>());
- case StringToAlternateQuotation:
- return m_locale.quoteString(in.value<QStringRef>(), QLocale::AlternateQuotation);
- case ListToSeparatedString:
- return m_locale.createSeparatedList(in.value<QStringList>());
- case LocaleChanged:
- Q_ASSERT_X(false, Q_FUNC_INFO, "This can't happen.");
- default:
- break;
- }
- return QVariant();
-}
-
-QLocale QAndroidSystemLocale::fallbackUiLocale() const
-{
- QReadLocker locker(&m_lock);
- return m_locale;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/src/qandroidsystemlocale.h b/src/plugins/platforms/android/src/qandroidsystemlocale.h
deleted file mode 100644
index fc2f6fad98..0000000000
--- a/src/plugins/platforms/android/src/qandroidsystemlocale.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDSYSTEMLOCALE_H
-#define QANDROIDSYSTEMLOCALE_H
-
-#include "private/qlocale_p.h"
-#include <QtCore/qreadwritelock.h>
-
-QT_BEGIN_NAMESPACE
-
-class QAndroidSystemLocale : public QSystemLocale
-{
-public:
- QAndroidSystemLocale();
-
- virtual QVariant query(QueryType type, QVariant in) const;
- virtual QLocale fallbackUiLocale() const;
-
-private:
- void getLocaleFromJava() const;
-
- mutable QLocale m_locale;
- mutable QReadWriteLock m_lock;
-};
-
-QT_END_NAMESPACE
-
-#endif // QANDROIDSYSTEMLOCALE_H
diff --git a/src/plugins/platforms/android/src/raster/qandroidplatformscreen.cpp b/src/plugins/platforms/android/src/raster/qandroidplatformscreen.cpp
deleted file mode 100644
index 2e59c307c3..0000000000
--- a/src/plugins/platforms/android/src/raster/qandroidplatformscreen.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidplatformscreen.h"
-#include "qandroidplatformintegration.h"
-#include "androidjnimain.h"
-#include "androidjnimenu.h"
-#include "qandroidplatformwindow.h"
-
-QAndroidPlatformScreen::QAndroidPlatformScreen():QFbScreen()
-{
- mGeometry = QRect(0, 0, QAndroidPlatformIntegration::m_defaultGeometryWidth, QAndroidPlatformIntegration::m_defaultGeometryHeight);
- mFormat = QImage::Format_RGB16;
- mDepth = 16;
- mPhysicalSize.setHeight(QAndroidPlatformIntegration::m_defaultPhysicalSizeHeight);
- mPhysicalSize.setWidth(QAndroidPlatformIntegration::m_defaultPhysicalSizeWidth);
- initializeCompositor();
-}
-
-void QAndroidPlatformScreen::topWindowChanged(QWindow *w)
-{
- QtAndroidMenu::setActiveTopLevelWindow(w);
-
- if (w != 0) {
- QAndroidPlatformWindow *platformWindow = static_cast<QAndroidPlatformWindow *>(w->handle());
- if (platformWindow != 0)
- platformWindow->updateStatusBarVisibility();
- }
-}
-
-QRegion QAndroidPlatformScreen::doRedraw()
-{
- QRegion touched;
- touched = QFbScreen::doRedraw();
- if (touched.isEmpty())
- return touched;
-
- QtAndroid::flushImage(mGeometry.topLeft(), *mScreenImage, touched.boundingRect());
- return touched;
-}
-
-QDpi QAndroidPlatformScreen::logicalDpi() const
-{
- qreal lDpi = QtAndroid::scaledDensity() * 72;
- return QDpi(lDpi, lDpi);
-}
-
-Qt::ScreenOrientation QAndroidPlatformScreen::orientation() const
-{
- return QAndroidPlatformIntegration::m_orientation;
-}
-
-Qt::ScreenOrientation QAndroidPlatformScreen::nativeOrientation() const
-{
- return QAndroidPlatformIntegration::m_nativeOrientation;
-}
diff --git a/src/plugins/platforms/android/src/raster/qandroidplatformscreen.h b/src/plugins/platforms/android/src/raster/qandroidplatformscreen.h
deleted file mode 100644
index 9f8807b995..0000000000
--- a/src/plugins/platforms/android/src/raster/qandroidplatformscreen.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDPLATFORMSCREEN_H
-#define QANDROIDPLATFORMSCREEN_H
-
-#include <QtPlatformSupport/private/qfbscreen_p.h>
-
-class QAndroidPlatformScreen: public QFbScreen
-{
- Q_OBJECT
-public:
- QAndroidPlatformScreen();
- void topWindowChanged(QWindow *w);
- QDpi logicalDpi() const;
- Qt::ScreenOrientation orientation() const;
- Qt::ScreenOrientation nativeOrientation() const;
-
-public slots:
- QRegion doRedraw();
-
-};
-
-#endif
diff --git a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp b/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp
deleted file mode 100644
index 7ff18526d9..0000000000
--- a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidplatformwindow.h"
-
-#include "androidjnimain.h"
-#include <qpa/qwindowsysteminterface.h>
-
-QAndroidPlatformWindow::QAndroidPlatformWindow(QWindow *window)
- : QFbWindow(window)
-{
-}
-
-void QAndroidPlatformWindow::setGeometry(const QRect &rect)
-{
- QFbWindow::setGeometry(rect);
-}
-
-void QAndroidPlatformWindow::propagateSizeHints()
-{
- //shut up warning from default implementation
-}
-
-void QAndroidPlatformWindow::updateStatusBarVisibility()
-{
- Qt::WindowFlags flags = window()->flags();
- bool isNonRegularWindow = flags & (Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window;
- if (!isNonRegularWindow) {
- if (mWindowState & Qt::WindowFullScreen)
- QtAndroid::hideStatusBar();
- else if (mWindowState & Qt::WindowMaximized)
- QtAndroid::showStatusBar();
- }
-}
-
-void QAndroidPlatformWindow::raise()
-{
- updateStatusBarVisibility();
- QFbWindow::raise();
-}
-
-void QAndroidPlatformWindow::setWindowState(Qt::WindowState state)
-{
- if (mWindowState == state)
- return;
-
- if (window()->isVisible())
- updateStatusBarVisibility();
-
- QFbWindow::setWindowState(state);
-}
-
-void QAndroidPlatformWindow::setVisible(bool visible)
-{
- if (visible)
- updateStatusBarVisibility();
-
- QFbWindow::setVisible(visible);
-
- // The Android Activity is activated before Qt is initialized, causing the application state to
- // never be set to 'active'. We explicitly set this state when the first window becomes visible.
- if (visible)
- QtAndroid::setApplicationActive();
-}
diff --git a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h b/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h
deleted file mode 100644
index 9e3f203201..0000000000
--- a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANDROIDPLATFORMWINDOW_H
-#define ANDROIDPLATFORMWINDOW_H
-#include <qobject.h>
-#include <QtPlatformSupport/private/qfbwindow_p.h>
-
-class QAndroidPlatformWindow: public QObject, public QFbWindow
-{
- Q_OBJECT
-public:
- explicit QAndroidPlatformWindow(QWindow *window);
-
- void propagateSizeHints();
-
- void raise();
- void setWindowState(Qt::WindowState state);
- void setVisible(bool visible);
- void updateStatusBarVisibility();
-
-public slots:
- void setGeometry(const QRect &rect);
-};
-
-#endif // ANDROIDPLATFORMWINDOW_H
diff --git a/src/plugins/platforms/android/src/raster/raster.pri b/src/plugins/platforms/android/src/raster/raster.pri
deleted file mode 100644
index 86e5aa235f..0000000000
--- a/src/plugins/platforms/android/src/raster/raster.pri
+++ /dev/null
@@ -1,7 +0,0 @@
-INCLUDEPATH += $$PWD
-
-SOURCES += $$PWD/qandroidplatformscreen.cpp \
- $$PWD/qandroidplatformwindow.cpp
-
-HEADERS += $$PWD/qandroidplatformscreen.h \
- $$PWD/qandroidplatformwindow.h
diff --git a/src/plugins/platforms/android/src/src.pri b/src/plugins/platforms/android/src/src.pri
deleted file mode 100644
index 9b64e846f7..0000000000
--- a/src/plugins/platforms/android/src/src.pri
+++ /dev/null
@@ -1,55 +0,0 @@
-load(qt_plugin)
-
-QT += core-private gui-private platformsupport-private
-
-CONFIG += qpa/genericunixfontdatabase
-
-OTHER_FILES += $$PWD/android.json
-
-INCLUDEPATH += $$PWD
-INCLUDEPATH += $$PWD/../../../../3rdparty/android/src
-
-SOURCES += $$PWD/androidplatformplugin.cpp \
- $$PWD/androidjnimain.cpp \
- $$PWD/androidjniaccessibility.cpp \
- $$PWD/androidjniinput.cpp \
- $$PWD/androidjnimenu.cpp \
- $$PWD/androidjniclipboard.cpp \
- $$PWD/qandroidplatformintegration.cpp \
- $$PWD/qandroidplatformservices.cpp \
- $$PWD/qandroidassetsfileenginehandler.cpp \
- $$PWD/qandroidinputcontext.cpp \
- $$PWD/qandroidplatformaccessibility.cpp \
- $$PWD/qandroidplatformfontdatabase.cpp \
- $$PWD/qandroidplatformdialoghelpers.cpp \
- $$PWD/qandroidplatformclipboard.cpp \
- $$PWD/qandroidplatformtheme.cpp \
- $$PWD/qandroidplatformmenubar.cpp \
- $$PWD/qandroidplatformmenu.cpp \
- $$PWD/qandroidplatformmenuitem.cpp \
- $$PWD/qandroidsystemlocale.cpp
-
-
-HEADERS += $$PWD/qandroidplatformintegration.h \
- $$PWD/androidjnimain.h \
- $$PWD/androidjniaccessibility.h \
- $$PWD/androidjniinput.h \
- $$PWD/androidjnimenu.h \
- $$PWD/androidjniclipboard.h \
- $$PWD/qandroidplatformservices.h \
- $$PWD/qandroidassetsfileenginehandler.h \
- $$PWD/qandroidinputcontext.h \
- $$PWD/qandroidplatformaccessibility.h \
- $$PWD/qandroidplatformfontdatabase.h \
- $$PWD/qandroidplatformclipboard.h \
- $$PWD/qandroidplatformdialoghelpers.h \
- $$PWD/qandroidplatformtheme.h \
- $$PWD/qandroidplatformmenubar.h \
- $$PWD/qandroidplatformmenu.h \
- $$PWD/qandroidplatformmenuitem.h \
- $$PWD/qandroidsystemlocale.h
-
-
-#Non-standard install directory, QTBUG-29859
-DESTDIR = $$DESTDIR/android
-target.path = $${target.path}/android