1 /****************************************************************************
2 **
3 ** Copyright (C) 2018 The Qt Company Ltd.
4 ** Contact: http://www.qt.io/licensing/
5 **
6 ** This file is part of the QtLocation module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL3$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see http://www.qt.io/terms-conditions. For further
15 ** information use the contact form at http://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPLv3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or later as published by the Free
28 ** Software Foundation and appearing in the file LICENSE.GPL included in
29 ** the packaging of this file. Please review the following information to
30 ** ensure the GNU General Public License version 2.0 requirements will be
31 ** met: http://www.gnu.org/licenses/gpl-2.0.html.
32 **
33 ** $QT_END_LICENSE$
34 **
35 ****************************************************************************/
36 
37 #include "qgeoroute.h"
38 #include "qnavigationmanagerengine_p.h"
39 
40 QT_BEGIN_NAMESPACE
41 
42 class QNavigationManagerEnginePrivate
43 {
44 public:
45     QString managerName;
46     int managerVersion;
47     QLocale locale;
48     QLocale::MeasurementSystem measurementSystem;
49     bool initialized = false;
50 };
51 
52 class QAbstractNavigatorPrivate
53 {
54 public:
55     QLocale locale;
56     QLocale::MeasurementSystem measurementSystem;
57 };
58 
QAbstractNavigator(QObject * parent)59 QAbstractNavigator::QAbstractNavigator(QObject *parent)
60     : QObject(parent)
61     , d(new QAbstractNavigatorPrivate)
62 {
63 }
64 
~QAbstractNavigator()65 QAbstractNavigator::~QAbstractNavigator()
66 {
67 }
68 
setLocale(const QLocale & locale)69 void QAbstractNavigator::setLocale(const QLocale &locale)
70 {
71     d->locale = locale;
72 }
73 
locale() const74 QLocale QAbstractNavigator::locale() const
75 {
76     return  d->locale;
77 }
78 
setMeasurementSystem(QLocale::MeasurementSystem system)79 void QAbstractNavigator::setMeasurementSystem(QLocale::MeasurementSystem system)
80 {
81     d->measurementSystem = system;
82 }
83 
measurementSystem() const84 QLocale::MeasurementSystem QAbstractNavigator::measurementSystem() const
85 {
86     return d->measurementSystem;
87 }
88 
nextManeuverIcon() const89 QVariant QAbstractNavigator::nextManeuverIcon() const
90 {
91     return QVariant();
92 }
93 
distanceToNextManeuver() const94 double QAbstractNavigator::distanceToNextManeuver() const
95 {
96     return qQNaN();
97 }
98 
timeToNextManeuver() const99 int QAbstractNavigator::timeToNextManeuver() const
100 {
101     return -1;
102 }
103 
remainingTravelTime() const104 int QAbstractNavigator::remainingTravelTime() const
105 {
106     return -1;
107 }
108 
remainingTravelDistance() const109 double QAbstractNavigator::remainingTravelDistance() const
110 {
111     return qQNaN();
112 }
113 
remainingTravelTimeToNextWaypoint() const114 int QAbstractNavigator::remainingTravelTimeToNextWaypoint() const
115 {
116     return -1;
117 }
118 
remainingTravelDistanceToNextWaypoint() const119 double QAbstractNavigator::remainingTravelDistanceToNextWaypoint() const
120 {
121     return qQNaN();
122 }
123 
traveledDistance() const124 double QAbstractNavigator::traveledDistance() const
125 {
126     return 0;
127 }
128 
traveledTime() const129 int QAbstractNavigator::traveledTime() const
130 {
131     return 0;
132 }
133 
currentRoute() const134 QGeoRoute QAbstractNavigator::currentRoute() const
135 {
136     return QGeoRoute();
137 }
138 
currentRouteLeg() const139 QGeoRouteLeg QAbstractNavigator::currentRouteLeg() const
140 {
141     return QGeoRouteLeg();
142 }
143 
alternativeRoutes() const144 QList<QGeoRoute> QAbstractNavigator::alternativeRoutes() const
145 {
146     return QList<QGeoRoute>();
147 }
148 
currentSegment() const149 int QAbstractNavigator::currentSegment() const
150 {
151     return 0;
152 }
153 
QNavigationManagerEngine(const QVariantMap & parameters,QObject * parent)154 QNavigationManagerEngine::QNavigationManagerEngine(const QVariantMap &parameters, QObject *parent)
155     : QObject(parent)
156     , d(new QNavigationManagerEnginePrivate)
157 {
158     Q_UNUSED(parameters);
159 }
160 
~QNavigationManagerEngine()161 QNavigationManagerEngine::~QNavigationManagerEngine()
162 {
163 }
164 
setManagerName(const QString & name)165 void QNavigationManagerEngine::setManagerName(const QString &name)
166 {
167     d->managerName = name;
168 }
169 
managerName() const170 QString QNavigationManagerEngine::managerName() const
171 {
172     return d->managerName;
173 }
174 
setManagerVersion(int version)175 void QNavigationManagerEngine::setManagerVersion(int version)
176 {
177     d->managerVersion = version;
178 }
179 
managerVersion() const180 int QNavigationManagerEngine::managerVersion() const
181 {
182     return d->managerVersion;
183 }
184 
setLocale(const QLocale & locale)185 void QNavigationManagerEngine::setLocale(const QLocale &locale)
186 {
187     d->locale = locale;
188 }
189 
locale() const190 QLocale QNavigationManagerEngine::locale() const
191 {
192     return d->locale;
193 }
194 
setMeasurementSystem(QLocale::MeasurementSystem system)195 void QNavigationManagerEngine::setMeasurementSystem(QLocale::MeasurementSystem system)
196 {
197     d->measurementSystem = system;
198 }
199 
measurementSystem() const200 QLocale::MeasurementSystem QNavigationManagerEngine::measurementSystem() const
201 {
202     return d->measurementSystem;
203 }
204 
isInitialized() const205 bool QNavigationManagerEngine::isInitialized() const
206 {
207     return d->initialized;
208 }
209 
engineInitialized()210 void QNavigationManagerEngine::engineInitialized()
211 {
212     d->initialized = true;
213     emit initialized();
214 }
215 
216 QT_END_NAMESPACE
217