summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-12-18 17:52:35 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2016-12-18 17:57:43 +0000
commita2d7021445d4bfac46b8598b414c4b6ef72ed3b6 (patch)
treecff7916dcdc158c2d59cddac19a58b9439fe4d33
parentc0cacafd37ae21fcb747f6bc981f58b1fde4eae2 (diff)
Pimplify the core/context/content classes
Change-Id: I6a4721335cf06fc5bd4a1223fa59eb7afa6a3dca Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
-rw-r--r--src/android/content/content.pri5
-rw-r--r--src/android/content/qnativeandroidcontext.cpp19
-rw-r--r--src/android/content/qnativeandroidcontext_p.h10
-rw-r--r--src/android/content/qnativeandroidcontext_p_p.h61
-rw-r--r--src/android/content/qnativeandroidcontextual.cpp44
-rw-r--r--src/android/content/qnativeandroidcontextual_p.h7
-rw-r--r--src/android/content/qnativeandroidcontextual_p_p.h65
-rw-r--r--src/android/content/qnativeandroidcontextwrapper.cpp19
-rw-r--r--src/android/content/qnativeandroidcontextwrapper_p.h10
-rw-r--r--src/android/content/qnativeandroidcontextwrapper_p_p.h61
-rw-r--r--src/android/core/core.pri1
-rw-r--r--src/android/core/qnativeandroidobject.cpp29
-rw-r--r--src/android/core/qnativeandroidobject_p.h11
-rw-r--r--src/android/core/qnativeandroidobject_p_p.h65
14 files changed, 373 insertions, 34 deletions
diff --git a/src/android/content/content.pri b/src/android/content/content.pri
index 2ef4ef7..3eb70ce 100644
--- a/src/android/content/content.pri
+++ b/src/android/content/content.pri
@@ -2,8 +2,11 @@ INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/qnativeandroidcontext_p.h \
+ $$PWD/qnativeandroidcontext_p_p.h \
$$PWD/qnativeandroidcontextual_p.h \
- $$PWD/qnativeandroidcontextwrapper_p.h
+ $$PWD/qnativeandroidcontextual_p_p.h \
+ $$PWD/qnativeandroidcontextwrapper_p.h \
+ $$PWD/qnativeandroidcontextwrapper_p_p.h
SOURCES += \
$$PWD/qnativeandroidcontext.cpp \
diff --git a/src/android/content/qnativeandroidcontext.cpp b/src/android/content/qnativeandroidcontext.cpp
index 7179f66..7d86415 100644
--- a/src/android/content/qnativeandroidcontext.cpp
+++ b/src/android/content/qnativeandroidcontext.cpp
@@ -35,16 +35,27 @@
****************************************************************************/
#include "qnativeandroidcontext_p.h"
+#include "qnativeandroidcontext_p_p.h"
QT_BEGIN_NAMESPACE
-QNativeAndroidContext::QNativeAndroidContext(QObject *parent) :
- QNativeAndroidContextual(this, parent)
+QNativeAndroidContext::QNativeAndroidContext(QObject *parent)
+ : QNativeAndroidContextual(this, parent)
{
}
-QNativeAndroidContext::QNativeAndroidContext(QNativeAndroidContext *context, QObject *parent) :
- QNativeAndroidContextual(context, parent)
+QNativeAndroidContext::QNativeAndroidContext(QNativeAndroidContext *context, QObject *parent)
+ : QNativeAndroidContextual(context, parent)
+{
+}
+
+QNativeAndroidContext::QNativeAndroidContext(QNativeAndroidContextPrivate &dd, QObject *parent)
+ : QNativeAndroidContextual(dd, parent)
+{
+}
+
+QNativeAndroidContext::QNativeAndroidContext(QNativeAndroidContextPrivate &dd, QNativeAndroidContext *context, QObject *parent)
+ : QNativeAndroidContextual(dd, context, parent)
{
}
diff --git a/src/android/content/qnativeandroidcontext_p.h b/src/android/content/qnativeandroidcontext_p.h
index ddc5ab6..eac7ffe 100644
--- a/src/android/content/qnativeandroidcontext_p.h
+++ b/src/android/content/qnativeandroidcontext_p.h
@@ -52,6 +52,8 @@
QT_BEGIN_NAMESPACE
+class QNativeAndroidContextPrivate;
+
class Q_NATIVEANDROID_EXPORT QNativeAndroidContext : public QNativeAndroidContextual
{
Q_OBJECT
@@ -59,6 +61,14 @@ class Q_NATIVEANDROID_EXPORT QNativeAndroidContext : public QNativeAndroidContex
public:
explicit QNativeAndroidContext(QObject *parent = nullptr);
explicit QNativeAndroidContext(QNativeAndroidContext *context, QObject *parent = nullptr);
+
+protected:
+ QNativeAndroidContext(QNativeAndroidContextPrivate &dd, QObject *parent = nullptr);
+ QNativeAndroidContext(QNativeAndroidContextPrivate &dd, QNativeAndroidContext *context, QObject *parent = nullptr);
+
+private:
+ Q_DISABLE_COPY(QNativeAndroidContext)
+ Q_DECLARE_PRIVATE(QNativeAndroidContext)
};
QT_END_NAMESPACE
diff --git a/src/android/content/qnativeandroidcontext_p_p.h b/src/android/content/qnativeandroidcontext_p_p.h
new file mode 100644
index 0000000..aa4f6a8
--- /dev/null
+++ b/src/android/content/qnativeandroidcontext_p_p.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt QML Android module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QNATIVEANDROIDCONTEXT_P_P_H
+#define QNATIVEANDROIDCONTEXT_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtNativeAndroid/private/qnativeandroidcontextual_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QNativeAndroidContextPrivate : public QNativeAndroidContextualPrivate
+{
+};
+
+QT_END_NAMESPACE
+
+#endif // QNATIVEANDROIDCONTEXT_P_P_H
diff --git a/src/android/content/qnativeandroidcontextual.cpp b/src/android/content/qnativeandroidcontextual.cpp
index 1e5be09..66005e1 100644
--- a/src/android/content/qnativeandroidcontextual.cpp
+++ b/src/android/content/qnativeandroidcontextual.cpp
@@ -35,20 +35,35 @@
****************************************************************************/
#include "qnativeandroidcontextual_p.h"
+#include "qnativeandroidcontextual_p_p.h"
#include "qnativeandroidcontext_p.h"
#include <QtCore/qdebug.h>
QT_BEGIN_NAMESPACE
-QNativeAndroidContextual::QNativeAndroidContextual(QObject *parent) :
- QNativeAndroidObject(parent), m_context(0)
+QNativeAndroidContextual::QNativeAndroidContextual(QObject *parent)
+ : QNativeAndroidObject(*(new QNativeAndroidContextualPrivate), parent)
{
if (!initContext())
QMetaObject::invokeMethod(this, "resolveContext", Qt::QueuedConnection);
}
-QNativeAndroidContextual::QNativeAndroidContextual(QNativeAndroidContext* context, QObject *parent) :
- QNativeAndroidObject(parent || context == this ? parent : context), m_context(0)
+QNativeAndroidContextual::QNativeAndroidContextual(QNativeAndroidContext* context, QObject *parent)
+ : QNativeAndroidObject(*(new QNativeAndroidContextualPrivate), parent || context == this ? parent : context)
+{
+ if (!initContext(context))
+ QMetaObject::invokeMethod(this, "resolveContext", Qt::QueuedConnection);
+}
+
+QNativeAndroidContextual::QNativeAndroidContextual(QNativeAndroidContextualPrivate &dd, QObject *parent)
+ : QNativeAndroidObject(dd, parent)
+{
+ if (!initContext())
+ QMetaObject::invokeMethod(this, "resolveContext", Qt::QueuedConnection);
+}
+
+QNativeAndroidContextual::QNativeAndroidContextual(QNativeAndroidContextualPrivate &dd, QNativeAndroidContext *context, QObject *parent)
+ : QNativeAndroidObject(dd, parent)
{
if (!initContext(context))
QMetaObject::invokeMethod(this, "resolveContext", Qt::QueuedConnection);
@@ -56,20 +71,23 @@ QNativeAndroidContextual::QNativeAndroidContextual(QNativeAndroidContext* contex
QAndroidJniObject QNativeAndroidContextual::ctx() const
{
- if (!m_context)
+ Q_D(const QNativeAndroidContextual);
+ if (!d->context)
return QAndroidJniObject();
- return m_context->instance();
+ return d->context->instance();
}
QNativeAndroidContext *QNativeAndroidContextual::context() const
{
- return m_context;
+ Q_D(const QNativeAndroidContextual);
+ return d->context;
}
void QNativeAndroidContextual::setContext(QNativeAndroidContext *context)
{
- if (m_context != context) {
- m_context = context;
+ Q_D(QNativeAndroidContextual);
+ if (d->context != context) {
+ d->context = context;
propagateContext();
emit contextChanged();
}
@@ -104,19 +122,21 @@ bool QNativeAndroidContextual::initContext(QNativeAndroidContext *context)
void QNativeAndroidContextual::resolveContext()
{
- if (!m_context) {
+ Q_D(QNativeAndroidContextual);
+ if (!d->context) {
setContext(findContext(this));
- if (!m_context)
+ if (!d->context)
qWarning() << "QNativeAndroidContextual: could not resolve context for" << this;
}
}
void QNativeAndroidContextual::propagateContext()
{
+ Q_D(QNativeAndroidContextual);
foreach (QObject *child, children()) {
QNativeAndroidContextual *contextual = qobject_cast<QNativeAndroidContextual *>(child);
if (contextual)
- contextual->setContext(m_context);
+ contextual->setContext(d->context);
}
}
diff --git a/src/android/content/qnativeandroidcontextual_p.h b/src/android/content/qnativeandroidcontextual_p.h
index c467b76..457d3ab 100644
--- a/src/android/content/qnativeandroidcontextual_p.h
+++ b/src/android/content/qnativeandroidcontextual_p.h
@@ -53,6 +53,7 @@
QT_BEGIN_NAMESPACE
class QNativeAndroidContext;
+class QNativeAndroidContextualPrivate;
class Q_NATIVEANDROID_EXPORT QNativeAndroidContextual : public QNativeAndroidObject
{
@@ -71,6 +72,9 @@ Q_SIGNALS:
void contextChanged();
protected:
+ QNativeAndroidContextual(QNativeAndroidContextualPrivate &dd, QObject *parent = nullptr);
+ QNativeAndroidContextual(QNativeAndroidContextualPrivate &dd, QNativeAndroidContext *context, QObject *parent = nullptr);
+
void componentComplete() override;
private Q_SLOTS:
@@ -79,7 +83,8 @@ private Q_SLOTS:
void propagateContext();
private:
- QNativeAndroidContext *m_context;
+ Q_DISABLE_COPY(QNativeAndroidContextual)
+ Q_DECLARE_PRIVATE(QNativeAndroidContextual)
};
QT_END_NAMESPACE
diff --git a/src/android/content/qnativeandroidcontextual_p_p.h b/src/android/content/qnativeandroidcontextual_p_p.h
new file mode 100644
index 0000000..3966dbd
--- /dev/null
+++ b/src/android/content/qnativeandroidcontextual_p_p.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt QML Android module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QNATIVEANDROIDCONTEXTUAL_P_P_H
+#define QNATIVEANDROIDCONTEXTUAL_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtNativeAndroid/private/qnativeandroidobject_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QNativeAndroidContext;
+
+class QNativeAndroidContextualPrivate : public QNativeAndroidObjectPrivate
+{
+public:
+ QNativeAndroidContext *context = nullptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // QNATIVEANDROIDCONTEXTUAL_P_P_H
diff --git a/src/android/content/qnativeandroidcontextwrapper.cpp b/src/android/content/qnativeandroidcontextwrapper.cpp
index dd0b3ca..95c95d9 100644
--- a/src/android/content/qnativeandroidcontextwrapper.cpp
+++ b/src/android/content/qnativeandroidcontextwrapper.cpp
@@ -35,16 +35,27 @@
****************************************************************************/
#include "qnativeandroidcontextwrapper_p.h"
+#include "qnativeandroidcontextwrapper_p_p.h"
QT_BEGIN_NAMESPACE
-QNativeAndroidContextWrapper::QNativeAndroidContextWrapper(QObject *parent) :
- QNativeAndroidContext(parent)
+QNativeAndroidContextWrapper::QNativeAndroidContextWrapper(QObject *parent)
+ : QNativeAndroidContext(*(new QNativeAndroidContextWrapperPrivate), parent)
{
}
-QNativeAndroidContextWrapper::QNativeAndroidContextWrapper(QNativeAndroidContext *context, QObject *parent) :
- QNativeAndroidContext(context, parent)
+QNativeAndroidContextWrapper::QNativeAndroidContextWrapper(QNativeAndroidContext *context, QObject *parent)
+ : QNativeAndroidContext(*(new QNativeAndroidContextWrapperPrivate), context, parent)
+{
+}
+
+QNativeAndroidContextWrapper::QNativeAndroidContextWrapper(QNativeAndroidContextWrapperPrivate &dd, QObject *parent)
+ : QNativeAndroidContext(dd, parent)
+{
+}
+
+QNativeAndroidContextWrapper::QNativeAndroidContextWrapper(QNativeAndroidContextWrapperPrivate &dd, QNativeAndroidContext *context, QObject *parent)
+ : QNativeAndroidContext(dd, context, parent)
{
}
diff --git a/src/android/content/qnativeandroidcontextwrapper_p.h b/src/android/content/qnativeandroidcontextwrapper_p.h
index 7ddb13e..b8f154a 100644
--- a/src/android/content/qnativeandroidcontextwrapper_p.h
+++ b/src/android/content/qnativeandroidcontextwrapper_p.h
@@ -52,6 +52,8 @@
QT_BEGIN_NAMESPACE
+class QNativeAndroidContextWrapperPrivate;
+
class Q_NATIVEANDROID_EXPORT QNativeAndroidContextWrapper : public QNativeAndroidContext
{
Q_OBJECT
@@ -59,6 +61,14 @@ class Q_NATIVEANDROID_EXPORT QNativeAndroidContextWrapper : public QNativeAndroi
public:
explicit QNativeAndroidContextWrapper(QObject *parent = nullptr);
explicit QNativeAndroidContextWrapper(QNativeAndroidContext *context, QObject *parent = nullptr);
+
+protected:
+ QNativeAndroidContextWrapper(QNativeAndroidContextWrapperPrivate &dd, QObject *parent = nullptr);
+ QNativeAndroidContextWrapper(QNativeAndroidContextWrapperPrivate &dd, QNativeAndroidContext *context, QObject *parent = nullptr);
+
+private:
+ Q_DISABLE_COPY(QNativeAndroidContextWrapper)
+ Q_DECLARE_PRIVATE(QNativeAndroidContextWrapper)
};
QT_END_NAMESPACE
diff --git a/src/android/content/qnativeandroidcontextwrapper_p_p.h b/src/android/content/qnativeandroidcontextwrapper_p_p.h
new file mode 100644
index 0000000..da2076f
--- /dev/null
+++ b/src/android/content/qnativeandroidcontextwrapper_p_p.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt QML Android module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QNATIVEANDROIDCONTEXTWRAPPER_P_P_H
+#define QNATIVEANDROIDCONTEXTWRAPPER_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtNativeAndroid/private/qnativeandroidcontext_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QNativeAndroidContextWrapperPrivate : public QNativeAndroidContextPrivate
+{
+};
+
+QT_END_NAMESPACE
+
+#endif // QNATIVEANDROIDCONTEXTWRAPPER_P_P_H
diff --git a/src/android/core/core.pri b/src/android/core/core.pri
index 873f879..3a33d07 100644
--- a/src/android/core/core.pri
+++ b/src/android/core/core.pri
@@ -2,6 +2,7 @@ INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/qnativeandroidobject_p.h \
+ $$PWD/qnativeandroidobject_p_p.h \
$$PWD/qnativeandroidoptional_p.h \
$$PWD/qtnativeandroidfunctions_p.h
diff --git a/src/android/core/qnativeandroidobject.cpp b/src/android/core/qnativeandroidobject.cpp
index 57dcaf8..45030a6 100644
--- a/src/android/core/qnativeandroidobject.cpp
+++ b/src/android/core/qnativeandroidobject.cpp
@@ -35,36 +35,47 @@
****************************************************************************/
#include "qnativeandroidobject_p.h"
+#include "qnativeandroidobject_p_p.h"
#include "qtnativeandroidfunctions_p.h"
+
#include <QtCore/qcoreapplication.h>
+#include <QtCore/qreadwritelock.h>
#include <QtCore/qcoreevent.h>
QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC(QReadWriteLock, instanceLock)
-QNativeAndroidObject::QNativeAndroidObject(QObject *parent) :
- QObject(parent), m_complete(false)
+QNativeAndroidObject::QNativeAndroidObject(QObject *parent)
+ : QObject(*(new QNativeAndroidObjectPrivate), parent)
+{
+}
+
+QNativeAndroidObject::QNativeAndroidObject(QNativeAndroidObjectPrivate &dd, QObject *parent)
+ : QObject(dd, parent)
{
}
bool QNativeAndroidObject::isValid() const
{
+ Q_D(const QNativeAndroidObject);
QReadLocker locker(instanceLock());
- return m_instance.isValid();
+ return d->instance.isValid();
}
QAndroidJniObject QNativeAndroidObject::instance() const
{
+ Q_D(const QNativeAndroidObject);
QReadLocker locker(instanceLock());
- return m_instance;
+ return d->instance;
}
void QNativeAndroidObject::setInstance(const QAndroidJniObject &instance)
{
+ Q_D(QNativeAndroidObject);
QWriteLocker locker(instanceLock());
- if (m_instance != instance) {
- m_instance = instance;
+ if (d->instance != instance) {
+ d->instance = instance;
// queue to Qt thread if necessary
QMetaObject::invokeMethod(this, "changeInstance", Qt::AutoConnection);
}
@@ -134,7 +145,8 @@ void QNativeAndroidObject::onInflate(QAndroidJniObject &instance)
bool QNativeAndroidObject::isComponentComplete() const
{
- return m_complete;
+ Q_D(const QNativeAndroidObject);
+ return d->complete;
}
void QNativeAndroidObject::classBegin()
@@ -143,7 +155,8 @@ void QNativeAndroidObject::classBegin()
void QNativeAndroidObject::componentComplete()
{
- m_complete = true;
+ Q_D(QNativeAndroidObject);
+ d->complete = true;
}
void QNativeAndroidObject::objectChange(ObjectChange change)
diff --git a/src/android/core/qnativeandroidobject_p.h b/src/android/core/qnativeandroidobject_p.h
index 8b5aeab..4d99636 100644
--- a/src/android/core/qnativeandroidobject_p.h
+++ b/src/android/core/qnativeandroidobject_p.h
@@ -51,7 +51,6 @@
#include <QtNativeAndroid/private/qtnativeandroidglobal_p.h>
#include <QtCore/qobject.h>
-#include <QtCore/qreadwritelock.h>
#include <QtQml/qqmllist.h>
#include <QtQml/qqmlparserstatus.h>
#include <QtAndroidExtras/qandroidjniobject.h>
@@ -59,6 +58,8 @@
QT_BEGIN_NAMESPACE
+class QNativeAndroidObjectPrivate;
+
class Q_NATIVEANDROID_EXPORT QNativeAndroidObject : public QObject, public QQmlParserStatus
{
Q_OBJECT
@@ -87,6 +88,8 @@ Q_SIGNALS:
void instanceChanged();
protected:
+ QNativeAndroidObject(QNativeAndroidObjectPrivate &dd, QObject *parent = nullptr);
+
virtual QAndroidJniObject onCreate();
virtual void onInflate(QAndroidJniObject &instance);
@@ -106,10 +109,10 @@ private Q_SLOTS:
void changeInstance();
private:
- void setInstance(const QAndroidJniObject &instance);
+ Q_DISABLE_COPY(QNativeAndroidObject)
+ Q_DECLARE_PRIVATE(QNativeAndroidObject)
- bool m_complete;
- QAndroidJniObject m_instance;
+ void setInstance(const QAndroidJniObject &instance);
friend class QNativeAndroidActivity;
};
diff --git a/src/android/core/qnativeandroidobject_p_p.h b/src/android/core/qnativeandroidobject_p_p.h
new file mode 100644
index 0000000..7b270af
--- /dev/null
+++ b/src/android/core/qnativeandroidobject_p_p.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt QML Android module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QNATIVEANDROIDOBJECT_P_P_H
+#define QNATIVEANDROIDOBJECT_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/private/qobject_p.h>
+#include <QtAndroidExtras/qandroidjniobject.h>
+
+QT_BEGIN_NAMESPACE
+
+class QNativeAndroidObjectPrivate : public QObjectPrivate
+{
+public:
+ bool complete = false;
+ QAndroidJniObject instance;
+};
+
+QT_END_NAMESPACE
+
+#endif // QNATIVEANDROIDOBJECT_P_P_H