aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-02-27 18:43:01 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-02-27 18:43:01 +0100
commit7550365abc00bf994ae4c0ac93d4209541034dc8 (patch)
treea719dc75bebcb765d61e0e90518ee8a88b9e989d
parenta8a1f02f664f2120d79037afdf5dd72c24532fb3 (diff)
parenta2157a9dd2ee4ed3e998654595544dadaf129fe8 (diff)
Merge remote-tracking branch 'origin/5.11' into dev
-rw-r--r--dist/changes-5.10.126
-rw-r--r--src/androidextras/android/qandroidservice.cpp28
-rw-r--r--src/androidextras/android/qandroidservice.h7
3 files changed, 55 insertions, 6 deletions
diff --git a/dist/changes-5.10.1 b/dist/changes-5.10.1
new file mode 100644
index 0000000..695c4e3
--- /dev/null
+++ b/dist/changes-5.10.1
@@ -0,0 +1,26 @@
+Qt 5.10.1 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.10.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+http://doc.qt.io/qt-5/index.html
+
+The Qt version 5.10 series is binary compatible with the 5.9.x series.
+Applications compiled for 5.9 will continue to run with 5.10.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+This release contains all fixes included in the Qt 5.9.4 release.
+
+****************************************************************************
+* Qt 5.10.1 Changes *
+****************************************************************************
+
+ - This release contains only minor code improvements.
diff --git a/src/androidextras/android/qandroidservice.cpp b/src/androidextras/android/qandroidservice.cpp
index 3a7626d..227787a 100644
--- a/src/androidextras/android/qandroidservice.cpp
+++ b/src/androidextras/android/qandroidservice.cpp
@@ -46,6 +46,7 @@
#include <private/qjnihelpers_p.h>
#include <QMutex>
+#include <QTimer>
#include <QSet>
QT_BEGIN_NAMESPACE
@@ -53,10 +54,11 @@ QT_BEGIN_NAMESPACE
class QAndroidServicePrivate : public QObject, public QtAndroidPrivate::OnBindListener
{
public:
- QAndroidServicePrivate(QAndroidService *service)
+ QAndroidServicePrivate(QAndroidService *service, const std::function<QAndroidBinder *(const QAndroidIntent &)> &binder = {})
: m_service(service)
+ , m_binder(binder)
{
- QtAndroidPrivate::setOnBindListener(this);
+ QTimer::singleShot(0,this, [this]{ QtAndroidPrivate::setOnBindListener(this);});
}
~QAndroidServicePrivate()
@@ -73,7 +75,8 @@ public:
// OnBindListener interface
jobject onBind(jobject intent) override
{
- auto binder = m_service->onBind(QAndroidIntent(intent));
+ auto qai = QAndroidIntent(intent);
+ auto binder = m_binder ? m_binder(qai) : m_service->onBind(qai);
if (binder) {
{
QMutexLocker lock(&m_bindersMutex);
@@ -92,8 +95,9 @@ private:
m_binders.remove(obj);
}
-private:
- QAndroidService *m_service;
+public:
+ QAndroidService *m_service = nullptr;
+ std::function<QAndroidBinder *(const QAndroidIntent &)> m_binder;
QMutex m_bindersMutex;
QSet<QAndroidBinder*> m_binders;
};
@@ -116,7 +120,19 @@ private:
*/
QAndroidService::QAndroidService(int &argc, char **argv, int flags)
: QCoreApplication (argc, argv, QtAndroidPrivate::acuqireServiceSetup(flags))
- , d(new QAndroidServicePrivate(this))
+ , d(new QAndroidServicePrivate{this})
+{
+}
+
+/*!
+ Creates a new Android Service
+
+ \a binder is used to create a binder each when is needed
+ \sa QCoreApplication
+ */
+QAndroidService::QAndroidService(int &argc, char **argv, const std::function<QAndroidBinder *(const QAndroidIntent &)> &binder, int flags)
+ : QCoreApplication (argc, argv, QtAndroidPrivate::acuqireServiceSetup(flags))
+ , d(new QAndroidServicePrivate{this, binder})
{
}
diff --git a/src/androidextras/android/qandroidservice.h b/src/androidextras/android/qandroidservice.h
index 72e47a4..8c0855c 100644
--- a/src/androidextras/android/qandroidservice.h
+++ b/src/androidextras/android/qandroidservice.h
@@ -43,6 +43,7 @@
#include <QtAndroidExtras/qandroidextrasglobal.h>
#include <QCoreApplication>
#include <QSharedPointer>
+#include <functional>
QT_BEGIN_NAMESPACE
class QAndroidServicePrivate;
@@ -56,6 +57,12 @@ public:
, int flags = ApplicationFlags
#endif
);
+ QAndroidService(int &argc, char **argv,
+ const std::function<QAndroidBinder*(const QAndroidIntent &intent)> & binder
+#ifndef Q_QDOC
+ , int flags = ApplicationFlags
+#endif
+ );
virtual ~QAndroidService();
virtual QAndroidBinder* onBind(const QAndroidIntent &intent);