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 QPLACEMANAGERENGINE_H
38 #define QPLACEMANAGERENGINE_H
39 
40 #include <QtLocation/QPlaceManager>
41 
42 QT_BEGIN_NAMESPACE
43 
44 class QPlaceManagerEnginePrivate;
45 class QPlaceMatchReply;
46 class QPlaceMatchRequest;
47 class QPlaceSearchReply;
48 class QPlaceSearchRequest;
49 class QPlaceSearchSuggestionReply;
50 
51 class Q_LOCATION_EXPORT QPlaceManagerEngine : public QObject
52 {
53     Q_OBJECT
54 
55 public:
56     explicit QPlaceManagerEngine(const QVariantMap &parameters, QObject *parent = nullptr);
57     virtual ~QPlaceManagerEngine();
58 
59     QString managerName() const;
60     int managerVersion() const;
61 
62     virtual QPlaceDetailsReply *getPlaceDetails(const QString &placeId);
63 
64     virtual QPlaceContentReply *getPlaceContent(const QPlaceContentRequest &request);
65 
66     virtual QPlaceSearchReply *search(const QPlaceSearchRequest &request);
67 
68     virtual QPlaceSearchSuggestionReply *searchSuggestions(const QPlaceSearchRequest &request);
69 
70     virtual QPlaceIdReply *savePlace(const QPlace &place);
71     virtual QPlaceIdReply *removePlace(const QString &placeId);
72 
73     virtual QPlaceIdReply *saveCategory(const QPlaceCategory &category, const QString &parentId);
74     virtual QPlaceIdReply *removeCategory(const QString &categoryId);
75 
76     virtual QPlaceReply *initializeCategories();
77     virtual QString parentCategoryId(const QString &categoryId) const;
78     virtual QStringList childCategoryIds(const QString &categoryId) const;
79     virtual QPlaceCategory category(const QString &categoryId) const;
80 
81     virtual QList<QPlaceCategory> childCategories(const QString &parentId) const;
82 
83     virtual QList<QLocale> locales() const;
84     virtual void setLocales(const QList<QLocale> &locales);
85 
86     virtual QUrl constructIconUrl(const QPlaceIcon &icon, const QSize &size) const;
87 
88     virtual QPlace compatiblePlace(const QPlace &original) const;
89 
90     virtual QPlaceMatchReply *matchingPlaces(const QPlaceMatchRequest &request);
91 
92 Q_SIGNALS:
93     void finished(QPlaceReply *reply);
94     void error(QPlaceReply *, QPlaceReply::Error error, const QString &errorString = QString());
95 
96     void placeAdded(const QString &placeId);
97     void placeUpdated(const QString &placeId);
98     void placeRemoved(const QString &placeId);
99 
100     void categoryAdded(const QPlaceCategory &category, const QString &parentCategoryId);
101     void categoryUpdated(const QPlaceCategory &category, const QString &parentCategoryId);
102     void categoryRemoved(const QString &categoryId, const QString &parentCategoryId);
103     void dataChanged();
104 
105 protected:
106     QPlaceManager *manager() const;
107 
108 private:
109     void setManagerName(const QString &managerName);
110     void setManagerVersion(int managerVersion);
111 
112     QPlaceManagerEnginePrivate *d_ptr;
113     Q_DISABLE_COPY(QPlaceManagerEngine)
114 
115     friend class QGeoServiceProviderPrivate;
116     friend class QPlaceManager;
117 };
118 
119 QT_END_NAMESPACE
120 
121 #endif
122