Qt 6.x
The Qt SDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
qplacemanagerengine_nokiav2.cpp
Go to the documentation of this file.
1// Copyright (C) 2015 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5
12#include "qgeouriprovider.h"
13#include "uri_constants.h"
14#include "qgeoerror_messages.h"
15
16#include <QCoreApplication>
17#include <QtCore/QFile>
18#include <QtCore/QJsonArray>
19#include <QtCore/QJsonDocument>
20#include <QtCore/QJsonObject>
21#include <QtCore/QRegularExpression>
22#include <QtCore/QStandardPaths>
23#include <QtCore/QUrlQuery>
24#include <QtNetwork/QNetworkProxy>
25#include <QtNetwork/QNetworkProxyFactory>
26
27#include <QtLocation/QPlace>
28#include <QtLocation/QPlaceContentRequest>
29#include <QtLocation/QPlaceDetailsReply>
30#include <QtLocation/QPlaceIcon>
31#include <QtLocation/QPlaceSearchRequest>
32#include <QtPositioning/QGeoCircle>
33
35
36static const char FIXED_CATEGORIES_string[] =
37 "eat-drink\0"
38 "going-out\0"
39 "sights-museums\0"
40 "transport\0"
41 "accommodation\0"
42 "shopping\0"
43 "leisure-outdoor\0"
44 "administrative-areas-buildings\0"
45 "natural-geographical\0"
46 "petrol-station\0"
47 "atm-bank-exchange\0"
48 "toilet-rest-area\0"
49 "hospital-health-care-facility\0"
50 "eat-drink|restaurant\0" // subcategories always start after relative parent category
51 "eat-drink|coffee-tea\0"
52 "eat-drink|snacks-fast-food\0"
53 "transport|airport"
54 "\0";
55
56static const int FIXED_CATEGORIES_indices[] = {
57 0, 10, 20, 35, 45, 59, 68, 84,
58 115, 136, 151, 169, 186, 216, 237, 258,
59 285, -1
60};
61
62static const char * const NokiaIcon = "nokiaIcon";
63static const char * const IconPrefix = "iconPrefix";
64static const char * const NokiaIconGenerated = "nokiaIconGenerated";
65
66static const char * const IconThemeKey = "places.icons.theme";
67static const char * const LocalDataPathKey = "places.local_data_path";
68
70{
71public:
73 bool parse(const QString &fileName);
74
75 QPlaceCategoryTree tree() const { return m_tree; }
76 QHash<QString, QUrl> restIdToIconHash() const { return m_restIdToIconHash; }
77
79
80private:
81 void processCategory(int level, const QString &id,
82 const QString &parentId = QString());
83
84 QJsonObject m_exploreObject;
85 QPlaceCategoryTree m_tree;
86 QString m_errorString;
87
88 QHash<QString, QUrl> m_restIdToIconHash;
89};
90
92{
93}
94
96{
97 m_exploreObject = QJsonObject();
98 m_tree.clear();
99 m_errorString.clear();
100
101 QFile mappingFile(fileName);
102
103 if (mappingFile.open(QIODevice::ReadOnly)) {
104 QJsonDocument document = QJsonDocument::fromJson(mappingFile.readAll());
105 if (document.isObject()) {
106 QJsonObject docObject = document.object();
107 if (docObject.contains(QStringLiteral("offline_explore"))) {
108 m_exploreObject = docObject.value(QStringLiteral("offline_explore"))
109 .toObject();
110 if (m_exploreObject.contains(QStringLiteral("ROOT"))) {
111 processCategory(0, QString());
112 return true;
113 }
114 } else {
115 m_errorString = fileName
116 + QStringLiteral("does not contain the offline_explore property");
117 return false;
118 }
119 } else {
120 m_errorString = fileName + QStringLiteral("is not an json object");
121 return false;
122 }
123 }
124 m_errorString = QString::fromLatin1("Unable to open ") + fileName;
125 return false;
126}
127
128void CategoryParser::processCategory(int level, const QString &id, const QString &parentId)
129{
130 //We are basing the tree on a DAG from the input file, however we are simplyfing
131 //this into a 2 level tree, and a given category only has one parent
132 //
133 // A->B->Z
134 // A->C->Z
135 // Z in this case is not in the tree because it is 3 levels deep.
136 //
137 // X->Z
138 // Y->Z
139 // Only one of these is shown in the tree since Z can only have one parent
140 // the choice made between X and Y is arbitrary.
141 const int maxLevel = 2;
143 node.category.setCategoryId(id);
144 node.parentId = parentId;
145
146 m_tree.insert(node.category.categoryId(), node);
147 //this is simply to mark the node as being visited.
148 //a proper assignment to the tree happens at the end of function
149
150 QJsonObject categoryJson = m_exploreObject.value(id.isEmpty()
151 ? QStringLiteral("ROOT") : id).toObject();
152 QJsonArray children = categoryJson.value(QStringLiteral("children")).toArray();
153
154 if (level + 1 <= maxLevel && !categoryJson.contains(QStringLiteral("final"))) {
155 for (int i = 0; i < children.count(); ++i) {
156 QString childId = children.at(i).toString();
157 if (!m_tree.contains(childId)) {
158 node.childIds.append(childId);
159 processCategory(level + 1, childId, id);
160 }
161 }
162 }
163
164 m_tree.insert(node.category.categoryId(), node);
165}
166
168 QGeoNetworkAccessManager *networkManager,
169 const QVariantMap &parameters,
171 QString *errorString)
172 : QPlaceManagerEngine(parameters)
173 , m_manager(networkManager)
174 , m_uriProvider(new QGeoUriProvider(this, parameters, QStringLiteral("here.places.host"), PLACES_HOST))
175{
176 Q_ASSERT(networkManager);
177 m_manager->setParent(this);
178
179 m_locales.append(QLocale());
180
181 m_appId = parameters.value(QStringLiteral("here.app_id")).toString();
182 m_appCode = parameters.value(QStringLiteral("here.token")).toString();
183
184 m_theme = parameters.value(IconThemeKey, QString()).toString();
185
186 if (m_theme == QStringLiteral("default"))
187 m_theme.clear();
188
189 m_localDataPath = parameters.value(LocalDataPathKey, QString()).toString();
190 if (m_localDataPath.isEmpty()) {
192
193 if (!dataLocations.isEmpty() && !dataLocations.first().isEmpty()) {
194 m_localDataPath = dataLocations.first()
195 + QStringLiteral("/here/qtlocation/data");
196 }
197 }
198
199 if (error)
201
202 if (errorString)
203 errorString->clear();
204}
205
207
209{
210 QUrl requestUrl(QString::fromLatin1("http://") + m_uriProvider->getCurrentHost() +
211 QStringLiteral("/places/v1/places/") + placeId);
212
213 QUrlQuery queryItems;
214
215 queryItems.addQueryItem(QStringLiteral("tf"), QStringLiteral("html"));
216 //queryItems.append(qMakePair<QString, QString>(QStringLiteral("size"), QString::number(5)));
217 //queryItems.append(qMakePair<QString, QString>(QStringLiteral("image_dimensions"), QStringLiteral("w64-h64,w100")));
218
219 requestUrl.setQuery(queryItems);
220
221 QNetworkReply *networkReply = sendRequest(requestUrl);
222
223 QPlaceDetailsReplyImpl *reply = new QPlaceDetailsReplyImpl(networkReply, this);
224 reply->setPlaceId(placeId);
226 this, &QPlaceManagerEngineNokiaV2::replyFinished);
228 this, &QPlaceManagerEngineNokiaV2::replyError);
229
230 return reply;
231}
232
234{
235 QNetworkReply *networkReply = nullptr;
236
237 if (request.contentContext().userType() == qMetaTypeId<QUrl>()) {
238 QUrl u = request.contentContext().value<QUrl>();
239
240 networkReply = sendRequest(u);
241 } else {
242 QUrl requestUrl(QString::fromLatin1("http://") + m_uriProvider->getCurrentHost() +
243 QStringLiteral("/places/v1/places/") + request.placeId() +
244 QStringLiteral("/media/"));
245
246 QUrlQuery queryItems;
247
248 switch (request.contentType()) {
250 requestUrl.setPath(requestUrl.path() + QStringLiteral("images"));
251
252 queryItems.addQueryItem(QStringLiteral("tf"), QStringLiteral("html"));
253
254 if (request.limit() > 0)
255 queryItems.addQueryItem(QStringLiteral("size"), QString::number(request.limit()));
256
257 //queryItems.append(qMakePair<QString, QString>(QStringLiteral("image_dimensions"), QStringLiteral("w64-h64,w100")));
258
259 requestUrl.setQuery(queryItems);
260
261 networkReply = sendRequest(requestUrl);
262 break;
264 requestUrl.setPath(requestUrl.path() + QStringLiteral("reviews"));
265
266 queryItems.addQueryItem(QStringLiteral("tf"), QStringLiteral("html"));
267
268 if (request.limit() > 0)
269 queryItems.addQueryItem(QStringLiteral("size"), QString::number(request.limit()));
270
271 requestUrl.setQuery(queryItems);
272
273 networkReply = sendRequest(requestUrl);
274 break;
276 requestUrl.setPath(requestUrl.path() + QStringLiteral("editorials"));
277
278 queryItems.addQueryItem(QStringLiteral("tf"), QStringLiteral("html"));
279
280 if (request.limit() > 0)
281 queryItems.addQueryItem(QStringLiteral("size"), QString::number(request.limit()));
282
283 requestUrl.setQuery(queryItems);
284
285 networkReply = sendRequest(requestUrl);
286 break;
288 default:
289 ;
290 }
291 }
292
293 QPlaceContentReply *reply = new QPlaceContentReplyImpl(request, networkReply, this);
295 this, &QPlaceManagerEngineNokiaV2::replyFinished);
297 this, &QPlaceManagerEngineNokiaV2::replyError);
298
299 if (!networkReply) {
302 Q_ARG(QString, QString("Retrieval of given content type not supported.")));
303 }
304
305 return reply;
306}
307
309 QUrlQuery *queryItems)
310{
311 QGeoCoordinate center = area.center();
312 if (!center.isValid())
313 return false;
314
315 queryItems->addQueryItem(QStringLiteral("at"),
316 QString::number(center.latitude()) +
317 QLatin1Char(',') +
318 QString::number(center.longitude()));
319 return true;
320}
321
323{
324 bool unsupported = false;
325
326 unsupported |= query.visibilityScope() != QLocation::UnspecifiedVisibility &&
327 query.visibilityScope() != QLocation::PublicVisibility;
328
329 // Both a search term and search categories are not supported.
330 unsupported |= !query.searchTerm().isEmpty() && !query.categories().isEmpty();
331
332 //only a recommendation id by itself is supported.
333 unsupported |= !query.recommendationId().isEmpty()
334 && (!query.searchTerm().isEmpty() || !query.categories().isEmpty()
335 || query.searchArea().type() != QGeoShape::UnknownType);
336
337 if (unsupported) {
340 this, &QPlaceManagerEngineNokiaV2::replyFinished);
342 this, &QPlaceManagerEngineNokiaV2::replyError);
345 Q_ARG(QString, "Unsupported search request options specified."));
346 return reply;
347 }
348
349 QUrlQuery queryItems;
350
351 // Check that the search area is valid for all searches except recommendation and proposed
352 // searches, which do not need search centers.
353 if (query.recommendationId().isEmpty() && !query.searchContext().isValid()) {
354 if (!addAtForBoundingArea(query.searchArea(), &queryItems)) {
357 this, &QPlaceManagerEngineNokiaV2::replyFinished);
359 this, &QPlaceManagerEngineNokiaV2::replyError);
362 Q_ARG(QString, "Invalid search area provided"));
363 return reply;
364 }
365 }
366
367 QNetworkReply *networkReply = nullptr;
368
369 if (query.searchContext().userType() == qMetaTypeId<QUrl>()) {
370 // provided search context
371 QUrl u = query.searchContext().value<QUrl>();
372
373 typedef QPair<QString, QString> QueryItem;
374 const QList<QueryItem> queryItemList = queryItems.queryItems(QUrl::FullyEncoded);
375 queryItems = QUrlQuery(u);
376 for (const QueryItem &item : queryItemList)
377 queryItems.addQueryItem(item.first, item.second);
378
379 if (query.limit() > 0)
380 queryItems.addQueryItem(QStringLiteral("size"), QString::number(query.limit()));
381
382 u.setQuery(queryItems);
383
384 networkReply = sendRequest(u);
385 } else if (!query.searchTerm().isEmpty()) {
386 // search term query
387 QUrl requestUrl(QString::fromLatin1("http://") + m_uriProvider->getCurrentHost() +
388 QStringLiteral("/places/v1/discover/search"));
389
390 queryItems.addQueryItem(QStringLiteral("q"), query.searchTerm());
391 queryItems.addQueryItem(QStringLiteral("tf"), QStringLiteral("html"));
392
393 if (query.limit() > 0) {
394 queryItems.addQueryItem(QStringLiteral("size"),
395 QString::number(query.limit()));
396 }
397
398 requestUrl.setQuery(queryItems);
399
400 QNetworkReply *networkReply = sendRequest(requestUrl);
401
402 QPlaceSearchReplyHere *reply = new QPlaceSearchReplyHere(query, networkReply, this);
404 this, &QPlaceManagerEngineNokiaV2::replyFinished);
406 this, &QPlaceManagerEngineNokiaV2::replyError);
407
408 return reply;
409 } else if (!query.recommendationId().isEmpty()) {
410 QUrl requestUrl(QString::fromLatin1("http://") + m_uriProvider->getCurrentHost() +
411 QStringLiteral("/places/v1/places/") + query.recommendationId() +
412 QStringLiteral("/related/recommended"));
413
414 queryItems.addQueryItem(QStringLiteral("tf"), QStringLiteral("html"));
415
416 requestUrl.setQuery(queryItems);
417
418 networkReply = sendRequest(requestUrl);
419 } else {
420 // category search
421 QUrl requestUrl(QStringLiteral("http://") + m_uriProvider->getCurrentHost() +
422 QStringLiteral("/places/v1/discover/explore"));
423
425 for (const QPlaceCategory &category : query.categories())
426 ids.append(category.categoryId());
427
428 QUrlQuery queryItems;
429
430 if (!ids.isEmpty())
431 queryItems.addQueryItem(QStringLiteral("cat"), ids.join(QStringLiteral(",")));
432
433 addAtForBoundingArea(query.searchArea(), &queryItems);
434
435 queryItems.addQueryItem(QStringLiteral("tf"), QStringLiteral("html"));
436
437 if (query.limit() > 0) {
438 queryItems.addQueryItem(QStringLiteral("size"),
439 QString::number(query.limit()));
440 }
441
442 requestUrl.setQuery(queryItems);
443
444 networkReply = sendRequest(requestUrl);
445 }
446
447 QPlaceSearchReplyHere *reply = new QPlaceSearchReplyHere(query, networkReply, this);
449 this, &QPlaceManagerEngineNokiaV2::replyFinished);
451 this, &QPlaceManagerEngineNokiaV2::replyError);
452
453 return reply;
454}
455
457{
458 bool unsupported = false;
459
460 unsupported |= query.visibilityScope() != QLocation::UnspecifiedVisibility &&
461 query.visibilityScope() != QLocation::PublicVisibility;
462
463 unsupported |= !query.categories().isEmpty();
464 unsupported |= !query.recommendationId().isEmpty();
465
466 if (unsupported) {
469 this, &QPlaceManagerEngineNokiaV2::replyFinished);
471 this, &QPlaceManagerEngineNokiaV2::replyError);
474 Q_ARG(QString, "Unsupported search request options specified."));
475 return reply;
476 }
477
478 QUrl requestUrl(QString::fromLatin1("http://") + m_uriProvider->getCurrentHost() +
479 QStringLiteral("/places/v1/suggest"));
480
481 QUrlQuery queryItems;
482
483 queryItems.addQueryItem(QStringLiteral("q"), query.searchTerm());
484
485 if (!addAtForBoundingArea(query.searchArea(), &queryItems)) {
488 this, &QPlaceManagerEngineNokiaV2::replyFinished);
490 this, &QPlaceManagerEngineNokiaV2::replyError);
493 Q_ARG(QString, "Invalid search area provided"));
494 return reply;
495 }
496
497 requestUrl.setQuery(queryItems);
498
499 QNetworkReply *networkReply = sendRequest(requestUrl);
500
503 this, &QPlaceManagerEngineNokiaV2::replyFinished);
505 this, &QPlaceManagerEngineNokiaV2::replyError);
506
507 return reply;
508}
509
511{
512 if (m_categoryReply)
513 return m_categoryReply.data();
514
515 m_tempTree.clear();
516 CategoryParser parser;
517
518 if (parser.parse(m_localDataPath + QStringLiteral("/offline/offline-mapping.json"))) {
519 m_tempTree = parser.tree();
520 } else {
521 PlaceCategoryNode rootNode;
522
523 for (int i = 0; FIXED_CATEGORIES_indices[i] != -1; ++i) {
526
527 int subCatDivider = id.indexOf(QChar('|'));
528 if (subCatDivider >= 0) {
529 // found a sub category
530 const QString subCategoryId = id.mid(subCatDivider+1);
531 const QString parentCategoryId = id.left(subCatDivider);
532
533 if (m_tempTree.contains(parentCategoryId)) {
535 node.category.setCategoryId(subCategoryId);
537
538 // find parent
540 parent.childIds.append(subCategoryId);
541 m_tempTree.insert(subCategoryId, node);
542 }
543
544 } else {
546 node.category.setCategoryId(id);
547
548 m_tempTree.insert(id, node);
549 rootNode.childIds.append(id);
550 }
551 }
552
553 m_tempTree.insert(QString(), rootNode);
554 }
555
556 //request all categories in the tree from the server
557 //because we don't want the root node, we skip it
558 for (auto it = m_tempTree.keyBegin(), end = m_tempTree.keyEnd(); it != end; ++it) {
559 if (*it == QString())
560 continue;
561 QUrl requestUrl(QString::fromLatin1("http://") + m_uriProvider->getCurrentHost() +
562 QStringLiteral("/places/v1/categories/places/") + *it);
563 QNetworkReply *networkReply = sendRequest(requestUrl);
564 connect(networkReply, &QNetworkReply::finished,
565 this, &QPlaceManagerEngineNokiaV2::categoryReplyFinished);
567 this, &QPlaceManagerEngineNokiaV2::categoryReplyError);
568
569 m_categoryRequests.insert(*it, networkReply);
570 }
571
574 this, &QPlaceManagerEngineNokiaV2::replyFinished);
576 this, &QPlaceManagerEngineNokiaV2::replyError);
577
578 m_categoryReply = reply;
579 return reply;
580}
581
583{
584 return m_categoryTree.value(categoryId).parentId;
585}
586
588{
589 return m_categoryTree.value(categoryId).childIds;
590}
591
593{
594 return m_categoryTree.value(categoryId).category;
595}
596
598{
600 for (const QString &childId : m_categoryTree.value(parentId).childIds)
601 results.append(m_categoryTree.value(childId).category);
602 return results;
603}
604
606{
607 return m_locales;
608}
609
611{
612 m_locales = locales;
613}
614
617{
620
621 QRegularExpression rx("(.*)(/icons/categories/.*)");
622 QRegularExpressionMatch match = rx.match(remotePath);
623
624 QString iconPrefix;
625 QString nokiaIcon;
626 if (match.hasMatch() && !match.capturedView(1).isEmpty() && !match.capturedView(2).isEmpty()) {
627 iconPrefix = match.captured(1);
628 nokiaIcon = match.captured(2);
629
630 if (QFile::exists(m_localDataPath + nokiaIcon))
631 iconPrefix = QString::fromLatin1("file://") + m_localDataPath;
632
633 params.insert(NokiaIcon, nokiaIcon);
634 params.insert(IconPrefix, iconPrefix);
635
636 for (const QPlaceCategory &category : categories) {
637 if (category.icon().parameters().value(NokiaIcon) == nokiaIcon) {
639 break;
640 }
641 }
642 } else {
643 QString path = remotePath + (!m_theme.isEmpty()
644 ? QLatin1Char('.') + m_theme : QString());
646
647 if (!nokiaIcon.isEmpty()) {
648 params.insert(NokiaIcon, nokiaIcon);
649 params.insert(IconPrefix, iconPrefix);
651 }
652 }
653
654 icon.setParameters(params);
655
656 if (!icon.isEmpty())
657 icon.setManager(manager());
658
659 return icon;
660}
661
663 const QSize &size) const
664{
665 Q_UNUSED(size);
666 QVariantMap params = icon.parameters();
667 QString nokiaIcon = params.value(NokiaIcon).toString();
668
669 if (!nokiaIcon.isEmpty()) {
670 nokiaIcon.append(!m_theme.isEmpty() ?
671 QLatin1Char('.') + m_theme : QString());
672
673 if (params.contains(IconPrefix)) {
674 return QUrl(params.value(IconPrefix).toString() +
675 nokiaIcon);
676 } else {
677 return QUrl(QString::fromLatin1("file://") + m_localDataPath
678 + nokiaIcon);
679 }
680 }
681
682 return QUrl();
683}
684
685void QPlaceManagerEngineNokiaV2::replyFinished()
686{
687 QPlaceReply *reply = qobject_cast<QPlaceReply *>(sender());
688 if (reply)
690}
691
692void QPlaceManagerEngineNokiaV2::replyError(QPlaceReply::Error error_, const QString &errorString)
693{
694 QPlaceReply *reply = qobject_cast<QPlaceReply *>(sender());
695 if (reply)
696 emit errorOccurred(reply, error_, errorString);
697}
698
699void QPlaceManagerEngineNokiaV2::categoryReplyFinished()
700{
701 QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender());
702 if (!reply)
703 return;
704
705 QString categoryId;
706
709 if (!document.isObject()) {
710 if (m_categoryReply) {
711 QMetaObject::invokeMethod(m_categoryReply.data(), "setError", Qt::QueuedConnection,
714 }
715 return;
716 }
717
718 QJsonObject category = document.object();
719
720 categoryId = category.value(QStringLiteral("categoryId")).toString();
721 if (m_tempTree.contains(categoryId)) {
722 PlaceCategoryNode node = m_tempTree.value(categoryId);
723 node.category.setName(category.value(QStringLiteral("name")).toString());
724 node.category.setCategoryId(categoryId);
725 node.category.setIcon(icon(category.value(QStringLiteral("icon")).toString()));
726
727 m_tempTree.insert(categoryId, node);
728 }
729 } else {
730 categoryId = m_categoryRequests.key(reply);
731 PlaceCategoryNode rootNode = m_tempTree.value(QString());
732 rootNode.childIds.removeAll(categoryId);
733 m_tempTree.insert(QString(), rootNode);
734 m_tempTree.remove(categoryId);
735 }
736
737 m_categoryRequests.remove(categoryId);
739
740 if (m_categoryRequests.isEmpty()) {
741 m_categoryTree = m_tempTree;
742 m_tempTree.clear();
743
744 if (m_categoryReply)
745 m_categoryReply.data()->emitFinished();
746 }
747}
748
749void QPlaceManagerEngineNokiaV2::categoryReplyError()
750{
751 if (m_categoryReply) {
752 QMetaObject::invokeMethod(m_categoryReply.data(), "setError", Qt::QueuedConnection,
755 }
756}
757
758QNetworkReply *QPlaceManagerEngineNokiaV2::sendRequest(const QUrl &url)
759{
760 QUrlQuery queryItems(url);
761 queryItems.addQueryItem(QStringLiteral("app_id"), m_appId);
762 queryItems.addQueryItem(QStringLiteral("app_code"), m_appCode);
763
764 QUrl requestUrl = url;
765 requestUrl.setQuery(queryItems);
766
768 request.setUrl(requestUrl);
769
770 request.setRawHeader("Accept", "application/json");
771 request.setRawHeader("Accept-Language", createLanguageString());
772
773 return m_manager->get(request);
774}
775
776QByteArray QPlaceManagerEngineNokiaV2::createLanguageString() const
777{
779
780 QList<QLocale> locales = m_locales;
781 if (locales.isEmpty())
782 locales << QLocale();
783
784 for (const QLocale &loc : std::as_const(locales)) {
785 language.append(loc.name().replace(2, 1, QLatin1Char('-')).toLatin1());
786 language.append(", ");
787 }
788 language.chop(2);
789
790 return language;
791}
792
bool parse(const QString &fileName)
QHash< QString, QUrl > restIdToIconHash() const
QString errorString() const
QPlaceCategoryTree tree() const
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
Definition qchar.h:48
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
\inmodule QtCore
Definition qfile.h:93
bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
Definition qfile.cpp:881
bool exists() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qfile.cpp:351
\inmodule QtPositioning
virtual QNetworkReply * get(const QNetworkRequest &request)=0
Error
Describes an error related to the loading and setup of a service provider plugin.
\inmodule QtPositioning
Definition qgeoshape.h:17
@ UnknownType
Definition qgeoshape.h:31
QString getCurrentHost() const
\inmodule QtCore
Definition qhash.h:818
bool remove(const Key &key)
Removes the item that has the key from the hash.
Definition qhash.h:956
Key key(const T &value) const noexcept
Definition qhash.h:1018
bool isEmpty() const noexcept
Returns true if the hash contains no items; otherwise returns false.
Definition qhash.h:926
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition qhash.h:1283
QByteArray readAll()
Reads all remaining data from the device, and returns it as a byte array.
\inmodule QtCore\reentrant
Definition qjsonarray.h:18
qsizetype count() const
Same as size().
Definition qjsonarray.h:42
QJsonValue at(qsizetype i) const
Returns a QJsonValue representing the value for index i.
\inmodule QtCore\reentrant
static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error=nullptr)
Parses json as a UTF-8 encoded JSON document, and creates a QJsonDocument from it.
\inmodule QtCore\reentrant
Definition qjsonobject.h:20
QJsonValue value(const QString &key) const
Returns a QJsonValue representing the value for the key key.
bool contains(const QString &key) const
Returns true if the object contains key key.
QJsonObject toObject() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QJsonArray toArray() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString toString() const
Converts the value to a QString and returns it.
Definition qlist.h:74
bool isEmpty() const noexcept
Definition qlist.h:390
void append(parameter_type t)
Definition qlist.h:441
iterator insert(const Key &key, const T &value)
Definition qmap.h:687
T value(const Key &key, const T &defaultValue=T()) const
Definition qmap.h:356
bool contains(const Key &key) const
Definition qmap.h:340
size_type remove(const Key &key)
Definition qmap.h:299
void clear()
Definition qmap.h:288
key_iterator keyBegin() const
Definition qmap.h:605
key_iterator keyEnd() const
Definition qmap.h:606
The QNetworkReply class contains the data and headers for a request sent with QNetworkAccessManager.
void errorOccurred(QNetworkReply::NetworkError)
NetworkError error() const
Returns the error that was found during the processing of this request.
void finished()
This signal is emitted when the reply has finished processing.
The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.
void setRawHeader(const QByteArray &headerName, const QByteArray &value)
Sets the header headerName to be of value headerValue.
void setUrl(const QUrl &url)
Sets the URL this network request is referring to be url.
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:311
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2823
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
Definition qobject.cpp:2521
void setParent(QObject *parent)
Makes the object a child of parent.
Definition qobject.cpp:2142
void deleteLater()
\threadsafe
Definition qobject.cpp:2352
\inmodule QtLocation
void setCategoryId(const QString &identifier)
Sets the identifier of the category.
QString categoryId() const
Returns the identifier of the category.
void setIcon(const QPlaceIcon &icon)
Sets the icon of the category.
void setName(const QString &name)
Sets the name of the category.
\inmodule QtLocation
\inmodule QtLocation
\inmodule QtLocation
\inmodule QtLocation
Definition qplaceicon.h:23
static const QString SingleUrl
\qmlvaluetype icon \inqmlmodule QtLocation
Definition qplaceicon.h:32
QPlaceContentReply * getPlaceContent(const QPlaceContentRequest &request) override
Retrieves content for a place according to the parameters specified in request.
QStringList childCategoryIds(const QString &categoryId) const override
Returns the child category identifiers of the category corresponding to categoryId.
QString parentCategoryId(const QString &categoryId) const override
Returns the parent category identifier of the category corresponding to categoryId.
QPlaceSearchSuggestionReply * searchSuggestions(const QPlaceSearchRequest &query) override
Requests a set of search term suggestions according to the parameters specified in request.
QPlaceReply * initializeCategories() override
Initializes the categories of the manager engine.
QPlaceManagerEngineNokiaV2(QGeoNetworkAccessManager *networkManager, const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString)
QPlaceDetailsReply * getPlaceDetails(const QString &placeId) override
Retrieves details of place corresponding to the given placeId.
QList< QPlaceCategory > childCategories(const QString &parentId) const override
Returns a list of categories that are children of the category corresponding to parentId.
QUrl constructIconUrl(const QPlaceIcon &icon, const QSize &size) const override
QUrl QPlaceManagerEngine::constructIconUrl(const QPlaceIcon &icon, const QSize &size)
QPlaceSearchReply * search(const QPlaceSearchRequest &query) override
Searches for places according to the parameters specified in request.
void setLocales(const QList< QLocale > &locales) override
Set the list of preferred locales.
QList< QLocale > locales() const override
Returns a list of preferred locales.
QPlaceCategory category(const QString &categoryId) const override
Returns the category corresponding to the given categoryId.
QPlaceIcon icon(const QString &remotePath, const QList< QPlaceCategory > &categories=QList< QPlaceCategory >()) const
\inmodule QtLocation
void finished(QPlaceReply *reply)
This signal is emitted when reply has finished processing.
QPlaceManager * manager() const
Returns the manager instance used to create this engine.
void errorOccurred(QPlaceReply *, QPlaceReply::Error error, const QString &errorString=QString())
This signal is emitted when an error has been detected in the processing of reply.
\inmodule QtLocation
Definition qplacereply.h:15
void errorOccurred(QPlaceReply::Error error, const QString &errorString=QString())
This signal is emitted when an error has been detected in the processing of this reply.
void finished()
This signal is emitted when this reply has finished processing.
Error
Describes an error which occurred during an operation.
Definition qplacereply.h:18
\inmodule QtLocation
\inmodule QtLocation
T * data() const
Definition qpointer.h:56
\inmodule QtCore \reentrant
\inmodule QtCore \reentrant
\inmodule QtCore
Definition qsize.h:25
static QStringList standardLocations(StandardLocation type)
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5710
void clear()
Clears the contents of the string and makes it null.
Definition qstring.h:1107
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
Definition qstring.cpp:5204
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:1083
QString & insert(qsizetype i, QChar c)
Definition qstring.cpp:3110
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:7822
QString & append(QChar c)
Definition qstring.cpp:3227
QString left(qsizetype n) const
Returns a substring that contains the n leftmost characters of the string.
Definition qstring.cpp:5161
\inmodule QtCore
Definition qurlquery.h:20
void addQueryItem(const QString &key, const QString &value)
Appends the pair key = value to the end of the query string of the URL.
QList< QPair< QString, QString > > queryItems(QUrl::ComponentFormattingOptions encoding=QUrl::PrettyDecoded) const
Returns the query string of the URL, as a map of keys and values, using the options specified in enco...
\inmodule QtCore
Definition qurl.h:94
void setQuery(const QString &query, ParsingMode mode=TolerantMode)
Sets the query string of the URL to query.
Definition qurl.cpp:2547
@ FullyEncoded
Definition qurl.h:129
void setPath(const QString &path, ParsingMode mode=DecodedMode)
Sets the path of the URL to path.
Definition qurl.cpp:2411
QString path(ComponentFormattingOptions options=FullyDecoded) const
Returns the path of the URL.
Definition qurl.cpp:2465
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
#define this
Definition dialogs.cpp:9
const QLoggingCategory & category()
[1]
QSet< QString >::iterator it
@ PublicVisibility
Definition qlocation.h:21
@ UnspecifiedVisibility
Definition qlocation.h:18
Combined button and popup list for selecting options.
@ QueuedConnection
emscripten::val document()
Definition qwasmdom.h:20
std::pair< T1, T2 > QPair
DBusConnection const char DBusError * error
QT_BEGIN_NAMESPACE const char NOKIA_PLUGIN_CONTEXT_NAME[]
const char PARSE_ERROR[]
const char NETWORK_ERROR[]
static int area(const QSize &s)
Definition qicon.cpp:152
#define Q_ARG(Type, data)
Definition qobjectdefs.h:62
GLenum GLuint GLint level
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLuint end
GLenum GLenum GLsizei const GLuint * ids
GLenum GLuint id
[7]
void ** params
GLsizei GLenum * categories
GLenum query
GLsizei const GLchar *const * path
static QT_BEGIN_NAMESPACE const char FIXED_CATEGORIES_string[]
static bool addAtForBoundingArea(const QGeoShape &area, QUrlQuery *queryItems)
static const int FIXED_CATEGORIES_indices[]
static const char *const NokiaIconGenerated
static const char *const IconThemeKey
static const char *const NokiaIcon
static const char *const LocalDataPathKey
static const char *const IconPrefix
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define QStringLiteral(str)
#define emit
#define Q_UNUSED(x)
static bool match(const uchar *found, uint foundLen, const char *target, uint targetLen)
QUrl url("example.com")
[constructor-url-reference]
p rx()++
QGraphicsItem * item
QNetworkRequest request(url)
QNetworkReply * reply
char * toString(const MyType &t)
[31]
\inmodule QtCore \reentrant
Definition qchar.h:17
static bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType, QGenericReturnArgument ret, QGenericArgument val0=QGenericArgument(nullptr), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
\threadsafe This is an overloaded member function, provided for convenience. It differs from the abov...
const QString PLACES_HOST