summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Wilson <alex.wilson@nokia.com>2012-03-07 16:38:50 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-12 03:25:51 +0100
commit369fa99b132f8c1425da8a41f1436b8d86aaa50e (patch)
treea13d675390d1590df27c70a4ee47b6490cc58800
parentc435861528161ee931287034f41023c11dfb7ba3 (diff)
downloadqtlocation-369fa99b132f8c1425da8a41f1436b8d86aaa50e.tar.gz
Update positioning sources to use new plugin style
Notably, also splits the default sources that were previously compiled into the library, out into their own plugins. This follows a similar pattern to the geoservices change. We also drop the "plugin whitelisting" feature in favour of a simple Priority value in the plugin JSON -- the whitelist provides no additional security over this solution on any of our platforms. Task-number: QTBUG-24331 Change-Id: I62a9c940157ad2e33a9a575fa09633b98656b276 Reviewed-by: Alex <alex.blasche@nokia.com>
-rw-r--r--src/location/location.pro69
-rw-r--r--src/location/qgeopositioninfosource.cpp261
-rw-r--r--src/location/qgeopositioninfosource_p.h77
-rw-r--r--src/location/qgeopositioninfosourcefactory.cpp10
-rw-r--r--src/location/qgeopositioninfosourcefactory.h14
-rw-r--r--src/location/qgeosatelliteinfosource.cpp264
-rw-r--r--src/plugins/plugins.pro2
-rw-r--r--src/plugins/position/geoclue/geoclue.pro30
-rw-r--r--src/plugins/position/geoclue/plugin.json7
-rw-r--r--src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.cpp (renamed from src/location/qgeopositioninfosource_geocluemaster.cpp)0
-rw-r--r--src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster_p.h (renamed from src/location/qgeopositioninfosource_geocluemaster_p.h)0
-rw-r--r--src/plugins/position/geoclue/qgeopositioninfosourcefactory_geoclue.cpp54
-rw-r--r--src/plugins/position/geoclue/qgeopositioninfosourcefactory_geoclue.h61
-rw-r--r--src/plugins/position/gypsy/gypsy.pro30
-rw-r--r--src/plugins/position/gypsy/plugin.json7
-rw-r--r--src/plugins/position/gypsy/qgeopositioninfosourcefactory_gypsy.cpp54
-rw-r--r--src/plugins/position/gypsy/qgeopositioninfosourcefactory_gypsy.h61
-rw-r--r--src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy.cpp (renamed from src/location/qgeosatelliteinfosource_gypsy.cpp)0
-rw-r--r--src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy_p.h (renamed from src/location/qgeosatelliteinfosource_gypsy_p.h)0
-rw-r--r--src/plugins/position/maemo/dbuscomm_maemo.cpp (renamed from src/location/dbuscomm_maemo.cpp)0
-rw-r--r--src/plugins/position/maemo/dbuscomm_maemo_p.h (renamed from src/location/dbuscomm_maemo_p.h)0
-rw-r--r--src/plugins/position/maemo/dbusserver_maemo.cpp (renamed from src/location/dbusserver_maemo.cpp)0
-rw-r--r--src/plugins/position/maemo/dbusserver_maemo_p.h (renamed from src/location/dbusserver_maemo_p.h)0
-rw-r--r--src/plugins/position/maemo/maemo.pro29
-rw-r--r--src/plugins/position/maemo/plugin.json7
-rw-r--r--src/plugins/position/maemo/qgeopositioninfosource_maemo.cpp (renamed from src/location/qgeopositioninfosource_maemo.cpp)0
-rw-r--r--src/plugins/position/maemo/qgeopositioninfosource_maemo_p.h (renamed from src/location/qgeopositioninfosource_maemo_p.h)0
-rw-r--r--src/plugins/position/maemo/qgeopositioninfosourcefactory_maemo.cpp54
-rw-r--r--src/plugins/position/maemo/qgeopositioninfosourcefactory_maemo.h61
-rw-r--r--src/plugins/position/maemo/qgeosatelliteinfosource_maemo.cpp (renamed from src/location/qgeosatelliteinfosource_maemo.cpp)0
-rw-r--r--src/plugins/position/maemo/qgeosatelliteinfosource_maemo_p.h (renamed from src/location/qgeosatelliteinfosource_maemo_p.h)0
-rw-r--r--src/plugins/position/npe_backend/npe_backend.pro31
-rw-r--r--src/plugins/position/npe_backend/plugin.json7
-rw-r--r--src/plugins/position/npe_backend/qgeopositioninfosource_npe_backend.cpp (renamed from src/location/qgeopositioninfosource_npe_backend.cpp)0
-rw-r--r--src/plugins/position/npe_backend/qgeopositioninfosource_npe_backend_p.h (renamed from src/location/qgeopositioninfosource_npe_backend_p.h)0
-rw-r--r--src/plugins/position/npe_backend/qgeopositioninfosourcefactory_npe_backend.cpp54
-rw-r--r--src/plugins/position/npe_backend/qgeopositioninfosourcefactory_npe_backend.h61
-rw-r--r--src/plugins/position/npe_backend/qgeosatelliteinfosource_npe_backend.cpp (renamed from src/location/qgeosatelliteinfosource_npe_backend.cpp)0
-rw-r--r--src/plugins/position/npe_backend/qgeosatelliteinfosource_npe_backend_p.h (renamed from src/location/qgeosatelliteinfosource_npe_backend_p.h)0
-rw-r--r--src/plugins/position/position.pro9
-rw-r--r--src/plugins/position/simulator/plugin.json7
-rw-r--r--src/plugins/position/simulator/qgeopositioninfosource_simulator.cpp (renamed from src/location/qgeopositioninfosource_simulator.cpp)0
-rw-r--r--src/plugins/position/simulator/qgeopositioninfosource_simulator_p.h (renamed from src/location/qgeopositioninfosource_simulator_p.h)0
-rw-r--r--src/plugins/position/simulator/qgeopositioninfosourcefactory_simulator.cpp52
-rw-r--r--src/plugins/position/simulator/qgeopositioninfosourcefactory_simulator.h62
-rw-r--r--src/plugins/position/simulator/qgeosatelliteinfosource_simulator.cpp (renamed from src/location/qgeosatelliteinfosource_simulator.cpp)0
-rw-r--r--src/plugins/position/simulator/qgeosatelliteinfosource_simulator_p.h (renamed from src/location/qgeosatelliteinfosource_simulator_p.h)0
-rw-r--r--src/plugins/position/simulator/qlocationconnection_simulator.cpp (renamed from src/location/qlocationconnection_simulator.cpp)0
-rw-r--r--src/plugins/position/simulator/qlocationconnection_simulator_p.h (renamed from src/location/qlocationconnection_simulator_p.h)0
-rw-r--r--src/plugins/position/simulator/qlocationdata_simulator.cpp (renamed from src/location/qlocationdata_simulator.cpp)0
-rw-r--r--src/plugins/position/simulator/qlocationdata_simulator_p.h (renamed from src/location/qlocationdata_simulator_p.h)0
-rw-r--r--src/plugins/position/simulator/simulator.pro30
-rw-r--r--tests/auto/positionplugin/plugin.cpp21
-rw-r--r--tests/auto/positionplugin/plugin.json7
-rw-r--r--tests/auto/positionplugin/positionplugin.pro3
55 files changed, 960 insertions, 536 deletions
diff --git a/src/location/location.pro b/src/location/location.pro
index a67962e8..77720df8 100644
--- a/src/location/location.pro
+++ b/src/location/location.pro
@@ -14,7 +14,8 @@ INCLUDEPATH += $$QT.location.private_includes/QtLocation
load(qt_module_config)
-HEADERS += qtlocationversion.h
+HEADERS += qtlocationversion.h \
+ qgeopositioninfosource_p.h
include(maps/maps.pri)
include(places/places.pri)
@@ -47,60 +48,6 @@ PRIVATE_HEADERS += \
qgeoareamonitor_polling_p.h \
qgeocoordinate_p.h
-maemo6|meego {
- CONFIG += qdbus link_pkgconfig
- SOURCES += qgeopositioninfosource_maemo.cpp \
- qgeosatelliteinfosource_maemo.cpp \
- dbuscomm_maemo.cpp \
- dbusserver_maemo.cpp
- PRIVATE_HEADERS += qgeopositioninfosource_maemo_p.h \
- qgeosatelliteinfosource_maemo_p.h \
- dbuscomm_maemo_p.h \
- dbusserver_maemo_p.h
-}
-
-
-meego {
- contains (geoclue-master_enabled, yes) {
- message("Building location with GeoClue master support.")
- SOURCES += qgeopositioninfosource_geocluemaster.cpp
- PRIVATE_HEADERS += qgeopositioninfosource_geocluemaster_p.h
- DEFINES += GEOCLUE_MASTER_AVAILABLE=1
- PKGCONFIG += geoclue
- QMAKE_PKGCONFIG_REQUIRES += geoclue
- } else {
- message("Building location without GeoClue master support.")
- }
- contains (gypsy_enabled, yes) {
- message("Building location with Gypsy support.")
- SOURCES += qgeosatelliteinfosource_gypsy.cpp
- PRIVATE_HEADERS += qgeosatelliteinfosource_gypsy_p.h
- DEFINES += GYPSY_AVAILABLE=1
- PKGCONFIG += gypsy
- QMAKE_PKGCONFIG_REQUIRES += gypsy
- } else {
- message("Building location without Gypsy support.")
- }
- if (contains(gypsy_enabled, yes) || contains (geoclue-master_enabled, yes)) {
- CONFIG += qdbus link_pkgconfig
- PKGCONFIG += gconf-2.0 glib-2.0
- QMAKE_PKGCONFIG_REQUIRES += glib-2.0 gconf-2.0
- }
-}
-
-contains(config_test_locationd, yes):!simulator {
- DEFINES += NPE_BACKEND
- INCLUDEPATH += $$[QT_INSTALL_PREFIX]/include/mtlocationd
-#unix {
-# CONFIG += link_pkgconfig
-# PKGCONFIG += mtlocationd
-#}
- LIBS += -lmtlocationd
- SOURCES += qgeopositioninfosource_npe_backend.cpp\
- qgeosatelliteinfosource_npe_backend.cpp
- PRIVATE_HEADERS += qgeopositioninfosource_npe_backend_p.h\
- qgeosatelliteinfosource_npe_backend_p.h
-}
HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS
@@ -122,15 +69,3 @@ SOURCES += \
qgeopositioninfosourcefactory.cpp \
qtlocation.cpp
-simulator {
- QT += simulator
- DEFINES += QT_SIMULATOR
- SOURCES += qgeopositioninfosource_simulator.cpp \
- qlocationdata_simulator.cpp \
- qgeosatelliteinfosource_simulator.cpp \
- qlocationconnection_simulator.cpp
- HEADERS += qgeopositioninfosource_simulator_p.h \
- qlocationdata_simulator_p.h \
- qgeosatelliteinfosource_simulator_p.h \
- qlocationconnection_simulator_p.h
-}
diff --git a/src/location/qgeopositioninfosource.cpp b/src/location/qgeopositioninfosource.cpp
index 30f2631c..ff99ae9e 100644
--- a/src/location/qgeopositioninfosource.cpp
+++ b/src/location/qgeopositioninfosource.cpp
@@ -39,39 +39,24 @@
**
****************************************************************************/
#include <qgeopositioninfosource.h>
+#include "qgeopositioninfosource_p.h"
#include "qgeopositioninfosourcefactory.h"
#include <QFile>
#include <QPluginLoader>
#include <QStringList>
#include <QSettings>
+#include <QJsonObject>
#include <QCryptographicHash>
#include <QtCore/private/qfactoryloader_p.h>
-
-#if defined(QT_SIMULATOR)
-# include "qgeopositioninfosource_simulator_p.h"
-#elif defined(Q_OS_WINCE)
-# include "qgeopositioninfosource_wince_p.h"
-#elif defined(Q_WS_MAEMO_6)
-# include "qgeopositioninfosource_maemo_p.h"
-#elif defined(Q_WS_MAEMO_5)
-# include "qgeopositioninfosource_maemo5_p.h"
-#elif defined (NPE_BACKEND)
-# include "qgeopositioninfosource_npe_backend_p.h"
-#endif
-
-#if defined (Q_WS_MEEGO)
-#include "qgeopositioninfosource_maemo_p.h"
-#if defined (GEOCLUE_MASTER_AVAILABLE)
-#include "qgeopositioninfosource_geocluemaster_p.h"
-#endif
-#endif
+#include <QtCore/private/qlibrary_p.h>
QT_BEGIN_NAMESPACE
#ifndef QT_NO_LIBRARY
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QT_POSITION_SOURCE_INTERFACE, QLatin1String("/position")))
+ ("org.qt-project.qt.position.sourcefactory/5.0",
+ QStringLiteral("/position")))
#endif
/*!
@@ -124,152 +109,63 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
\value AllPositioningMethods A flag that matches all positioning methods.
*/
-class QGeoPositionInfoSourcePrivate
+void QGeoPositionInfoSourcePrivate::loadMeta()
{
-public:
- int interval;
- QGeoPositionInfoSource::PositioningMethods methods;
+ metaData = plugins().value(providerName);
+}
- static QList<QGeoPositionInfoSourceFactory*> pluginsSorted();
- static QHash<QString, QGeoPositionInfoSourceFactory*> plugins(bool reload = false);
- static void loadDynamicPlugins(QHash<QString, QGeoPositionInfoSourceFactory*> &plugins);
- static void loadStaticPlugins(QHash<QString, QGeoPositionInfoSourceFactory*> &plugins);
-};
+void QGeoPositionInfoSourcePrivate::loadPlugin()
+{
+ int idx = int(metaData.value(QStringLiteral("index")).toDouble());
+ if (idx < 0)
+ return;
+ factory = qobject_cast<QGeoPositionInfoSourceFactory*>(loader()->instance(idx));
+}
-QHash<QString, QGeoPositionInfoSourceFactory*> QGeoPositionInfoSourcePrivate::plugins(bool reload)
+QHash<QString, QJsonObject> QGeoPositionInfoSourcePrivate::plugins(bool reload)
{
- static QHash<QString, QGeoPositionInfoSourceFactory*> plugins;
+ static QHash<QString, QJsonObject> plugins;
static bool alreadyDiscovered = false;
if (reload == true)
alreadyDiscovered = false;
if (!alreadyDiscovered) {
- loadStaticPlugins(plugins);
- loadDynamicPlugins(plugins);
+ loadPluginMetadata(plugins);
alreadyDiscovered = true;
}
return plugins;
}
-static bool pluginComparator(const QGeoPositionInfoSourceFactory *p1, const QGeoPositionInfoSourceFactory *p2)
+static bool pluginComparator(const QJsonObject &p1, const QJsonObject &p2)
{
- return (p1->sourcePriority() > p2->sourcePriority());
+ const QString prio = QStringLiteral("Priority");
+ if (p1.contains(prio) && !p2.contains(prio))
+ return true;
+ if (!p1.contains(prio) && p2.contains(prio))
+ return false;
+ if (p1.value(prio).isDouble() && !p2.value(prio).isDouble())
+ return true;
+ if (!p1.value(prio).isDouble() && p2.value(prio).isDouble())
+ return false;
+ return (p1.value(prio).toDouble() > p2.value(prio).toDouble());
}
-QList<QGeoPositionInfoSourceFactory*> QGeoPositionInfoSourcePrivate::pluginsSorted()
+QList<QJsonObject> QGeoPositionInfoSourcePrivate::pluginsSorted()
{
- QList<QGeoPositionInfoSourceFactory*> list = plugins().values();
+ QList<QJsonObject> list = plugins().values();
qStableSort(list.begin(), list.end(), pluginComparator);
return list;
}
-void QGeoPositionInfoSourcePrivate::loadDynamicPlugins(QHash<QString, QGeoPositionInfoSourceFactory *> &plugins)
+void QGeoPositionInfoSourcePrivate::loadPluginMetadata(QHash<QString, QJsonObject> &plugins)
{
- QPluginLoader qpl;
- QString blockName;
-
- QSettings settings(QSettings::SystemScope, QLatin1String("Nokia"), QLatin1String("QtLocationPosAndSat"));
- QVariant value = settings.value(QLatin1String("position.plugin.operator.whitelist"));
- if (value.isValid()) {
- QStringList parts = value.toString().split(QLatin1String(","));
- if (parts.size() == 4) {
- QFile file(parts.at(1));
- file.open(QIODevice::ReadOnly);
-
- QCryptographicHash hash(QCryptographicHash::Sha1);
- while (!file.atEnd()) {
- QByteArray data = file.read(4096);
- hash.addData(data);
- }
- file.close();
-
- QByteArray hexHash = hash.result().toHex();
-
- bool loadIt = true;
- if (QString::number(file.size()) != parts.at(3)) {
- qCritical("Position info plugin: bad plugin size for %s",
- qPrintable(parts.at(1)));
- qWarning("Will fall back to platform default");
- loadIt = false;
- }
-
- if (hexHash != parts.at(2).toLatin1()) {
- qCritical("Position info plugin: bad plugin hash for %s",
- qPrintable(parts.at(1)));
- qWarning("Will fall back to platform default");
- loadIt = false;
- }
-
- if (loadIt) {
- qpl.setFileName(parts.at(1));
- QGeoPositionInfoSourceFactory *f =
- qobject_cast<QGeoPositionInfoSourceFactory*>(qpl.instance());
-
- if (f) {
- QString name = f->sourceName();
- if (name == parts.at(0)) {
- plugins.insert(name, f);
- } else {
- qCritical("Position info plugin: bad plugin name for %s",
- qPrintable(parts.at(1)));
- qWarning("Will fall back to platform default");
- }
- }
- }
-
- // still set blockName to ensure the plugin doesn't load
- blockName = parts.at(0);
- } else {
- qWarning("Position plugin whitelist: invalid format -- should be key,filename,hash,size");
- }
- }
-
QFactoryLoader *l = loader();
- QString key;
- for (int i = 0; i < l->keys().count(); i++) {
- key = l->keys().at(i);
- QGeoPositionInfoSourceFactory *f =
- qobject_cast<QGeoPositionInfoSourceFactory*>(l->instance(key));
- if (f) {
- const QString name = f->sourceName();
- if (name == blockName) {
- delete f;
- } else {
-#if !defined QT_NO_DEBUG
- const bool showDebug = qgetenv("QT_DEBUG_PLUGINS").toInt() > 0;
- if (showDebug)
- qDebug("Dynamic: found a service provider plugin with name %s", qPrintable(name));
-#endif
- plugins.insertMulti(name, f);
- }
- }
- }
-}
-
-void QGeoPositionInfoSourcePrivate::loadStaticPlugins(QHash<QString, QGeoPositionInfoSourceFactory *> &plugins)
-{
-#if !defined QT_NO_DEBUG
- const bool showDebug = qgetenv("QT_DEBUG_PLUGINS").toInt() > 0;
-#endif
-
- QObjectList staticPlugins = QPluginLoader::staticInstances();
- for (int i = 0; i < staticPlugins.count(); ++i) {
- QGeoPositionInfoSourceFactory *f =
- qobject_cast<QGeoPositionInfoSourceFactory*>(staticPlugins.at(i));
-
- if (f) {
- QString name = f->sourceName();
-
-#if !defined QT_NO_DEBUG
- if (showDebug)
- qDebug("Static: found a service provider plugin with name %s", qPrintable(name));
-#endif
- if (!name.isEmpty()) {
- plugins.insertMulti(name, f);
- }
- }
-
+ QList<QJsonObject> meta = l->metaData();
+ for (int i = 0; i < meta.size(); i++) {
+ QJsonObject obj = meta.at(i).value(QStringLiteral("MetaData")).toObject();
+ obj.insert(QStringLiteral("index"), i);
+ plugins.insertMulti(obj.value(QStringLiteral("Provider")).toString(), obj);
}
}
@@ -365,63 +261,23 @@ QGeoPositionInfoSource::PositioningMethods QGeoPositionInfoSource::preferredPosi
*/
QGeoPositionInfoSource *QGeoPositionInfoSource::createDefaultSource(QObject *parent)
{
- QSettings pluginSettings(QSettings::SystemScope, QLatin1String("Nokia"), QLatin1String("QtLocationPosAndSat"));
- QVariant value = pluginSettings.value(QLatin1String("position.plugin.operator.whitelist"));
- if (value.isValid()) {
- QStringList parts = value.toString().split(QLatin1String(","));
- if (parts.size() == 4) {
- QGeoPositionInfoSource *source = createSource(parts.at(0), parent);
- if (source)
- return source;
+ QGeoPositionInfoSourcePrivate *d = new QGeoPositionInfoSourcePrivate;
+
+ QList<QJsonObject> plugins = QGeoPositionInfoSourcePrivate::pluginsSorted();
+ foreach (QJsonObject obj, plugins) {
+ if (obj.value(QStringLiteral("Position")).isBool()
+ && obj.value(QStringLiteral("Position")).toBool()) {
+ d->metaData = obj;
+ d->loadPlugin();
+ QGeoPositionInfoSource *s = d->factory->positionInfoSource(parent);
+ if (s) {
+ delete d;
+ return s;
+ }
}
}
-#if defined(QT_SIMULATOR)
- return new QGeoPositionInfoSourceSimulator(parent);
-#elif defined(Q_OS_WINCE)
- return new QGeoPositionInfoSourceWinCE(parent);
-#elif (defined(Q_WS_MAEMO_6)) || (defined(Q_WS_MAEMO_5))
- QGeoPositionInfoSourceMaemo *source = new QGeoPositionInfoSourceMaemo(parent);
- int status = source->init();
- if (status != -1)
- return source;
- else
- delete source;
-#elif defined(Q_WS_MEEGO)
- // Use Maemo6 backend if its available, otherwise use Geoclue backend
- QSettings maemo6Settings(QSettings::UserScope, QLatin1String("Nokia"), QLatin1String("QtLocationPosAndSatMaemo6"));
- if (!maemo6Settings.value(QLatin1String("maemo6positioningavailable")).isValid()) {
- QGeoPositionInfoSourceMaemo* maemo6Source = new QGeoPositionInfoSourceMaemo(parent);
- int status = maemo6Source->init();
- if (status == -1) {
- delete maemo6Source;
- maemo6Source = 0;
- maemo6Settings.setValue("maemo6positioningavailable", false);
- } else {
- return maemo6Source;
- }
- }
-#ifdef GEOCLUE_MASTER_AVAILABLE
- QGeoPositionInfoSourceGeoclueMaster *geoclueSource = new QGeoPositionInfoSourceGeoclueMaster(parent);
- int status = geoclueSource->init();
- if (status >= 0)
- return geoclueSource;
- delete geoclueSource;
-#endif // GEOCLUE_MASTER_AVAILABLE
-#elif defined(NPE_BACKEND)
- QGeoPositionInfoSourceNpeBackend* npeBackendSource = new QGeoPositionInfoSourceNpeBackend(parent);
- if (npeBackendSource->init())
- return npeBackendSource;
- else
- delete npeBackendSource;
-#endif
- // no good platform source, try plugins
- foreach (QGeoPositionInfoSourceFactory *f, QGeoPositionInfoSourcePrivate::pluginsSorted()) {
- QGeoPositionInfoSource *src = f->positionInfoSource(parent);
- if (src)
- return src;
- }
-
+ delete d;
return 0;
}
@@ -434,12 +290,19 @@ QGeoPositionInfoSource *QGeoPositionInfoSource::createDefaultSource(QObject *par
*/
QGeoPositionInfoSource *QGeoPositionInfoSource::createSource(const QString &sourceName, QObject *parent)
{
- QGeoPositionInfoSourceFactory *f = QGeoPositionInfoSourcePrivate::plugins().value(sourceName);
- if (f) {
- QGeoPositionInfoSource *src = f->positionInfoSource(parent);
- if (src)
+ QGeoPositionInfoSourcePrivate *d = new QGeoPositionInfoSourcePrivate;
+ QHash<QString, QJsonObject> plugins = QGeoPositionInfoSourcePrivate::plugins();
+ if (plugins.contains(sourceName)) {
+ d->metaData = plugins.value(sourceName);
+ d->loadPlugin();
+ QGeoPositionInfoSource *src = d->factory->positionInfoSource(parent);
+ if (src) {
+ delete d;
return src;
+ }
}
+
+ delete d;
return 0;
}
diff --git a/src/location/qgeopositioninfosource_p.h b/src/location/qgeopositioninfosource_p.h
new file mode 100644
index 00000000..eb82591b
--- /dev/null
+++ b/src/location/qgeopositioninfosource_p.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGEOPOSITIONINFOSOURCE_P_H
+#define QGEOPOSITIONINFOSOURCE_P_H
+
+#include "qgeopositioninfosource.h"
+#include "qgeopositioninfosourcefactory.h"
+#include <QJsonObject>
+#include <QString>
+#include <QHash>
+#include <QList>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QGeoPositionInfoSourcePrivate
+{
+public:
+ int interval;
+ QGeoPositionInfoSource::PositioningMethods methods;
+ QJsonObject metaData;
+ QGeoPositionInfoSourceFactory *factory;
+ QString providerName;
+
+ void loadMeta();
+ void loadPlugin();
+
+ static QHash<QString, QJsonObject> plugins(bool reload = false);
+ static void loadPluginMetadata(QHash<QString, QJsonObject> &list);
+ static QList<QJsonObject> pluginsSorted();
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QGEOPOSITIONINFOSOURCE_P_H
diff --git a/src/location/qgeopositioninfosourcefactory.cpp b/src/location/qgeopositioninfosourcefactory.cpp
index 2b6b42b3..fd4c733c 100644
--- a/src/location/qgeopositioninfosourcefactory.cpp
+++ b/src/location/qgeopositioninfosourcefactory.cpp
@@ -111,16 +111,6 @@ QT_BEGIN_NAMESPACE
*/
/*!
- Returns the priority of this factory in the list of available
- factories. Factories with higher values of priority will be preferred
- to those with lower values.
- */
-int QGeoPositionInfoSourceFactory::sourcePriority() const
-{
- return 0;
-}
-
-/*!
Destroys the position info source factory.
*/
QGeoPositionInfoSourceFactory::~QGeoPositionInfoSourceFactory()
diff --git a/src/location/qgeopositioninfosourcefactory.h b/src/location/qgeopositioninfosourcefactory.h
index 481ffd08..e210e19a 100644
--- a/src/location/qgeopositioninfosourcefactory.h
+++ b/src/location/qgeopositioninfosourcefactory.h
@@ -45,29 +45,23 @@
#include "qgeopositioninfosource.h"
#include "qgeosatelliteinfosource.h"
#include <QList>
-#include <QFactoryInterface>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-
-
-class Q_LOCATION_EXPORT QGeoPositionInfoSourceFactory : public QFactoryInterface
+class Q_LOCATION_EXPORT QGeoPositionInfoSourceFactory
{
public:
virtual ~QGeoPositionInfoSourceFactory();
- virtual QString sourceName() const = 0;
- virtual int sourceVersion() const = 0;
- virtual int sourcePriority() const;
-
virtual QGeoPositionInfoSource *positionInfoSource(QObject *parent) = 0;
virtual QGeoSatelliteInfoSource *satelliteInfoSource(QObject *parent) = 0;
};
-#define QT_POSITION_SOURCE_INTERFACE "com.nokia.qt.position.sourcefactory/1.0"
-Q_DECLARE_INTERFACE(QGeoPositionInfoSourceFactory, QT_POSITION_SOURCE_INTERFACE);
+#define QT_POSITION_SOURCE_INTERFACE
+Q_DECLARE_INTERFACE(QGeoPositionInfoSourceFactory,
+ "org.qt-project.qt.position.sourcefactory/5.0");
QT_END_NAMESPACE
diff --git a/src/location/qgeosatelliteinfosource.cpp b/src/location/qgeosatelliteinfosource.cpp
index 739ff1af..d44f62e8 100644
--- a/src/location/qgeosatelliteinfosource.cpp
+++ b/src/location/qgeosatelliteinfosource.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include <qgeosatelliteinfosource.h>
#include "qgeopositioninfosourcefactory.h"
+#include "qgeopositioninfosource_p.h"
#include <QPluginLoader>
#include <QStringList>
#include <QCryptographicHash>
@@ -47,180 +48,8 @@
#include <QtCore/private/qfactoryloader_p.h>
#include <QFile>
-#if defined(QT_SIMULATOR)
-# include "qgeosatelliteinfosource_simulator_p.h"
-#elif defined(Q_OS_WINCE)
-# include "qgeosatelliteinfosource_wince_p.h"
-#elif defined(Q_WS_MAEMO_6)
-# include "qgeosatelliteinfosource_maemo_p.h"
-#elif defined(Q_WS_MAEMO_5)
-# include "qgeosatelliteinfosource_maemo5_p.h"
-#elif defined (NPE_BACKEND)
-# include "qgeosatelliteinfosource_npe_backend_p.h"
-#endif
-
-#if defined(Q_WS_MEEGO)
-#include "qgeosatelliteinfosource_maemo_p.h"
-#if defined(GYPSY_AVAILABLE)
-#include "qgeosatelliteinfosource_gypsy_p.h"
-#endif
-#endif
-
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_LIBRARY
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QT_POSITION_SOURCE_INTERFACE, QLatin1String("/position")))
-#endif
-
-class QGeoSatelliteInfoSourcePrivate
-{
-public:
- int interval;
- static QList<QGeoPositionInfoSourceFactory*> pluginsSorted();
- static QHash<QString, QGeoPositionInfoSourceFactory*> plugins(bool reload = false);
- static void loadDynamicPlugins(QHash<QString, QGeoPositionInfoSourceFactory*> &plugins);
- static void loadStaticPlugins(QHash<QString, QGeoPositionInfoSourceFactory*> &plugins);
-};
-
-QHash<QString, QGeoPositionInfoSourceFactory*> QGeoSatelliteInfoSourcePrivate::plugins(bool reload)
-{
- static QHash<QString, QGeoPositionInfoSourceFactory*> plugins;
- static bool alreadyDiscovered = false;
-
- if (reload == true)
- alreadyDiscovered = false;
-
- if (!alreadyDiscovered) {
- loadStaticPlugins(plugins);
- loadDynamicPlugins(plugins);
- alreadyDiscovered = true;
- }
- return plugins;
-}
-
-static bool pluginComparator(const QGeoPositionInfoSourceFactory *p1, const QGeoPositionInfoSourceFactory *p2)
-{
- return (p1->sourcePriority() > p2->sourcePriority());
-}
-
-QList<QGeoPositionInfoSourceFactory*> QGeoSatelliteInfoSourcePrivate::pluginsSorted()
-{
- QList<QGeoPositionInfoSourceFactory*> list = plugins().values();
- qStableSort(list.begin(), list.end(), pluginComparator);
- return list;
-}
-
-void QGeoSatelliteInfoSourcePrivate::loadDynamicPlugins(QHash<QString, QGeoPositionInfoSourceFactory *> &plugins)
-{
- QPluginLoader qpl;
- QString blockName;
-
- QSettings settings(QSettings::SystemScope, QLatin1String("Nokia"), QLatin1String("QtLocationPosAndSat"));
- QVariant value = settings.value(QLatin1String("position.plugin.operator.whitelist"));
- if (value.isValid()) {
- QStringList parts = value.toString().split(QLatin1String(","));
- if (parts.size() == 4) {
- QFile file(parts.at(1));
- file.open(QIODevice::ReadOnly);
-
- QCryptographicHash hash(QCryptographicHash::Sha1);
- while (!file.atEnd()) {
- QByteArray data = file.read(4096);
- hash.addData(data);
- }
- file.close();
-
- QByteArray hexHash = hash.result().toHex();
-
- bool loadIt = true;
- if (QString::number(file.size()) != parts.at(3)) {
- qCritical("Position info plugin: bad plugin size for %s",
- qPrintable(parts.at(1)));
- qWarning("Will fall back to platform default");
- loadIt = false;
- }
-
- if (hexHash != parts.at(2).toLatin1()) {
- qCritical("Position info plugin: bad plugin hash for %s",
- qPrintable(parts.at(1)));
- qWarning("Will fall back to platform default");
- loadIt = false;
- }
-
- if (loadIt) {
- qpl.setFileName(parts.at(1));
- QGeoPositionInfoSourceFactory *f =
- qobject_cast<QGeoPositionInfoSourceFactory*>(qpl.instance());
-
- if (f) {
- QString name = f->sourceName();
- if (name == parts.at(0)) {
- plugins.insert(name, f);
- } else {
- qCritical("Position info plugin: bad plugin name for %s",
- qPrintable(parts.at(1)));
- qWarning("Will fall back to platform default");
- }
- }
- }
-
- // still set blockName to ensure the plugin doesn't load
- blockName = parts.at(1);
- } else {
- qWarning("Position plugin whitelist: invalid format -- should be key,filename,hash,size");
- }
- }
-
- QFactoryLoader* l = loader();
- QString key;
- for (int i = 0; i < l->keys().count(); ++i) {
- key = l->keys().at(i);
- QGeoPositionInfoSourceFactory *f =
- qobject_cast<QGeoPositionInfoSourceFactory*>(l->instance(key));
- if (f) {
- const QString name = f->sourceName();
- if (name == blockName) {
- delete f;
- } else {
-#if !defined QT_NO_DEBUG
- const bool showDebug = qgetenv("QT_DEBUG_PLUGINS").toInt() > 0;
- if (showDebug)
- qDebug("Dynamic: found a service provider plugin with name %s", qPrintable(name));
-#endif
- plugins.insertMulti(name, f);
- }
- }
- }
-}
-
-void QGeoSatelliteInfoSourcePrivate::loadStaticPlugins(QHash<QString, QGeoPositionInfoSourceFactory *> &plugins)
-{
-#if !defined QT_NO_DEBUG
- const bool showDebug = qgetenv("QT_DEBUG_PLUGINS").toInt() > 0;
-#endif
-
- QObjectList staticPlugins = QPluginLoader::staticInstances();
- for (int i = 0; i < staticPlugins.count(); ++i) {
- QGeoPositionInfoSourceFactory *f =
- qobject_cast<QGeoPositionInfoSourceFactory*>(staticPlugins.at(i));
-
- if (f) {
-
- QString name = f->sourceName();
-
-#if !defined QT_NO_DEBUG
- if (showDebug)
- qDebug("Static: found a service provider plugin with name %s", qPrintable(name));
-#endif
- if (!name.isEmpty()) {
- plugins.insertMulti(name, f);
- }
- }
-
- }
-}
-
/*!
\class QGeoSatelliteInfoSource
\inmodule QtLocation
@@ -261,6 +90,12 @@ void QGeoSatelliteInfoSourcePrivate::loadStaticPlugins(QHash<QString, QGeoPositi
The default satellite source on a Windows CE device without GPS support will never provide any satellite data.
*/
+class QGeoSatelliteInfoSourcePrivate
+{
+public:
+ int interval;
+};
+
/*!
Creates a satellite source with the specified \a parent.
*/
@@ -323,63 +158,23 @@ int QGeoSatelliteInfoSource::updateInterval() const
*/
QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createDefaultSource(QObject *parent)
{
- QSettings pluginSettings(QSettings::SystemScope, QLatin1String("Nokia"), QLatin1String("QtLocationPosAndSat"));
- QVariant value = pluginSettings.value(QLatin1String("position.plugin.operator.whitelist"));
- if (value.isValid()) {
- QStringList parts = value.toString().split(QLatin1String(","));
- if (parts.size() == 4) {
- QGeoSatelliteInfoSource *source = createSource(parts.at(0), parent);
- if (source)
- return source;
- }
- }
-
-#if defined(Q_OS_WINCE)
- return new QGeoSatelliteInfoSourceWinCE(parent);
-#elif (defined(Q_WS_MAEMO_6)) || (defined(Q_WS_MAEMO_5))
- QGeoSatelliteInfoSourceMaemo *source = new QGeoSatelliteInfoSourceMaemo(parent);
- int status = source->init();
-
- if (status != -1)
- return source;
- else
- delete source;
-#elif defined(QT_SIMULATOR)
- return new QGeoSatelliteInfoSourceSimulator(parent);
-#elif defined(Q_WS_MEEGO)
- // Use Maemo6 backend if available, otherwise use Gypsy backend
- QSettings maemo6Settings(QSettings::UserScope, QLatin1String("Nokia"), QLatin1String("QtLocationPosAndSatMaemo6"));
- if (!maemo6Settings.value("maemo6satelliteavailable").isValid()) {
- QGeoSatelliteInfoSourceMaemo *maemoSource = new QGeoSatelliteInfoSourceMaemo(parent);
- int status = maemoSource->init();
- if (status == -1) {
- delete maemoSource;
- maemoSource = 0;
- maemo6Settings.setValue("maemo6satelliteavailable", false);
- } else {
- return maemoSource;
+ QGeoPositionInfoSourcePrivate *d = new QGeoPositionInfoSourcePrivate;
+
+ QList<QJsonObject> plugins = QGeoPositionInfoSourcePrivate::pluginsSorted();
+ foreach (QJsonObject obj, plugins) {
+ if (obj.value(QStringLiteral("Satellite")).isBool()
+ && obj.value(QStringLiteral("Satellite")).toBool()) {
+ d->metaData = obj;
+ d->loadPlugin();
+ QGeoSatelliteInfoSource *s = d->factory->satelliteInfoSource(parent);
+ if (s) {
+ delete d;
+ return s;
+ }
}
}
-#ifdef GYPSY_AVAILABLE
- QGeoSatelliteInfoSourceGypsy* gypsySource = new QGeoSatelliteInfoSourceGypsy(parent);
- int status = gypsySource->init();
- if (status >= 0)
- return gypsySource;
- delete gypsySource;
-#endif // GYPSY_AVAILABLE
-#elif defined(NPE_BACKEND)
- QGeoSatelliteInfoSourceNpeBackend* npeBackendSource = new QGeoSatelliteInfoSourceNpeBackend(parent);
- if (npeBackendSource->init())
- return npeBackendSource;
- else
- delete npeBackendSource;
-#endif
- foreach (QGeoPositionInfoSourceFactory *f, QGeoSatelliteInfoSourcePrivate::pluginsSorted()) {
- QGeoSatelliteInfoSource *src = f->satelliteInfoSource(parent);
- if (src)
- return src;
- }
+ delete d;
return 0;
}
@@ -391,12 +186,19 @@ QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createDefaultSource(QObject *p
*/
QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createSource(const QString &sourceName, QObject *parent)
{
- QGeoPositionInfoSourceFactory *f = QGeoSatelliteInfoSourcePrivate::plugins().value(sourceName);
- if (f) {
- QGeoSatelliteInfoSource *src = f->satelliteInfoSource(parent);
- if (src)
+ QGeoPositionInfoSourcePrivate *d = new QGeoPositionInfoSourcePrivate;
+ QHash<QString, QJsonObject> plugins = QGeoPositionInfoSourcePrivate::plugins();
+ if (plugins.contains(sourceName)) {
+ d->metaData = plugins.value(sourceName);
+ d->loadPlugin();
+ QGeoSatelliteInfoSource *src = d->factory->satelliteInfoSource(parent);
+ if (src) {
+ delete d;
return src;
+ }
}
+
+ delete d;
return 0;
}
@@ -406,7 +208,7 @@ QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createSource(const QString &so
*/
QStringList QGeoSatelliteInfoSource::availableSources()
{
- return QGeoSatelliteInfoSourcePrivate::plugins().keys();
+ return QGeoPositionInfoSourcePrivate::plugins().keys();
}
/*!
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 94f3a9d9..27f910e8 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -1,2 +1,2 @@
TEMPLATE = subdirs
-SUBDIRS += geoservices
+SUBDIRS += geoservices position
diff --git a/src/plugins/position/geoclue/geoclue.pro b/src/plugins/position/geoclue/geoclue.pro
new file mode 100644
index 00000000..1cd099d7
--- /dev/null
+++ b/src/plugins/position/geoclue/geoclue.pro
@@ -0,0 +1,30 @@
+load(qt_module)
+
+TARGET = qtposition_geoclue
+QT += location gui
+
+load(qt_plugin)
+
+DESTDIR = $$QT.location.plugins/position
+#QTDIR_build:REQUIRES += "contains(QT_CONFIG, location)"
+
+HEADERS += \
+ qgeopositioninfosource_geocluemaster_p.h \
+ qgeopositioninfosourcefactory_geoclue.h
+
+SOURCES += \
+ qgeopositioninfosource_geocluemaster_p.h \
+ qgeopositioninfosourcefactory_geoclue.cpp
+
+INCLUDEPATH += $$QT.location.includes
+
+CONFIG += qdbus link_pkgconfig
+DEFINES += GEOCLUE_MASTER_AVAILABLE=1
+PKGCONFIG += geoclue
+QMAKE_PKGCONFIG_REQUIRES += geoclue
+
+target.path += $$[QT_INSTALL_PLUGINS]/position
+INSTALLS += target
+
+OTHER_FILES += \
+ plugin.json
diff --git a/src/plugins/position/geoclue/plugin.json b/src/plugins/position/geoclue/plugin.json
new file mode 100644
index 00000000..12970207
--- /dev/null
+++ b/src/plugins/position/geoclue/plugin.json
@@ -0,0 +1,7 @@
+{
+ "Keys": ["geoclue"],
+ "Provider": "geoclue",
+ "Position": true,
+ "Satellite": false,
+ "Priority": 1000
+}
diff --git a/src/location/qgeopositioninfosource_geocluemaster.cpp b/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.cpp
index 4da6c5e5..4da6c5e5 100644
--- a/src/location/qgeopositioninfosource_geocluemaster.cpp
+++ b/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.cpp
diff --git a/src/location/qgeopositioninfosource_geocluemaster_p.h b/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster_p.h
index 8946767a..8946767a 100644
--- a/src/location/qgeopositioninfosource_geocluemaster_p.h
+++ b/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster_p.h
diff --git a/src/plugins/position/geoclue/qgeopositioninfosourcefactory_geoclue.cpp b/src/plugins/position/geoclue/qgeopositioninfosourcefactory_geoclue.cpp
new file mode 100644
index 00000000..a4389d3f
--- /dev/null
+++ b/src/plugins/position/geoclue/qgeopositioninfosourcefactory_geoclue.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeopositioninfosourcefactory_geoclue.h"
+#include "qgeopositioninfosource_geocluemaster_p.h"
+
+QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryGeoclue::positionInfoSource(QObject *parent)
+{
+ return new QGeoPositionInfoSourceGeoclueMaster(parent);
+}
+
+QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryGeoclue::satelliteInfoSource(QObject *parent)
+{
+ Q_UNUSED(parent);
+ return 0;
+}
diff --git a/src/plugins/position/geoclue/qgeopositioninfosourcefactory_geoclue.h b/src/plugins/position/geoclue/qgeopositioninfosourcefactory_geoclue.h
new file mode 100644
index 00000000..bdc896a7
--- /dev/null
+++ b/src/plugins/position/geoclue/qgeopositioninfosourcefactory_geoclue.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGEOPOSITIONINFOSOURCEFACTORY_GEOCLUE_H
+#define QGEOPOSITIONINFOSOURCEFACTORY_GEOCLUE_H
+
+#include <QObject>
+#include "qgeopositioninfosource.h"
+#include "qgeopositioninfosourcefactory.h"
+
+class QGeoPositionInfoSourceFactoryGeoclue : public QObject, public QGeoPositionInfoSourceFactory
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.qt.position.sourcefactory/5.0"
+ FILE "plugin.json")
+ Q_INTERFACES(QGeoPositionInfoSourceFactory)
+
+public:
+ QGeoPositionInfoSource *positionInfoSource(QObject *parent);
+ QGeoSatelliteInfoSource *satelliteInfoSource(QObject *parent);
+};
+
+#endif
diff --git a/src/plugins/position/gypsy/gypsy.pro b/src/plugins/position/gypsy/gypsy.pro
new file mode 100644
index 00000000..bf463379
--- /dev/null
+++ b/src/plugins/position/gypsy/gypsy.pro
@@ -0,0 +1,30 @@
+load(qt_module)
+
+TARGET = qtposition_gypsy
+QT += location gui
+
+load(qt_plugin)
+
+DESTDIR = $$QT.location.plugins/position
+#QTDIR_build:REQUIRES += "contains(QT_CONFIG, location)"
+
+HEADERS += \
+ qgeosatelliteinfosource_gypsy_p.h \
+ qgeopositioninfosourcefactory_gypsy.h
+
+SOURCES += \
+ qgeosatelliteinfosource_gypsy.cpp \
+ qgeopositioninfosourcefactory_gypsy.cpp
+
+INCLUDEPATH += $$QT.location.includes
+
+CONFIG += qdbus link_pkgconfig
+DEFINES += GYPSY_AVAILABLE=1
+PKGCONFIG += gypsy
+QMAKE_PKGCONFIG_REQUIRES += gypsy
+
+target.path += $$[QT_INSTALL_PLUGINS]/position
+INSTALLS += target
+
+OTHER_FILES += \
+ plugin.json
diff --git a/src/plugins/position/gypsy/plugin.json b/src/plugins/position/gypsy/plugin.json
new file mode 100644
index 00000000..faa990cc
--- /dev/null
+++ b/src/plugins/position/gypsy/plugin.json
@@ -0,0 +1,7 @@
+{
+ "Keys": ["gypsy"],
+ "Provider": "gypsy",
+ "Position": false,
+ "Satellite": true,
+ "Priority": 1000
+}
diff --git a/src/plugins/position/gypsy/qgeopositioninfosourcefactory_gypsy.cpp b/src/plugins/position/gypsy/qgeopositioninfosourcefactory_gypsy.cpp
new file mode 100644
index 00000000..6fe417ab
--- /dev/null
+++ b/src/plugins/position/gypsy/qgeopositioninfosourcefactory_gypsy.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeopositioninfosourcefactory_gypsy.h"
+#include "qgeosatelliteinfosource_gypsy_p.h"
+
+QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryGypsy::positionInfoSource(QObject *parent)
+{
+ Q_UNUSED(parent);
+ return 0;
+}
+
+QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryGypsy::satelliteInfoSource(QObject *parent)
+{
+ return new QGeoSatelliteInfoSourceGypsy(parent);
+}
diff --git a/src/plugins/position/gypsy/qgeopositioninfosourcefactory_gypsy.h b/src/plugins/position/gypsy/qgeopositioninfosourcefactory_gypsy.h
new file mode 100644
index 00000000..effd5164
--- /dev/null
+++ b/src/plugins/position/gypsy/qgeopositioninfosourcefactory_gypsy.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGEOPOSITIONINFOSOURCEFACTORY_GYPSY_H
+#define QGEOPOSITIONINFOSOURCEFACTORY_GYPSY_H
+
+#include <QObject>
+#include "qgeopositioninfosource.h"
+#include "qgeopositioninfosourcefactory.h"
+
+class QGeoPositionInfoSourceFactoryGypsy : public QObject, public QGeoPositionInfoSourceFactory
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.qt.position.sourcefactory/5.0"
+ FILE "plugin.json")
+ Q_INTERFACES(QGeoPositionInfoSourceFactory)
+
+public:
+ QGeoPositionInfoSource *positionInfoSource(QObject *parent);
+ QGeoSatelliteInfoSource *satelliteInfoSource(QObject *parent);
+};
+
+#endif
diff --git a/src/location/qgeosatelliteinfosource_gypsy.cpp b/src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy.cpp
index 9cc3a58c..9cc3a58c 100644
--- a/src/location/qgeosatelliteinfosource_gypsy.cpp
+++ b/src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy.cpp
diff --git a/src/location/qgeosatelliteinfosource_gypsy_p.h b/src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy_p.h
index 956836ad..956836ad 100644
--- a/src/location/qgeosatelliteinfosource_gypsy_p.h
+++ b/src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy_p.h
diff --git a/src/location/dbuscomm_maemo.cpp b/src/plugins/position/maemo/dbuscomm_maemo.cpp
index 5f0d0aa0..5f0d0aa0 100644
--- a/src/location/dbuscomm_maemo.cpp
+++ b/src/plugins/position/maemo/dbuscomm_maemo.cpp
diff --git a/src/location/dbuscomm_maemo_p.h b/src/plugins/position/maemo/dbuscomm_maemo_p.h
index ca25d7d9..ca25d7d9 100644
--- a/src/location/dbuscomm_maemo_p.h
+++ b/src/plugins/position/maemo/dbuscomm_maemo_p.h
diff --git a/src/location/dbusserver_maemo.cpp b/src/plugins/position/maemo/dbusserver_maemo.cpp
index ca73b85e..ca73b85e 100644
--- a/src/location/dbusserver_maemo.cpp
+++ b/src/plugins/position/maemo/dbusserver_maemo.cpp
diff --git a/src/location/dbusserver_maemo_p.h b/src/plugins/position/maemo/dbusserver_maemo_p.h
index 7118f7e8..7118f7e8 100644
--- a/src/location/dbusserver_maemo_p.h
+++ b/src/plugins/position/maemo/dbusserver_maemo_p.h
diff --git a/src/plugins/position/maemo/maemo.pro b/src/plugins/position/maemo/maemo.pro
new file mode 100644
index 00000000..da35fe89
--- /dev/null
+++ b/src/plugins/position/maemo/maemo.pro
@@ -0,0 +1,29 @@
+load(qt_module)
+
+TARGET = qtposition_maemo
+QT += location gui
+
+load(qt_plugin)
+
+DESTDIR = $$QT.location.plugins/position
+#QTDIR_build:REQUIRES += "contains(QT_CONFIG, location)"
+
+INCLUDEPATH += $$QT.location.includes
+
+CONFIG += qdbus link_pkgconfig
+SOURCES += qgeopositioninfosource_maemo.cpp \
+ qgeosatelliteinfosource_maemo.cpp \
+ dbuscomm_maemo.cpp \
+ dbusserver_maemo.cpp \
+ qgeopositioninfosourcefactory_maemo.cpp
+HEADERS += qgeopositioninfosource_maemo_p.h \
+ qgeosatelliteinfosource_maemo_p.h \
+ dbuscomm_maemo_p.h \
+ dbusserver_maemo_p.h \
+ qgeopositioninfosourcefactory_maemo.h
+
+target.path += $$[QT_INSTALL_PLUGINS]/position
+INSTALLS += target
+
+OTHER_FILES += \
+ plugin.json
diff --git a/src/plugins/position/maemo/plugin.json b/src/plugins/position/maemo/plugin.json
new file mode 100644
index 00000000..f6d85747
--- /dev/null
+++ b/src/plugins/position/maemo/plugin.json
@@ -0,0 +1,7 @@
+{
+ "Keys": ["maemo"],
+ "Provider": "maemo",
+ "Position": true,
+ "Satellite": true,
+ "Priority": 1000
+}
diff --git a/src/location/qgeopositioninfosource_maemo.cpp b/src/plugins/position/maemo/qgeopositioninfosource_maemo.cpp
index 0305c69c..0305c69c 100644
--- a/src/location/qgeopositioninfosource_maemo.cpp
+++ b/src/plugins/position/maemo/qgeopositioninfosource_maemo.cpp
diff --git a/src/location/qgeopositioninfosource_maemo_p.h b/src/plugins/position/maemo/qgeopositioninfosource_maemo_p.h
index e82ba344..e82ba344 100644
--- a/src/location/qgeopositioninfosource_maemo_p.h
+++ b/src/plugins/position/maemo/qgeopositioninfosource_maemo_p.h
diff --git a/src/plugins/position/maemo/qgeopositioninfosourcefactory_maemo.cpp b/src/plugins/position/maemo/qgeopositioninfosourcefactory_maemo.cpp
new file mode 100644
index 00000000..fb1240ca
--- /dev/null
+++ b/src/plugins/position/maemo/qgeopositioninfosourcefactory_maemo.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeopositioninfosourcefactory_maemo.h"
+#include "qgeopositioninfosource_maemo_p.h"
+#include "qgeosatelliteinfosource_maemo_p.h"
+
+QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryMaemo::positionInfoSource(QObject *parent)
+{
+ return new QGeoPositionInfoSourceMaemo(parent);
+}
+
+QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryMaemo::satelliteInfoSource(QObject *parent)
+{
+ return new QGeoSatelliteInfoSourceMaemo(parent);
+}
diff --git a/src/plugins/position/maemo/qgeopositioninfosourcefactory_maemo.h b/src/plugins/position/maemo/qgeopositioninfosourcefactory_maemo.h
new file mode 100644
index 00000000..83c58599
--- /dev/null
+++ b/src/plugins/position/maemo/qgeopositioninfosourcefactory_maemo.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGEOPOSITIONINFOSOURCEFACTORY_MAEMO_H
+#define QGEOPOSITIONINFOSOURCEFACTORY_MAEMO_H
+
+#include <QObject>
+#include "qgeopositioninfosource.h"
+#include "qgeopositioninfosourcefactory.h"
+
+class QGeoPositionInfoSourceFactoryMaemo : public QObject, public QGeoPositionInfoSourceFactory
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.qt.position.sourcefactory/5.0"
+ FILE "plugin.json")
+ Q_INTERFACES(QGeoPositionInfoSourceFactory)
+
+public:
+ QGeoPositionInfoSource *positionInfoSource(QObject *parent);
+ QGeoSatelliteInfoSource *satelliteInfoSource(QObject *parent);
+};
+
+#endif
diff --git a/src/location/qgeosatelliteinfosource_maemo.cpp b/src/plugins/position/maemo/qgeosatelliteinfosource_maemo.cpp
index 4922549b..4922549b 100644
--- a/src/location/qgeosatelliteinfosource_maemo.cpp
+++ b/src/plugins/position/maemo/qgeosatelliteinfosource_maemo.cpp
diff --git a/src/location/qgeosatelliteinfosource_maemo_p.h b/src/plugins/position/maemo/qgeosatelliteinfosource_maemo_p.h
index dfa1494b..dfa1494b 100644
--- a/src/location/qgeosatelliteinfosource_maemo_p.h
+++ b/src/plugins/position/maemo/qgeosatelliteinfosource_maemo_p.h
diff --git a/src/plugins/position/npe_backend/npe_backend.pro b/src/plugins/position/npe_backend/npe_backend.pro
new file mode 100644
index 00000000..ca2122eb
--- /dev/null
+++ b/src/plugins/position/npe_backend/npe_backend.pro
@@ -0,0 +1,31 @@
+load(qt_module)
+
+TARGET = qtposition_npe_backend
+QT += location gui
+
+load(qt_plugin)
+
+DESTDIR = $$QT.location.plugins/position
+#QTDIR_build:REQUIRES += "contains(QT_CONFIG, location)"
+
+INCLUDEPATH += $$QT.location.includes
+
+DEFINES += NPE_BACKEND
+INCLUDEPATH += $$[QT_INSTALL_PREFIX]/include/mtlocationd
+#unix {
+# CONFIG += link_pkgconfig
+# PKGCONFIG += mtlocationd
+#}
+LIBS += -lmtlocationd
+SOURCES += qgeopositioninfosource_npe_backend.cpp \
+ qgeosatelliteinfosource_npe_backend.cpp \
+ qgeopositioninfosourcefactory_npe_backend.cpp
+HEADERS += qgeopositioninfosource_npe_backend_p.h \
+ qgeosatelliteinfosource_npe_backend_p.h \
+ qgeopositioninfosourcefactory_npe_backend.h
+
+target.path += $$[QT_INSTALL_PLUGINS]/position
+INSTALLS += target
+
+OTHER_FILES += \
+ plugin.json
diff --git a/src/plugins/position/npe_backend/plugin.json b/src/plugins/position/npe_backend/plugin.json
new file mode 100644
index 00000000..4fdc1be6
--- /dev/null
+++ b/src/plugins/position/npe_backend/plugin.json
@@ -0,0 +1,7 @@
+{
+ "Keys": ["npe_backend"],
+ "Provider": "npe_backend",
+ "Position": true,
+ "Satellite": true,
+ "Priority": 1000
+}
diff --git a/src/location/qgeopositioninfosource_npe_backend.cpp b/src/plugins/position/npe_backend/qgeopositioninfosource_npe_backend.cpp
index 0807f8b2..0807f8b2 100644
--- a/src/location/qgeopositioninfosource_npe_backend.cpp
+++ b/src/plugins/position/npe_backend/qgeopositioninfosource_npe_backend.cpp
diff --git a/src/location/qgeopositioninfosource_npe_backend_p.h b/src/plugins/position/npe_backend/qgeopositioninfosource_npe_backend_p.h
index 36d16c7a..36d16c7a 100644
--- a/src/location/qgeopositioninfosource_npe_backend_p.h
+++ b/src/plugins/position/npe_backend/qgeopositioninfosource_npe_backend_p.h
diff --git a/src/plugins/position/npe_backend/qgeopositioninfosourcefactory_npe_backend.cpp b/src/plugins/position/npe_backend/qgeopositioninfosourcefactory_npe_backend.cpp
new file mode 100644
index 00000000..422a7a3f
--- /dev/null
+++ b/src/plugins/position/npe_backend/qgeopositioninfosourcefactory_npe_backend.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeopositioninfosourcefactory_npe_backend.h"
+#include "qgeopositioninfosource_npe_backend_p.h"
+#include "qgeosatelliteinfosource_npe_backend_p.h"
+
+QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryNpeBackend::positionInfoSource(QObject *parent)
+{
+ return new QGeoPositionInfoSourceNpeBackend(parent);
+}
+
+QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryNpeBackend::satelliteInfoSource(QObject *parent)
+{
+ return new QGeoSatelliteInfoSourceNpeBackend(parent);
+}
diff --git a/src/plugins/position/npe_backend/qgeopositioninfosourcefactory_npe_backend.h b/src/plugins/position/npe_backend/qgeopositioninfosourcefactory_npe_backend.h
new file mode 100644
index 00000000..bd87062c
--- /dev/null
+++ b/src/plugins/position/npe_backend/qgeopositioninfosourcefactory_npe_backend.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGEOPOSITIONINFOSOURCEFACTORY_NPE_BACKEND_H
+#define QGEOPOSITIONINFOSOURCEFACTORY_NPE_BACKEND_H
+
+#include <QObject>
+#include "qgeopositioninfosource.h"
+#include "qgeopositioninfosourcefactory.h"
+
+class QGeoPositionInfoSourceFactoryNpeBackend : public QObject, public QGeoPositionInfoSourceFactory
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.qt.position.sourcefactory/5.0"
+ FILE "plugin.json")
+ Q_INTERFACES(QGeoPositionInfoSourceFactory)
+
+public:
+ QGeoPositionInfoSource *positionInfoSource(QObject *parent);
+ QGeoSatelliteInfoSource *satelliteInfoSource(QObject *parent);
+};
+
+#endif
diff --git a/src/location/qgeosatelliteinfosource_npe_backend.cpp b/src/plugins/position/npe_backend/qgeosatelliteinfosource_npe_backend.cpp
index 47b6514e..47b6514e 100644
--- a/src/location/qgeosatelliteinfosource_npe_backend.cpp
+++ b/src/plugins/position/npe_backend/qgeosatelliteinfosource_npe_backend.cpp
diff --git a/src/location/qgeosatelliteinfosource_npe_backend_p.h b/src/plugins/position/npe_backend/qgeosatelliteinfosource_npe_backend_p.h
index 1a8f3568..1a8f3568 100644
--- a/src/location/qgeosatelliteinfosource_npe_backend_p.h
+++ b/src/plugins/position/npe_backend/qgeosatelliteinfosource_npe_backend_p.h
diff --git a/src/plugins/position/position.pro b/src/plugins/position/position.pro
new file mode 100644
index 00000000..cdfc5379
--- /dev/null
+++ b/src/plugins/position/position.pro
@@ -0,0 +1,9 @@
+TEMPLATE = subdirs
+
+maemo6|meego:SUBDIRS += maemo
+meego {
+ contains (geoclue-master_enabled, yes):SUBDIRS += geoclue
+ contains (gypsy_enabled, yes):SUBDIRS += gypsy
+}
+contains(config_test_locationd, yes):!simulator:SUBDIRS += npe_backend
+simulator:SUBDIRS += simulator
diff --git a/src/plugins/position/simulator/plugin.json b/src/plugins/position/simulator/plugin.json
new file mode 100644
index 00000000..257640e0
--- /dev/null
+++ b/src/plugins/position/simulator/plugin.json
@@ -0,0 +1,7 @@
+{
+ "Keys": ["simulator"],
+ "Provider": "simulator",
+ "Position": true,
+ "Satellite": true,
+ "Priority": 1000
+}
diff --git a/src/location/qgeopositioninfosource_simulator.cpp b/src/plugins/position/simulator/qgeopositioninfosource_simulator.cpp
index f1b213d0..f1b213d0 100644
--- a/src/location/qgeopositioninfosource_simulator.cpp
+++ b/src/plugins/position/simulator/qgeopositioninfosource_simulator.cpp
diff --git a/src/location/qgeopositioninfosource_simulator_p.h b/src/plugins/position/simulator/qgeopositioninfosource_simulator_p.h
index f696ac8a..f696ac8a 100644
--- a/src/location/qgeopositioninfosource_simulator_p.h
+++ b/src/plugins/position/simulator/qgeopositioninfosource_simulator_p.h
diff --git a/src/plugins/position/simulator/qgeopositioninfosourcefactory_simulator.cpp b/src/plugins/position/simulator/qgeopositioninfosourcefactory_simulator.cpp
new file mode 100644
index 00000000..07256588
--- /dev/null
+++ b/src/plugins/position/simulator/qgeopositioninfosourcefactory_simulator.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeopositioninfosourcefactory_simulator.h"
+
+QGeoPositionInfoSource *QGeoPositionInfoSourceFactorySimulator::positionInfoSource(QObject *parent)
+{
+ return new QGeoPositionInfoSourceSimulator(parent);
+}
+
+QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactorySimulator::satelliteInfoSource(QObject *parent)
+{
+ return new QGeoSatelliteInfoSourceSimulator(parent);
+}
diff --git a/src/plugins/position/simulator/qgeopositioninfosourcefactory_simulator.h b/src/plugins/position/simulator/qgeopositioninfosourcefactory_simulator.h
new file mode 100644
index 00000000..846658f2
--- /dev/null
+++ b/src/plugins/position/simulator/qgeopositioninfosourcefactory_simulator.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGEOPOSITIONINFOSOURCEFACTORY_SIMULATOR_H
+#define QGEOPOSITIONINFOSOURCEFACTORY_SIMULATOR_H
+
+#include <QObject>
+#include <QGeoPositionInfoSourceFactory>
+
+#include "qgeopositioninfosource_simulator_p.h"
+#include "qgeosatelliteinfosource_simulator_p.h"
+
+class QGeoPositionInfoSourceFactorySimulator : public QObject, public QGeoPositionInfoSourceFactory
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.qt.position.sourcefactory/5.0"
+ FILE "plugin.json")
+ Q_INTERFACES(QGeoPositionInfoSourceFactory)
+public:
+ QGeoPositionInfoSource *positionInfoSource(QObject *parent);
+ QGeoSatelliteInfoSource *satelliteInfoSource(QObject *parent);
+};
+
+#endif // QGEOPOSITIONINFOSOURCEFACTORY_SIMULATOR_H
diff --git a/src/location/qgeosatelliteinfosource_simulator.cpp b/src/plugins/position/simulator/qgeosatelliteinfosource_simulator.cpp
index 6840f55e..6840f55e 100644
--- a/src/location/qgeosatelliteinfosource_simulator.cpp
+++ b/src/plugins/position/simulator/qgeosatelliteinfosource_simulator.cpp
diff --git a/src/location/qgeosatelliteinfosource_simulator_p.h b/src/plugins/position/simulator/qgeosatelliteinfosource_simulator_p.h
index 0d76a375..0d76a375 100644
--- a/src/location/qgeosatelliteinfosource_simulator_p.h
+++ b/src/plugins/position/simulator/qgeosatelliteinfosource_simulator_p.h
diff --git a/src/location/qlocationconnection_simulator.cpp b/src/plugins/position/simulator/qlocationconnection_simulator.cpp
index a35419e1..a35419e1 100644
--- a/src/location/qlocationconnection_simulator.cpp
+++ b/src/plugins/position/simulator/qlocationconnection_simulator.cpp
diff --git a/src/location/qlocationconnection_simulator_p.h b/src/plugins/position/simulator/qlocationconnection_simulator_p.h
index 22cc3b63..22cc3b63 100644
--- a/src/location/qlocationconnection_simulator_p.h
+++ b/src/plugins/position/simulator/qlocationconnection_simulator_p.h
diff --git a/src/location/qlocationdata_simulator.cpp b/src/plugins/position/simulator/qlocationdata_simulator.cpp
index 85441877..85441877 100644
--- a/src/location/qlocationdata_simulator.cpp
+++ b/src/plugins/position/simulator/qlocationdata_simulator.cpp
diff --git a/src/location/qlocationdata_simulator_p.h b/src/plugins/position/simulator/qlocationdata_simulator_p.h
index 200f46c6..200f46c6 100644
--- a/src/location/qlocationdata_simulator_p.h
+++ b/src/plugins/position/simulator/qlocationdata_simulator_p.h
diff --git a/src/plugins/position/simulator/simulator.pro b/src/plugins/position/simulator/simulator.pro
new file mode 100644
index 00000000..f2c59635
--- /dev/null
+++ b/src/plugins/position/simulator/simulator.pro
@@ -0,0 +1,30 @@
+load(qt_module)
+
+TARGET = qtposition_simulator
+QT += location gui
+
+load(qt_plugin)
+
+DESTDIR = $$QT.location.plugins/position
+#QTDIR_build:REQUIRES += "contains(QT_CONFIG, location)"
+
+INCLUDEPATH += $$QT.location.includes
+
+QT += simulator
+DEFINES += QT_SIMULATOR
+SOURCES += qgeopositioninfosource_simulator.cpp \
+ qlocationdata_simulator.cpp \
+ qgeosatelliteinfosource_simulator.cpp \
+ qlocationconnection_simulator.cpp \
+ qgeopositioninfosourcefactory_simulator.cpp
+HEADERS += qgeopositioninfosource_simulator_p.h \
+ qlocationdata_simulator_p.h \
+ qgeosatelliteinfosource_simulator_p.h \
+ qlocationconnection_simulator_p.h \
+ qgeopositioninfosourcefactory_simulator.h
+
+target.path += $$[QT_INSTALL_PLUGINS]/position
+INSTALLS += target
+
+OTHER_FILES += \
+ plugin.json
diff --git a/tests/auto/positionplugin/plugin.cpp b/tests/auto/positionplugin/plugin.cpp
index b2457acc..ffa54610 100644
--- a/tests/auto/positionplugin/plugin.cpp
+++ b/tests/auto/positionplugin/plugin.cpp
@@ -183,28 +183,15 @@ void DummySource::doTimeout()
class QGeoPositionInfoSourceFactoryTest : public QObject, public QGeoPositionInfoSourceFactory
{
Q_OBJECT
- Q_INTERFACES(QGeoPositionInfoSourceFactory:QFactoryInterface)
+ Q_PLUGIN_METADATA(IID "org.qt-project.qt.position.sourcefactory/5.0"
+ FILE "plugin.json")
+ Q_INTERFACES(QGeoPositionInfoSourceFactory)
public:
- QString sourceName() const;
- int sourceVersion() const;
-
- QStringList keys() const { return QStringList() << QLatin1String("testposition.source"); }
-
QGeoPositionInfoSource *positionInfoSource(QObject *parent);
QGeoSatelliteInfoSource *satelliteInfoSource(QObject *parent);
};
-QString QGeoPositionInfoSourceFactoryTest::sourceName() const
-{
- return QLatin1String("test.source");
-}
-
-int QGeoPositionInfoSourceFactoryTest::sourceVersion() const
-{
- return 1;
-}
-
QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryTest::positionInfoSource(QObject *parent)
{
return new DummySource(parent);
@@ -217,6 +204,4 @@ QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryTest::satelliteInfoSource(
return 0;
}
-Q_EXPORT_PLUGIN2(qtposition_testplugin, QGeoPositionInfoSourceFactoryTest)
-
#include "plugin.moc"
diff --git a/tests/auto/positionplugin/plugin.json b/tests/auto/positionplugin/plugin.json
new file mode 100644
index 00000000..147b7d40
--- /dev/null
+++ b/tests/auto/positionplugin/plugin.json
@@ -0,0 +1,7 @@
+{
+ "Keys": ["test.source"],
+ "Provider": "test.source",
+ "Position": true,
+ "Satellite": false,
+ "Priority": 0
+}
diff --git a/tests/auto/positionplugin/positionplugin.pro b/tests/auto/positionplugin/positionplugin.pro
index 4e34d953..e9c3520a 100644
--- a/tests/auto/positionplugin/positionplugin.pro
+++ b/tests/auto/positionplugin/positionplugin.pro
@@ -9,3 +9,6 @@ SOURCES += plugin.cpp
target.path += $$[QT_INSTALL_PLUGINS]/position
INSTALLS += target
+
+OTHER_FILES += \
+ plugin.json