summaryrefslogtreecommitdiff
path: root/platform/qt/src/qmapboxgl.cpp
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2017-01-05 14:37:10 -0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2017-01-05 15:09:02 -0200
commitf55a6e2b7a648b61eca8da2cb4916d96ecc25ef4 (patch)
treee6230d3e165a94fcf0f99e1958fb6332119c8005 /platform/qt/src/qmapboxgl.cpp
parente71d9ac2d4b6cc1e6d221618c9139b64035753d9 (diff)
downloadqtlocation-mapboxgl-f55a6e2b7a648b61eca8da2cb4916d96ecc25ef4.tar.gz
[Qt] Expose method for changing the base API URL
Useful for redirecting to a cache server or debugging.
Diffstat (limited to 'platform/qt/src/qmapboxgl.cpp')
-rw-r--r--platform/qt/src/qmapboxgl.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp
index 1f5638337f..398b31684a 100644
--- a/platform/qt/src/qmapboxgl.cpp
+++ b/platform/qt/src/qmapboxgl.cpp
@@ -196,6 +196,7 @@ QMapboxGLSettings::QMapboxGLSettings()
, m_cacheDatabasePath(":memory:")
, m_assetPath(QCoreApplication::applicationDirPath())
, m_accessToken(qgetenv("MAPBOX_ACCESS_TOKEN"))
+ , m_apiBaseUrl(mbgl::util::API_BASE_URL)
{
}
@@ -349,6 +350,26 @@ void QMapboxGLSettings::setAccessToken(const QString &token)
}
/*!
+ Returns the API base URL.
+*/
+QString QMapboxGLSettings::apiBaseUrl() const
+{
+ return m_apiBaseUrl;
+}
+
+/*!
+ Sets the API base \a url.
+
+ The API base URL is the URL that the \b "mapbox://" protocol will
+ be resolved to. It defaults to "https://api.mapbox.com" but can be
+ changed, for instance, to a tile cache server address.
+*/
+void QMapboxGLSettings::setApiBaseUrl(const QString& url)
+{
+ m_apiBaseUrl = url;
+}
+
+/*!
\class QMapboxGL
\brief The QMapboxGL class is a Qt wrapper for the Mapbox GL Native engine.
@@ -1125,6 +1146,8 @@ QMapboxGLPrivate::QMapboxGLPrivate(QMapboxGL *q, const QMapboxGLSettings &settin
qRegisterMetaType<QMapboxGL::MapChange>("QMapboxGL::MapChange");
fileSourceObj->setAccessToken(settings.accessToken().toStdString());
+ fileSourceObj->setAPIBaseURL(settings.apiBaseUrl().toStdString());
+
connect(this, SIGNAL(needsRendering()), q_ptr, SIGNAL(needsRendering()), Qt::QueuedConnection);
connect(this, SIGNAL(mapChanged(QMapboxGL::MapChange)), q_ptr, SIGNAL(mapChanged(QMapboxGL::MapChange)), Qt::QueuedConnection);
connect(this, SIGNAL(copyrightsChanged(QString)), q_ptr, SIGNAL(copyrightsChanged(QString)), Qt::QueuedConnection);