QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGeoTileFetcherQGC.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QLoggingCategory>
4#include <QtLocation/private/qgeotilefetcher_p.h>
5#include <QtNetwork/QNetworkRequest>
6
7Q_DECLARE_LOGGING_CATEGORY(QGeoTileFetcherQGCLog)
8
11class QGeoTileSpec;
12class QNetworkAccessManager;
13
14class QGeoTileFetcherQGC : public QGeoTileFetcher
15{
16 Q_OBJECT
17
18public:
19 explicit QGeoTileFetcherQGC(QNetworkAccessManager *networkManager, const QVariantMap &parameters, QGeoTiledMappingManagerEngineQGC *parent = nullptr);
21
22 static QNetworkRequest getNetworkRequest(int mapId, int x, int y, int zoom);
23 /* Note: QNetworkAccessManager queues the requests it receives. The number of requests executed in parallel is dependent on the protocol.
24 * Currently, for the HTTP protocol on desktop platforms, 6 requests are executed in parallel for one host/port combination. */
25 static uint32_t concurrentDownloads(const QString &type) { Q_UNUSED(type); return 6; }
26
27private:
28 QGeoTiledMapReply* getTileImage(const QGeoTileSpec &spec) final;
29 bool initialized() const final;
30 bool fetchingEnabled() const final;
31 void timerEvent(QTimerEvent *event) final;
32 void handleReply(QGeoTiledMapReply *reply, const QGeoTileSpec &spec) final;
33
34 QNetworkAccessManager *m_networkManager = nullptr;
35
36#if defined Q_OS_MACOS
37 static constexpr const char* s_userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 14.5; rv:125.0) Gecko/20100101 Firefox/125.0";
38#elif defined Q_OS_WIN
39 static constexpr const char* s_userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/112.0";
40#elif defined Q_OS_ANDROID
41 static constexpr const char* s_userAgent = "Mozilla/5.0 (Android 13; Tablet; rv:68.0) Gecko/68.0 Firefox/112.0";
42#elif defined Q_OS_LINUX
43 // TODO: Detect Wayland vs X11
44 static constexpr const char* s_userAgent = "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0";
45#else
46 static constexpr const char* s_userAgent = "Qt Location based application";
47#endif
48};
Q_DECLARE_LOGGING_CATEGORY(AndroidSerialLog)
static uint32_t concurrentDownloads(const QString &type)
static QNetworkRequest getNetworkRequest(int mapId, int x, int y, int zoom)