| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2015 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 | #ifndef QGEOSERVICEPROVIDER_P_H |
| 38 | #define QGEOSERVICEPROVIDER_P_H |
| 39 | |
| 40 | // |
| 41 | // W A R N I N G |
| 42 | // ------------- |
| 43 | // |
| 44 | // This file is not part of the Qt API. It exists purely as an |
| 45 | // implementation detail. This header file may change from version to |
| 46 | // version without notice, or even be removed. |
| 47 | // |
| 48 | // We mean it. |
| 49 | // |
| 50 | |
| 51 | #include "qgeoserviceprovider.h" |
| 52 | |
| 53 | #include <QHash> |
| 54 | #include <QJsonObject> |
| 55 | #include <QJsonArray> |
| 56 | #include <QLocale> |
| 57 | |
| 58 | QT_BEGIN_NAMESPACE |
| 59 | |
| 60 | class QGeoCodingManager; |
| 61 | class QGeoRoutingManager; |
| 62 | class QGeoMappingManager; |
| 63 | |
| 64 | class QGeoServiceProviderFactory; |
| 65 | class QGeoServiceProviderFactoryV2; |
| 66 | class QGeoServiceProviderFactoryV3; |
| 67 | class QQmlEngine; |
| 68 | |
| 69 | class QGeoServiceProviderPrivate |
| 70 | { |
| 71 | public: |
| 72 | QGeoServiceProviderPrivate(); |
| 73 | ~QGeoServiceProviderPrivate(); |
| 74 | |
| 75 | void loadMeta(); |
| 76 | void loadPlugin(const QVariantMap ¶meters); |
| 77 | void unload(); |
| 78 | void filterParameterMap(); |
| 79 | |
| 80 | /* helper templates for generating the feature and manager accessors */ |
| 81 | template <class Manager, class Engine> |
| 82 | Manager *manager(QGeoServiceProvider::Error *error, |
| 83 | QString *errorString, Manager **manager); |
| 84 | template <class Flags> |
| 85 | Flags features(const char *enumName); |
| 86 | |
| 87 | QGeoServiceProviderFactory *factory; |
| 88 | QGeoServiceProviderFactoryV2 *factoryV2 = nullptr; |
| 89 | QGeoServiceProviderFactoryV3 *factoryV3 = nullptr; |
| 90 | QJsonObject metaData; |
| 91 | |
| 92 | QVariantMap parameterMap; |
| 93 | QVariantMap cleanedParameterMap; |
| 94 | |
| 95 | bool experimental; |
| 96 | |
| 97 | QGeoCodingManager *geocodingManager; |
| 98 | QGeoRoutingManager *routingManager; |
| 99 | QGeoMappingManager *mappingManager; |
| 100 | QPlaceManager *placeManager; |
| 101 | QNavigationManager *navigationManager = nullptr; |
| 102 | QQmlEngine *qmlEngine = nullptr; |
| 103 | |
| 104 | QGeoServiceProvider::Error geocodeError; |
| 105 | QGeoServiceProvider::Error routingError; |
| 106 | QGeoServiceProvider::Error mappingError; |
| 107 | QGeoServiceProvider::Error placeError; |
| 108 | QGeoServiceProvider::Error navigationError = QGeoServiceProvider::NoError; |
| 109 | |
| 110 | QString geocodeErrorString; |
| 111 | QString routingErrorString; |
| 112 | QString mappingErrorString; |
| 113 | QString placeErrorString; |
| 114 | QString navigationErrorString; |
| 115 | |
| 116 | QGeoServiceProvider::Error error; |
| 117 | QString errorString; |
| 118 | |
| 119 | QString providerName; |
| 120 | |
| 121 | QLocale locale; |
| 122 | bool localeSet; |
| 123 | |
| 124 | static QMultiHash<QString, QJsonObject> plugins(bool reload = false); |
| 125 | static void loadPluginMetadata(QMultiHash<QString, QJsonObject> &list); |
| 126 | }; |
| 127 | |
| 128 | QT_END_NAMESPACE |
| 129 | |
| 130 | #endif |
| 131 | |