forked from vladest/googlemaps
-
Notifications
You must be signed in to change notification settings - Fork 3
/
qplacemanagerenginegooglemaps.h
59 lines (44 loc) · 1.92 KB
/
qplacemanagerenginegooglemaps.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef QPLACEMANAGERENGINEGOOGLEMAPS_H
#define QPLACEMANAGERENGINEGOOGLEMAPS_H
#include <QtLocation/QPlaceManagerEngine>
#include <QtLocation/QGeoServiceProvider>
class QNetworkAccessManager;
class QNetworkReply;
class QPlaceCategoriesReplyGooglemaps;
class QPlaceManagerEngineGooglemaps : public QPlaceManagerEngine
{
Q_OBJECT
public:
QPlaceManagerEngineGooglemaps(const QVariantMap ¶meters, QGeoServiceProvider::Error *error,
QString *errorString);
~QPlaceManagerEngineGooglemaps();
QPlaceSearchReply *search(const QPlaceSearchRequest &request) Q_DECL_OVERRIDE;
QPlaceSearchSuggestionReply *searchSuggestions(const QPlaceSearchRequest &request) Q_DECL_OVERRIDE;
QPlaceReply *initializeCategories() Q_DECL_OVERRIDE;
QString parentCategoryId(const QString &categoryId) const Q_DECL_OVERRIDE;
QStringList childCategoryIds(const QString &categoryId) const Q_DECL_OVERRIDE;
QPlaceCategory category(const QString &categoryId) const Q_DECL_OVERRIDE;
QList<QPlaceCategory> childCategories(const QString &parentId) const Q_DECL_OVERRIDE;
QList<QLocale> locales() const Q_DECL_OVERRIDE;
void setLocales(const QList<QLocale> &locales) Q_DECL_OVERRIDE;
private:
QNetworkReply *sendRequest(const QUrl &url);
private slots:
void categoryReplyFinished();
void categoryReplyError();
void replyFinished();
void replyError(QPlaceReply::Error errorCode, const QString &errorString);
private:
void fetchNextCategoryLocale();
QNetworkAccessManager *m_networkManager;
QByteArray m_userAgent;
QString m_urlPrefix;
QList<QLocale> m_locales;
QString m_apiKey;
QNetworkReply *m_categoriesReply;
QList<QPlaceCategoriesReplyGooglemaps *> m_pendingCategoriesReply;
QHash<QString, QPlaceCategory> m_categories;
QHash<QString, QStringList> m_subcategories;
QList<QLocale> m_categoryLocales;
};
#endif // QPLACEMANAGERENGINEGOOGLEMAPS_H