summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2019-04-10 22:57:45 +0200
committerpaolo <paolo.angelelli@qt.io>2019-06-21 22:56:05 +0200
commit6ddffc8a4eb50164389c55c2ddad9239dab07b8c (patch)
treec0208a549f972e514a0987849f123394048694ef
parentac899dcc40bb3ad09307583fb7e6befd45a77b33 (diff)
downloadqtlocation-6ddffc8a4eb50164389c55c2ddad9239dab07b8c.tar.gz
Move PluginParameter into PositioningQuick, expose also in QtPositioning
With this patch the QDeclarativeGeoServiceProviderParameter in the location-private module becomes QDeclarativePluginParameter in the positioningquick-private module. This renamed class is then registered, under the same QML typename "PluginParameter" both in QtPositioning and QtLocation qml plugins. In this way it will become possible to use the same type both inside QtLocation "Plugin" and inside QtPositioning "PositionSource", and regardless of which is the QML plugin that provides "PluginParameter", this will translate into the same cpp type. [ChangeLog][QtPositioning] Exposed PluginParameter also from QtPositioning qml plugin, to be used in PositionSource as replacement of environment variables. Task-number: QTBUG-66304 Change-Id: I1d982ff689130ae896c616480567aa12d9b49c3a Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/imports/location/location.cpp3
-rw-r--r--src/imports/location/location.pro2
-rw-r--r--src/imports/positioning/positioning.cpp7
-rw-r--r--src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp81
-rw-r--r--src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h45
-rw-r--r--src/positioning/doc/src/plugins/serialnmea.qdoc78
-rw-r--r--src/positioning/doc/src/qtpositioning-plugins.qdoc40
-rw-r--r--src/positioning/positioning.pro2
-rw-r--r--src/positioningquick/qdeclarativepluginparameter.cpp135
-rw-r--r--src/positioningquick/qdeclarativepluginparameter_p.h94
-rw-r--r--src/positioningquick/qdeclarativeposition_p.h4
-rw-r--r--src/positioningquick/qdeclarativepositionsource_p.h5
12 files changed, 386 insertions, 110 deletions
diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp
index 422b4c72..fccb628d 100644
--- a/src/imports/location/location.cpp
+++ b/src/imports/location/location.cpp
@@ -35,6 +35,7 @@
****************************************************************************/
#include <QtLocation/private/qdeclarativegeoserviceprovider_p.h>
+#include <QtPositioningQuick/private/qdeclarativepluginparameter_p.h>
#include <QtLocation/private/qdeclarativegeomap_p.h>
#include <QtLocation/private/qdeclarativegeoroute_p.h>
@@ -97,7 +98,7 @@ public:
// 5.0 is silent and not advertised
qmlRegisterType<QDeclarativeGeoServiceProvider >(uri, major, minor, "Plugin");
- qmlRegisterType<QDeclarativeGeoServiceProviderParameter >(uri, major, minor, "PluginParameter");
+ qmlRegisterType<QDeclarativePluginParameter >(uri, major, minor, "PluginParameter");
qmlRegisterUncreatableType<QDeclarativeGeoServiceProviderRequirements>(uri, major, minor, "PluginRequirements",
QStringLiteral("PluginRequirements is not intended instantiable by developer."));
qmlRegisterType<QDeclarativeGeoMap >(uri, major, minor, "Map");
diff --git a/src/imports/location/location.pro b/src/imports/location/location.pro
index dec1149b..40605806 100644
--- a/src/imports/location/location.pro
+++ b/src/imports/location/location.pro
@@ -1,4 +1,4 @@
-QT += quick-private network positioning-private location-private qml-private core-private gui-private
+QT += quick-private network positioning-private positioningquick-private location-private qml-private core-private gui-private
SOURCES += \
location.cpp
diff --git a/src/imports/positioning/positioning.cpp b/src/imports/positioning/positioning.cpp
index 4349f63b..38b9378a 100644
--- a/src/imports/positioning/positioning.cpp
+++ b/src/imports/positioning/positioning.cpp
@@ -41,9 +41,9 @@
#include <QtPositioningQuick/private/qdeclarativegeoaddress_p.h>
#include <QtPositioningQuick/private/qdeclarativegeolocation_p.h>
#include <QtPositioning/private/qwebmercator_p.h>
-
-#include <QtPositioningQuick/private/qdeclarativepositionsource_p.h>
#include <QtPositioningQuick/private/qdeclarativeposition_p.h>
+#include <QtPositioningQuick/private/qdeclarativepositionsource_p.h>
+#include <QtPositioningQuick/private/qdeclarativepluginparameter_p.h>
#include <QtPositioningQuick/private/qquickgeocoordinateanimation_p.h>
#include "locationsingleton.h"
@@ -616,6 +616,9 @@ public:
minor = 13;
qmlRegisterType<QDeclarativeGeoLocation, 13>(uri, major, minor, "Location");
+ minor = 14;
+ qmlRegisterType<QDeclarativePluginParameter >(uri, major, minor, "PluginParameter");
+
// Register the latest Qt version as QML type version
qmlRegisterModule(uri, QT_VERSION_MAJOR, QT_VERSION_MINOR);
} else {
diff --git a/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp b/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp
index aa1db493..7810dc74 100644
--- a/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp
+++ b/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp
@@ -124,7 +124,7 @@ void QDeclarativeGeoServiceProvider::setName(const QString &name)
\internal
*/
bool QDeclarativeGeoServiceProvider::parametersReady() {
- for (const QDeclarativeGeoServiceProviderParameter *p: qAsConst(parameters_)) {
+ for (const QDeclarativePluginParameter *p: qAsConst(parameters_)) {
if (!p->isInitialized())
return false;
}
@@ -179,9 +179,9 @@ void QDeclarativeGeoServiceProvider::componentComplete()
{
complete_ = true;
- for (QDeclarativeGeoServiceProviderParameter *p: qAsConst(parameters_)) {
+ for (QDeclarativePluginParameter *p: qAsConst(parameters_)) {
if (!p->isInitialized()) {
- connect(p, &QDeclarativeGeoServiceProviderParameter::initialized,
+ connect(p, &QDeclarativePluginParameter::initialized,
this, &QDeclarativeGeoServiceProvider::tryAttach);
}
}
@@ -603,9 +603,9 @@ void QDeclarativeGeoServiceProvider::setLocales(const QStringList &locales)
This property holds the list of plugin parameters.
*/
-QQmlListProperty<QDeclarativeGeoServiceProviderParameter> QDeclarativeGeoServiceProvider::parameters()
+QQmlListProperty<QDeclarativePluginParameter> QDeclarativeGeoServiceProvider::parameters()
{
- return QQmlListProperty<QDeclarativeGeoServiceProviderParameter>(this,
+ return QQmlListProperty<QDeclarativePluginParameter>(this,
0,
parameter_append,
parameter_count,
@@ -616,7 +616,7 @@ QQmlListProperty<QDeclarativeGeoServiceProviderParameter> QDeclarativeGeoService
/*!
\internal
*/
-void QDeclarativeGeoServiceProvider::parameter_append(QQmlListProperty<QDeclarativeGeoServiceProviderParameter> *prop, QDeclarativeGeoServiceProviderParameter *parameter)
+void QDeclarativeGeoServiceProvider::parameter_append(QQmlListProperty<QDeclarativePluginParameter> *prop, QDeclarativePluginParameter *parameter)
{
QDeclarativeGeoServiceProvider *p = static_cast<QDeclarativeGeoServiceProvider *>(prop->object);
p->parameters_.append(parameter);
@@ -627,7 +627,7 @@ void QDeclarativeGeoServiceProvider::parameter_append(QQmlListProperty<QDeclarat
/*!
\internal
*/
-int QDeclarativeGeoServiceProvider::parameter_count(QQmlListProperty<QDeclarativeGeoServiceProviderParameter> *prop)
+int QDeclarativeGeoServiceProvider::parameter_count(QQmlListProperty<QDeclarativePluginParameter> *prop)
{
return static_cast<QDeclarativeGeoServiceProvider *>(prop->object)->parameters_.count();
}
@@ -635,7 +635,7 @@ int QDeclarativeGeoServiceProvider::parameter_count(QQmlListProperty<QDeclarativ
/*!
\internal
*/
-QDeclarativeGeoServiceProviderParameter *QDeclarativeGeoServiceProvider::parameter_at(QQmlListProperty<QDeclarativeGeoServiceProviderParameter> *prop, int index)
+QDeclarativePluginParameter *QDeclarativeGeoServiceProvider::parameter_at(QQmlListProperty<QDeclarativePluginParameter> *prop, int index)
{
return static_cast<QDeclarativeGeoServiceProvider *>(prop->object)->parameters_[index];
}
@@ -643,7 +643,7 @@ QDeclarativeGeoServiceProviderParameter *QDeclarativeGeoServiceProvider::paramet
/*!
\internal
*/
-void QDeclarativeGeoServiceProvider::parameter_clear(QQmlListProperty<QDeclarativeGeoServiceProviderParameter> *prop)
+void QDeclarativeGeoServiceProvider::parameter_clear(QQmlListProperty<QDeclarativePluginParameter> *prop)
{
QDeclarativeGeoServiceProvider *p = static_cast<QDeclarativeGeoServiceProvider *>(prop->object);
p->parameters_.clear();
@@ -659,7 +659,7 @@ QVariantMap QDeclarativeGeoServiceProvider::parameterMap() const
QVariantMap map;
for (int i = 0; i < parameters_.size(); ++i) {
- QDeclarativeGeoServiceProviderParameter *parameter = parameters_.at(i);
+ QDeclarativePluginParameter *parameter = parameters_.at(i);
map.insert(parameter->name(), parameter->value());
}
@@ -866,21 +866,25 @@ bool QDeclarativeGeoServiceProviderRequirements::operator == (const QDeclarative
/*!
\qmltype PluginParameter
- \instantiates QDeclarativeGeoServiceProviderParameter
+ \instantiates QDeclarativePluginParameter
\inqmlmodule QtLocation
\ingroup qml-QtLocation5-common
\since QtLocation 5.5
- \brief The PluginParameter type describes a parameter to a \l Plugin.
+ \brief The PluginParameter type describes a parameter for a plugin, either
+ geo service \l Plugin, or \l{Qt Positioning plugins}{position Plugin}.
The PluginParameter object is used to provide a parameter of some kind
- to a Plugin. Typically these parameters contain details like an application
- token for access to a service, or a proxy server to use for network access.
+ to a plugin. Typically these parameters contain details like an application
+ token for access to a service, or a proxy server to use for network access,
+ or the serial port to which a serial GPS receiver is connected.
- To set such a parameter, declare a PluginParameter inside a \l Plugin
- object, and give it \l{name} and \l{value} properties. A list of valid
+ To set such a parameter, declare a PluginParameter inside an element that accepts
+ plugin parameters as configuration objects, such as a \l Plugin object, or a
+ \l PositionSource object, and give it \l{name} and \l{value} properties. A list of valid
parameter names for each plugin is available from the
- \l {Qt Location#Plugin References and Parameters}{plugin reference pages}.
+ \l {Qt Location#Plugin References and Parameters}{plugin reference pages} for geoservice plugins,
+ and \l {Qt Positioning plugins#Default plugins} for position plugins.
\section2 Example Usage
@@ -896,33 +900,12 @@ bool QDeclarativeGeoServiceProviderRequirements::operator == (const QDeclarative
\endcode
*/
-QDeclarativeGeoServiceProviderParameter::QDeclarativeGeoServiceProviderParameter(QObject *parent)
- : QObject(parent) {}
-
-QDeclarativeGeoServiceProviderParameter::~QDeclarativeGeoServiceProviderParameter() {}
-
/*!
\qmlproperty string PluginParameter::name
This property holds the name of the plugin parameter as a single formatted string.
This property is a write-once property.
*/
-void QDeclarativeGeoServiceProviderParameter::setName(const QString &name)
-{
- if (!name_.isEmpty() || name.isEmpty())
- return;
-
- name_ = name;
-
- emit nameChanged(name_);
- if (value_.isValid())
- emit initialized();
-}
-
-QString QDeclarativeGeoServiceProviderParameter::name() const
-{
- return name_;
-}
/*!
\qmlproperty QVariant PluginParameter::value
@@ -930,29 +913,9 @@ QString QDeclarativeGeoServiceProviderParameter::name() const
This property holds the value of the plugin parameter which support different types of values (variant).
This property is a write-once property.
*/
-void QDeclarativeGeoServiceProviderParameter::setValue(const QVariant &value)
-{
- if (value_.isValid() || !value.isValid() || value.isNull())
- return;
-
- value_ = value;
-
- emit valueChanged(value_);
- if (!name_.isEmpty())
- emit initialized();
-}
-
-QVariant QDeclarativeGeoServiceProviderParameter::value() const
-{
- return value_;
-}
-
-bool QDeclarativeGeoServiceProviderParameter::isInitialized() const
-{
- return !name_.isEmpty() && value_.isValid();
-}
/*******************************************************************************
+ * Implementation now in positioningquick
*******************************************************************************/
QT_END_NAMESPACE
diff --git a/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h b/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h
index 3d5592c0..165f7ba4 100644
--- a/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h
+++ b/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h
@@ -58,38 +58,10 @@
#include <QtQml/QQmlParserStatus>
#include <QtQml/QQmlListProperty>
#include <QtLocation/QGeoServiceProvider>
+#include <QtPositioningQuick/private/qdeclarativepluginparameter_p.h>
QT_BEGIN_NAMESPACE
-class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoServiceProviderParameter : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
- Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged)
-
-public:
- explicit QDeclarativeGeoServiceProviderParameter(QObject *parent = 0);
- ~QDeclarativeGeoServiceProviderParameter();
-
- void setName(const QString &name);
- QString name() const;
-
- void setValue(const QVariant &value);
- QVariant value() const;
-
- bool isInitialized() const;
-
-Q_SIGNALS:
- void nameChanged(const QString &name);
- void valueChanged(const QVariant &value);
- void initialized();
-
-private:
- QString name_;
- QVariant value_;
-};
-
class QDeclarativeGeoServiceProviderRequirements;
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoServiceProvider : public QObject, public QQmlParserStatus
@@ -102,7 +74,7 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoServiceProvider : public QObject,
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
Q_PROPERTY(QStringList availableServiceProviders READ availableServiceProviders CONSTANT)
- Q_PROPERTY(QQmlListProperty<QDeclarativeGeoServiceProviderParameter> parameters READ parameters)
+ Q_PROPERTY(QQmlListProperty<QDeclarativePluginParameter> parameters READ parameters)
Q_PROPERTY(QDeclarativeGeoServiceProviderRequirements *required READ requirements WRITE setRequirements)
Q_PROPERTY(QStringList locales READ locales WRITE setLocales NOTIFY localesChanged)
Q_PROPERTY(QStringList preferred READ preferred WRITE setPreferred NOTIFY preferredChanged)
@@ -189,7 +161,7 @@ public:
void setName(const QString &name);
QString name() const;
- QQmlListProperty<QDeclarativeGeoServiceProviderParameter> parameters();
+ QQmlListProperty<QDeclarativePluginParameter> parameters();
QVariantMap parameterMap() const;
QStringList availableServiceProviders();
@@ -226,14 +198,14 @@ Q_SIGNALS:
private:
bool parametersReady();
void tryAttach();
- static void parameter_append(QQmlListProperty<QDeclarativeGeoServiceProviderParameter> *prop, QDeclarativeGeoServiceProviderParameter *mapObject);
- static int parameter_count(QQmlListProperty<QDeclarativeGeoServiceProviderParameter> *prop);
- static QDeclarativeGeoServiceProviderParameter *parameter_at(QQmlListProperty<QDeclarativeGeoServiceProviderParameter> *prop, int index);
- static void parameter_clear(QQmlListProperty<QDeclarativeGeoServiceProviderParameter> *prop);
+ static void parameter_append(QQmlListProperty<QDeclarativePluginParameter> *prop, QDeclarativePluginParameter *mapObject);
+ static int parameter_count(QQmlListProperty<QDeclarativePluginParameter> *prop);
+ static QDeclarativePluginParameter *parameter_at(QQmlListProperty<QDeclarativePluginParameter> *prop, int index);
+ static void parameter_clear(QQmlListProperty<QDeclarativePluginParameter> *prop);
QGeoServiceProvider *sharedProvider_;
QString name_;
- QList<QDeclarativeGeoServiceProviderParameter *> parameters_;
+ QList<QDeclarativePluginParameter *> parameters_;
QDeclarativeGeoServiceProviderRequirements *required_;
bool complete_;
bool experimental_;
@@ -303,7 +275,6 @@ private:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QDeclarativeGeoServiceProviderParameter)
QML_DECLARE_TYPE(QDeclarativeGeoServiceProviderRequirements)
QML_DECLARE_TYPE(QDeclarativeGeoServiceProvider)
diff --git a/src/positioning/doc/src/plugins/serialnmea.qdoc b/src/positioning/doc/src/plugins/serialnmea.qdoc
new file mode 100644
index 00000000..3e9861b5
--- /dev/null
+++ b/src/positioning/doc/src/plugins/serialnmea.qdoc
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page position-plugin-serialnmea.html
+\title Qt Positioning Serial NMEA plugin
+\ingroup QtPositioning-plugins
+
+\brief Reads the NMEA stream from a serial connection to provide position updates.
+
+\section1 Overview
+
+Included with Qt Location is a position plugin which parses NMEA sentences streamed
+over a serial port into position updates.
+
+This plugin can be loaded by using the provider name \b serialnmea.
+
+
+\section1 Parameters
+
+The following table lists parameters that \e can be passed to the serialnmea plugin.
+
+\table
+\header
+ \li Parameter
+ \li Description
+\row
+ \li serialnmea.serial_port
+ \li The serial port where the NMEA stream is coming.
+\endtable
+
+\section1 Parameter Usage Example
+
+The following examples show how to create a \b serialnmea PositionSource
+listening on a specific serial port
+
+\section2 QML
+
+\code
+PositionSource {
+ name: "serialnmea"
+ PluginParameter { name: "serialnmea.serial_port"; value: "tnt1" }
+}
+\endcode
+
+\section2 C++
+
+\code
+QVariantMap params;
+params["serialnmea.serial_port"] = "tnt1";
+QGeoPositionInfoSource *positionSource = QGeoPositionInfoSource::createSource("serialnmea", params, this);
+\endcode
+
+*/
diff --git a/src/positioning/doc/src/qtpositioning-plugins.qdoc b/src/positioning/doc/src/qtpositioning-plugins.qdoc
index 37d25fc5..77fdf3aa 100644
--- a/src/positioning/doc/src/qtpositioning-plugins.qdoc
+++ b/src/positioning/doc/src/qtpositioning-plugins.qdoc
@@ -27,11 +27,43 @@
/*!
\page qtpositioning-plugins.html
-\title Qt Positioning service plugins
-\brief Implementing Qt Positioning plugins
+\title Qt Positioning plugins
+\brief Default Plugins and Implementing Qt Positioning plugins
+
+Qt Positioning provides the majority of its functionality through plugins.
+This document outlines how to develop a new position plugin.
+
+\section1 Default plugins
+Some plugins already ship with Qt. These are:
+
+\table
+ \row
+ \li \b android
+ \li Wraps Android positioning subsystem. Available only on Android.
+ \row
+ \li \b corelocation
+ \li Wraps iOS and macOS positioning subsystems. Available only on Apple platforms supporting corelocation.
+ \row
+ \li \b geoclue
+ \li Interfaces with \l{https://www.freedesktop.org/wiki/Software/GeoClue/}{GeoClue} v0.12. Requires GeoClue 0.12 to be present to function.
+ \row
+ \li \b geoclue2
+ \li Interfaces with \l{https://www.freedesktop.org/wiki/Software/GeoClue/}{GeoClue} v2. Requires GeoClue v2 to be present to function.
+ \row
+ \li \b gypsy
+ \li Interfaces with \l{https://gypsy.freedesktop.org/wiki/}{Gypsy} daemon. Requires Gypsy to be present to function.
+ \row
+ \li \b winrt
+ \li Wraps WinRT positioning subsystem. Available only on WinRT and Windows10.
+ \row
+ \li \b serialnmea
+ \li A \l {Qt Positioning Serial NMEA plugin}{Serial NMEA} backend that parses NMEA streams from a GPS receiver over a
+ serial link to provide position updates.
+ \row
+ \li \b positionpoll
+ \li A backend providing only area monitoring functionalities via polling on position updates.
+\endtable
-Qt Positioning provides the majority of its functionality through plugins. This
-document outlines how to develop a new position plugin.
\section1 Plugin Description
diff --git a/src/positioning/positioning.pro b/src/positioning/positioning.pro
index 35e8e9e1..8996a7e4 100644
--- a/src/positioning/positioning.pro
+++ b/src/positioning/positioning.pro
@@ -7,7 +7,7 @@ INCLUDEPATH += ../3rdparty/clipper
INCLUDEPATH += ../3rdparty/clip2tri
QMAKE_DOCS = $$PWD/doc/qtpositioning.qdocconf
-OTHER_FILES += configure.json doc/src/*.qdoc # show .qdoc files in Qt Creator
+OTHER_FILES += configure.json doc/src/*.qdoc doc/src/plugins/*.qdoc # show .qdoc files in Qt Creator
ANDROID_BUNDLED_JAR_DEPENDENCIES = \
jar/QtPositioning.jar:org.qtproject.qt5.android.positioning.QtPositioning
diff --git a/src/positioningquick/qdeclarativepluginparameter.cpp b/src/positioningquick/qdeclarativepluginparameter.cpp
new file mode 100644
index 00000000..678e8a6a
--- /dev/null
+++ b/src/positioningquick/qdeclarativepluginparameter.cpp
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation 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$
+**
+****************************************************************************/
+
+#include "qdeclarativepluginparameter_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype PluginParameter
+ \instantiates QDeclarativePluginParameter
+ \inqmlmodule QtPositioning
+ \ingroup qml-QtPositioning5-common
+ \since QtPositioning 5.14
+
+ \brief The PluginParameter type describes a parameter for a plugin, either
+ geoservice \l Plugin, or position plugin.
+
+ The PluginParameter object is used to provide a parameter of some kind
+ to a plugin. Typically these parameters contain details like an application
+ token for access to a service, or a proxy server to use for network access,
+ or the serial port to which a serial GPS receiver is connected.
+
+ To set such a parameter, declare a PluginParameter inside an element that accepts
+ plugin parameters as configuration objects, such as a \l Plugin object, or a
+ \l PositionSource object, and give it \l{name} and \l{value} properties. A list of valid
+ parameter names for each plugin is available from the
+ \l {Qt Location#Plugin References and Parameters}{plugin reference pages} for geoservice plugins,
+ and \l {Qt Positioning plugins#Default plugins} for position plugins.
+
+ \section2 Example Usage
+
+ The following example shows an instantiation of the \l {Qt Location HERE Plugin}{HERE} plugin
+ with a mapping API \e app_id and \e token pair specific to the application.
+
+ \code
+ Plugin {
+ name: "here"
+ PluginParameter { name: "here.app_id"; value: "EXAMPLE_API_ID" }
+ PluginParameter { name: "here.token"; value: "EXAMPLE_TOKEN_123" }
+ }
+ \endcode
+*/
+
+/*!
+ \qmlproperty string PluginParameter::name
+
+ This property holds the name of the plugin parameter as a single formatted string.
+ This property is a write-once property.
+*/
+
+/*!
+ \qmlproperty QVariant PluginParameter::value
+
+ This property holds the value of the plugin parameter which support different types of values (variant).
+ This property is a write-once property.
+*/
+
+QDeclarativePluginParameter::QDeclarativePluginParameter(QObject *parent)
+ : QObject(parent) {}
+
+QDeclarativePluginParameter::~QDeclarativePluginParameter() {}
+
+void QDeclarativePluginParameter::setName(const QString &name)
+{
+ if (!name_.isEmpty() || name.isEmpty())
+ return;
+
+ name_ = name;
+
+ emit nameChanged(name_);
+ if (value_.isValid())
+ emit initialized();
+}
+
+QString QDeclarativePluginParameter::name() const
+{
+ return name_;
+}
+
+void QDeclarativePluginParameter::setValue(const QVariant &value)
+{
+ if (value_.isValid() || !value.isValid() || value.isNull())
+ return;
+
+ value_ = value;
+
+ emit valueChanged(value_);
+ if (!name_.isEmpty())
+ emit initialized();
+}
+
+QVariant QDeclarativePluginParameter::value() const
+{
+ return value_;
+}
+
+bool QDeclarativePluginParameter::isInitialized() const
+{
+ return !name_.isEmpty() && value_.isValid();
+}
+
+QT_END_NAMESPACE
diff --git a/src/positioningquick/qdeclarativepluginparameter_p.h b/src/positioningquick/qdeclarativepluginparameter_p.h
new file mode 100644
index 00000000..f5035aae
--- /dev/null
+++ b/src/positioningquick/qdeclarativepluginparameter_p.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation 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 QDECLARATIVEPLUGINPARAMETER_P_H
+#define QDECLARATIVEPLUGINPARAMETER_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 <QtPositioningQuick/private/qpositioningquickglobal_p.h>
+#include <QtQml/qqml.h>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+
+QT_BEGIN_NAMESPACE
+
+class Q_POSITIONINGQUICK_PRIVATE_EXPORT QDeclarativePluginParameter : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+ Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged)
+
+public:
+ explicit QDeclarativePluginParameter(QObject *parent = 0);
+ ~QDeclarativePluginParameter();
+
+ void setName(const QString &name);
+ QString name() const;
+
+ void setValue(const QVariant &value);
+ QVariant value() const;
+
+ bool isInitialized() const;
+
+Q_SIGNALS:
+ void nameChanged(const QString &name);
+ void valueChanged(const QVariant &value);
+ void initialized();
+
+private:
+ QString name_;
+ QVariant value_;
+};
+
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QDeclarativePluginParameter)
+
+#endif // QDECLARATIVEPLUGINPARAMETER_P_H
diff --git a/src/positioningquick/qdeclarativeposition_p.h b/src/positioningquick/qdeclarativeposition_p.h
index 141c37b7..c2a8d987 100644
--- a/src/positioningquick/qdeclarativeposition_p.h
+++ b/src/positioningquick/qdeclarativeposition_p.h
@@ -53,11 +53,11 @@
// We mean it.
//
+#include <QtPositioningQuick/private/qpositioningquickglobal_p.h>
+#include <QtPositioning/QGeoPositionInfo>
#include <QtCore/QObject>
#include <QtCore/QDateTime>
#include <QtQml/qqml.h>
-#include <QtPositioningQuick/private/qpositioningquickglobal_p.h>
-#include <QtPositioning/QGeoPositionInfo>
QT_BEGIN_NAMESPACE
diff --git a/src/positioningquick/qdeclarativepositionsource_p.h b/src/positioningquick/qdeclarativepositionsource_p.h
index 39bcd899..c6daaae5 100644
--- a/src/positioningquick/qdeclarativepositionsource_p.h
+++ b/src/positioningquick/qdeclarativepositionsource_p.h
@@ -51,12 +51,11 @@
// We mean it.
//
-#include "qdeclarativeposition_p.h"
-
+#include <QtPositioningQuick/private/qpositioningquickglobal_p.h>
+#include <QtPositioningQuick/private/qdeclarativeposition_p.h>
#include <QtCore/QObject>
#include <QtNetwork/QAbstractSocket>
#include <QtQml/QQmlParserStatus>
-#include <QtPositioningQuick/private/qpositioningquickglobal_p.h>
#include <QtPositioning/QGeoPositionInfoSource>
QT_BEGIN_NAMESPACE