diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-12-08 18:52:08 +0100 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-12-15 11:01:44 +0000 |
commit | c43be043b33189a518ff2705678fbadaf3cb1332 (patch) | |
tree | 92a30100b71892d6f776e6f800335d613aef3d13 /src | |
parent | 8796a64476bcaa1bac944cb1fefcbcba1a0012d6 (diff) | |
download | qtlocation-c43be043b33189a518ff2705678fbadaf3cb1332.tar.gz |
Move QtPositioning QML wrappers into declarativepositioning module
In this way it will be possible to use these types in additional QML
plugins/components
Change-Id: Ie82e37877198b99a98ff4a2b076f39f6a9e4fe32
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/positioning/positioning.cpp | 4 | ||||
-rw-r--r-- | src/imports/positioning/positioning.pro | 15 | ||||
-rw-r--r-- | src/positioningquick/positioningquick.pro | 10 | ||||
-rw-r--r-- | src/positioningquick/qdeclarativeposition.cpp (renamed from src/imports/positioning/qdeclarativeposition.cpp) | 5 | ||||
-rw-r--r-- | src/positioningquick/qdeclarativeposition_p.h (renamed from src/imports/positioning/qdeclarativeposition_p.h) | 4 | ||||
-rw-r--r-- | src/positioningquick/qdeclarativepositionsource.cpp (renamed from src/imports/positioning/qdeclarativepositionsource.cpp) | 13 | ||||
-rw-r--r-- | src/positioningquick/qdeclarativepositionsource_p.h (renamed from src/imports/positioning/qdeclarativepositionsource_p.h) | 4 | ||||
-rw-r--r-- | src/positioningquick/qpositioningquickglobal.h | 69 | ||||
-rw-r--r-- | src/positioningquick/qpositioningquickglobal_p.h | 61 | ||||
-rw-r--r-- | src/src.pro | 5 |
10 files changed, 168 insertions, 22 deletions
diff --git a/src/imports/positioning/positioning.cpp b/src/imports/positioning/positioning.cpp index a324905b..0dd5b968 100644 --- a/src/imports/positioning/positioning.cpp +++ b/src/imports/positioning/positioning.cpp @@ -42,8 +42,8 @@ #include <QtPositioning/private/qdeclarativegeolocation_p.h> #include <QtPositioning/private/qwebmercator_p.h> -#include "qdeclarativepositionsource_p.h" -#include "qdeclarativeposition_p.h" +#include <QtPositioningQuick/private/qdeclarativepositionsource_p.h> +#include <QtPositioningQuick/private/qdeclarativeposition_p.h> #include "qquickgeocoordinateanimation_p.h" #include "locationsingleton.h" diff --git a/src/imports/positioning/positioning.pro b/src/imports/positioning/positioning.pro index 119c3dea..f2387282 100644 --- a/src/imports/positioning/positioning.pro +++ b/src/imports/positioning/positioning.pro @@ -1,18 +1,9 @@ -QT += quick-private positioning-private qml-private core-private +QT += quick-private positioning-private positioningquick-private qml-private core-private INCLUDEPATH *= $$PWD -HEADERS += qdeclarativeposition_p.h \ - qdeclarativepositionsource_p.h \ - locationsingleton.h \ - qquickgeocoordinateanimation_p.h \ - qquickgeocoordinateanimation_p_p.h - -SOURCES += qdeclarativeposition.cpp \ - positioning.cpp \ - qdeclarativepositionsource.cpp \ - locationsingleton.cpp \ - qquickgeocoordinateanimation.cpp +HEADERS += $$files(*.h) +SOURCES += $$files(*.cpp) load(qml_plugin) diff --git a/src/positioningquick/positioningquick.pro b/src/positioningquick/positioningquick.pro new file mode 100644 index 00000000..75bd68a3 --- /dev/null +++ b/src/positioningquick/positioningquick.pro @@ -0,0 +1,10 @@ +TARGET = QtPositioningQuick +QT = quick-private positioning-private qml-private core-private +CONFIG += simd optimize_full + +INCLUDEPATH += $$PWD + +SOURCES += $$files(*.cpp) +HEADERS += $$files(*.h) + +load(qt_module) diff --git a/src/imports/positioning/qdeclarativeposition.cpp b/src/positioningquick/qdeclarativeposition.cpp index b543700b..7e72f358 100644 --- a/src/imports/positioning/qdeclarativeposition.cpp +++ b/src/positioningquick/qdeclarativeposition.cpp @@ -195,6 +195,11 @@ void QDeclarativePosition::setPosition(const QGeoPositionInfo &info) emit magneticVariationValidChanged(); } +const QGeoPositionInfo &QDeclarativePosition::position() const +{ + return m_info; +} + /*! \qmlproperty coordinate Position::coordinate diff --git a/src/imports/positioning/qdeclarativeposition_p.h b/src/positioningquick/qdeclarativeposition_p.h index 208d81cc..141c37b7 100644 --- a/src/imports/positioning/qdeclarativeposition_p.h +++ b/src/positioningquick/qdeclarativeposition_p.h @@ -56,11 +56,12 @@ #include <QtCore/QObject> #include <QtCore/QDateTime> #include <QtQml/qqml.h> +#include <QtPositioningQuick/private/qpositioningquickglobal_p.h> #include <QtPositioning/QGeoPositionInfo> QT_BEGIN_NAMESPACE -class QDeclarativePosition : public QObject +class Q_POSITIONINGQUICK_PRIVATE_EXPORT QDeclarativePosition : public QObject { Q_OBJECT @@ -114,6 +115,7 @@ public: double magneticVariation() const; void setPosition(const QGeoPositionInfo &info); + const QGeoPositionInfo &position() const; Q_SIGNALS: void latitudeValidChanged(); diff --git a/src/imports/positioning/qdeclarativepositionsource.cpp b/src/positioningquick/qdeclarativepositionsource.cpp index 05232d51..cfb1df29 100644 --- a/src/imports/positioning/qdeclarativepositionsource.cpp +++ b/src/positioningquick/qdeclarativepositionsource.cpp @@ -259,11 +259,11 @@ void QDeclarativePositionSource::setNmeaSource(const QUrl &nmeaSource) // ways: "file:///", "qrc:///", "/", "" in platform dependent manner. QString localFileName = nmeaSource.toString(); if (!QFile::exists(localFileName)) { - if (localFileName.startsWith("qrc:///")) { + if (localFileName.startsWith(QStringLiteral("qrc:///"))) { localFileName.remove(0, 7); - } else if (localFileName.startsWith("file:///")) { + } else if (localFileName.startsWith(QStringLiteral("file:///"))) { localFileName.remove(0, 7); - } else if (localFileName.startsWith("qrc:/")) { + } else if (localFileName.startsWith(QStringLiteral("qrc:/"))) { localFileName.remove(0, 5); } if (!QFile::exists(localFileName) && localFileName.startsWith('/')) { @@ -289,7 +289,7 @@ void QDeclarativePositionSource::setNmeaSource(const QUrl &nmeaSource) delete m_nmeaFile; m_nmeaFile = new QFile(localFileName); if (!m_nmeaFile->exists()) { - localFileName.prepend(":"); + localFileName.prepend(':'); m_nmeaFile->setFileName(localFileName); } if (m_nmeaFile->exists()) { @@ -699,6 +699,11 @@ QDeclarativePositionSource::SourceError QDeclarativePositionSource::sourceError( return m_sourceError; } +QGeoPositionInfoSource *QDeclarativePositionSource::positionSource() const +{ + return m_positionSource; +} + void QDeclarativePositionSource::componentComplete() { if (!m_positionSource) { diff --git a/src/imports/positioning/qdeclarativepositionsource_p.h b/src/positioningquick/qdeclarativepositionsource_p.h index f7852346..bb9b618a 100644 --- a/src/imports/positioning/qdeclarativepositionsource_p.h +++ b/src/positioningquick/qdeclarativepositionsource_p.h @@ -56,6 +56,7 @@ #include <QtCore/QObject> #include <QtNetwork/QAbstractSocket> #include <QtQml/QQmlParserStatus> +#include <QtPositioningQuick/private/qpositioningquickglobal_p.h> #include <QtPositioning/QGeoPositionInfoSource> QT_BEGIN_NAMESPACE @@ -63,7 +64,7 @@ QT_BEGIN_NAMESPACE class QFile; class QTcpSocket; -class QDeclarativePositionSource : public QObject, public QQmlParserStatus +class Q_POSITIONINGQUICK_PRIVATE_EXPORT QDeclarativePositionSource : public QObject, public QQmlParserStatus { Q_OBJECT @@ -120,6 +121,7 @@ public: PositioningMethods supportedPositioningMethods() const; PositioningMethods preferredPositioningMethods() const; SourceError sourceError() const; + QGeoPositionInfoSource *positionSource() const; // Virtuals from QQmlParserStatus void classBegin() { } diff --git a/src/positioningquick/qpositioningquickglobal.h b/src/positioningquick/qpositioningquickglobal.h new file mode 100644 index 00000000..214e4628 --- /dev/null +++ b/src/positioningquick/qpositioningquickglobal.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtPositioning module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and 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 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.LGPL3 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-3.0.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 (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QPOSITIONINGQUICKGLOBAL_H +#define QPOSITIONINGQUICKGLOBAL_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qglobal.h> + +QT_BEGIN_NAMESPACE + +#ifndef QT_STATIC +# if defined(QT_BUILD_POSITIONINGQUICK_LIB) +# define Q_POSITIONINGQUICK_EXPORT Q_DECL_EXPORT +# else +# define Q_POSITIONINGQUICK_EXPORT Q_DECL_IMPORT +# endif +#else +# define Q_POSITIONINGQUICK_EXPORT +#endif + +QT_END_NAMESPACE + +#endif // QPOSITIONINGQUICKGLOBAL_H diff --git a/src/positioningquick/qpositioningquickglobal_p.h b/src/positioningquick/qpositioningquickglobal_p.h new file mode 100644 index 00000000..46e40f25 --- /dev/null +++ b/src/positioningquick/qpositioningquickglobal_p.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtPositioning module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and 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 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.LGPL3 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-3.0.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 (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QPOSITIONINGQUICKGLOBAL_P_H +#define QPOSITIONINGQUICKGLOBAL_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 "qpositioningquickglobal.h" + +QT_BEGIN_NAMESPACE + +#define Q_POSITIONINGQUICK_PRIVATE_EXPORT Q_POSITIONINGQUICK_EXPORT + +QT_END_NAMESPACE + +#endif // QPOSITIONINGQUICKGLOBAL_P_H diff --git a/src/src.pro b/src/src.pro index 54b3819a..74c5ac4c 100644 --- a/src/src.pro +++ b/src/src.pro @@ -11,13 +11,14 @@ SUBDIRS += positioning positioning.depends = clip2tri qtHaveModule(quick) { - SUBDIRS += location + SUBDIRS += positioningquick location + positioningquick.depends += positioning location.depends += positioning clip2tri plugins.depends += location SUBDIRS += imports - imports.depends += positioning location + imports.depends += positioningquick positioning location } plugins.depends += positioning |