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 "qnavigationmanager_p.h"
38 #include "qnavigationmanagerengine_p.h"
39 
40 QT_BEGIN_NAMESPACE
41 
42 class QNavigationManagerPrivate
43 {
44 public:
45     QNavigationManagerPrivate();
46     ~QNavigationManagerPrivate();
47 
48     QNavigationManagerEngine *engine = nullptr;
49 
50 private:
51     Q_DISABLE_COPY(QNavigationManagerPrivate)
52 };
53 
QNavigationManagerPrivate()54 QNavigationManagerPrivate::QNavigationManagerPrivate()
55 {
56 
57 }
58 
~QNavigationManagerPrivate()59 QNavigationManagerPrivate::~QNavigationManagerPrivate()
60 {
61     delete engine;
62     engine = nullptr;
63 }
64 
~QNavigationManager()65 QNavigationManager::~QNavigationManager()
66 {
67     delete d_ptr;
68 }
69 
managerName() const70 QString QNavigationManager::managerName() const
71 {
72     return d_ptr->engine->managerName();
73 }
74 
managerVersion() const75 int QNavigationManager::managerVersion() const
76 {
77     return d_ptr->engine->managerVersion();
78 }
79 
engine()80 QNavigationManagerEngine *QNavigationManager::engine()
81 {
82     return d_ptr->engine;
83 }
84 
isInitialized() const85 bool QNavigationManager::isInitialized() const
86 {
87     return d_ptr->engine->isInitialized();
88 }
89 
setLocale(const QLocale & locale)90 void QNavigationManager::setLocale(const QLocale &locale)
91 {
92     d_ptr->engine->setLocale(locale);
93 }
94 
locale() const95 QLocale QNavigationManager::locale() const
96 {
97     return d_ptr->engine->locale();
98 }
99 
setMeasurementSystem(QLocale::MeasurementSystem system)100 void QNavigationManager::setMeasurementSystem(QLocale::MeasurementSystem system)
101 {
102     d_ptr->engine->setMeasurementSystem(system);
103 }
104 
measurementSystem() const105 QLocale::MeasurementSystem QNavigationManager::measurementSystem() const
106 {
107     return d_ptr->engine->measurementSystem();
108 }
109 
createNavigator(const QSharedPointer<QDeclarativeNavigatorParams> & navigator)110 QAbstractNavigator *QNavigationManager::createNavigator(const QSharedPointer<QDeclarativeNavigatorParams> &navigator)
111 {
112     return d_ptr->engine->createNavigator(navigator);
113 }
114 
QNavigationManager(QNavigationManagerEngine * engine,QObject * parent)115 QNavigationManager::QNavigationManager(QNavigationManagerEngine *engine, QObject *parent) : QObject(parent),
116     d_ptr(new QNavigationManagerPrivate)
117 {
118     d_ptr->engine = engine;
119     if (!d_ptr->engine) {
120         qFatal("The navigation manager engine that was set for this mapping manager was NULL.");
121     }
122 
123     connect(d_ptr->engine,
124             SIGNAL(initialized()),
125             this,
126             SIGNAL(initialized()),
127             Qt::QueuedConnection);
128 }
129 
130 QT_END_NAMESPACE
131