From 68b515cdff46dc1030b027a664ef5f3f6cde946a Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Wed, 8 Feb 2017 16:15:58 +0200 Subject: Default style for the copyright defined on the plugin The Mapbox GL plugin defines a logo image on the copyright notice that needs styling in order to have an appealing look and feel. The default style is empty, so we need to fetch one for the plugin to make this work. Task-number: QTBUG-58601 Change-Id: Ib3f7d7d7fcb2797c6381fc862ce7513b516c9ff5 Reviewed-by: Paolo Angelelli --- src/plugins/geoservices/mapboxgl/logo.png | Bin 0 -> 3620 bytes src/plugins/geoservices/mapboxgl/mapboxgl.pro | 2 ++ src/plugins/geoservices/mapboxgl/mapboxgl.qrc | 5 +++++ .../geoservices/mapboxgl/qgeomapmapboxgl.cpp | 22 +++++++++++++++------ src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.h | 1 + 5 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 src/plugins/geoservices/mapboxgl/logo.png create mode 100644 src/plugins/geoservices/mapboxgl/mapboxgl.qrc (limited to 'src/plugins/geoservices/mapboxgl') diff --git a/src/plugins/geoservices/mapboxgl/logo.png b/src/plugins/geoservices/mapboxgl/logo.png new file mode 100644 index 00000000..57410f79 Binary files /dev/null and b/src/plugins/geoservices/mapboxgl/logo.png differ diff --git a/src/plugins/geoservices/mapboxgl/mapboxgl.pro b/src/plugins/geoservices/mapboxgl/mapboxgl.pro index 6714ee55..81dd37e2 100644 --- a/src/plugins/geoservices/mapboxgl/mapboxgl.pro +++ b/src/plugins/geoservices/mapboxgl/mapboxgl.pro @@ -20,6 +20,8 @@ SOURCES += \ qgeomapmapboxgl.cpp \ qsgmapboxglnode.cpp +RESOURCES += mapboxgl.qrc + OTHER_FILES += \ mapboxgl_plugin.json diff --git a/src/plugins/geoservices/mapboxgl/mapboxgl.qrc b/src/plugins/geoservices/mapboxgl/mapboxgl.qrc new file mode 100644 index 00000000..55ff337b --- /dev/null +++ b/src/plugins/geoservices/mapboxgl/mapboxgl.qrc @@ -0,0 +1,5 @@ + + + logo.png + + diff --git a/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp b/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp index 053a926e..0bcd27de 100644 --- a/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp +++ b/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp @@ -336,6 +336,11 @@ QGeoMapMapboxGL::~QGeoMapMapboxGL() { } +QString QGeoMapMapboxGL::copyrightsStyleSheet() const +{ + return QStringLiteral("* { vertical-align: middle; font-weight: normal }"); +} + void QGeoMapMapboxGL::setMapboxGLSettings(const QMapboxGLSettings& settings) { Q_D(QGeoMapMapboxGL); @@ -395,12 +400,17 @@ void QGeoMapMapboxGL::copyrightsChanged(const QString ©rightsHtml) { Q_D(QGeoMapMapboxGL); + QString copyrightsHtmlFinal = copyrightsHtml; + if (d->m_developmentMode) { - QString copyrightsHtmlDev = "" - + tr("Development access token, do not use in production!") + " - " - + copyrightsHtml; - QGeoMap::copyrightsChanged(copyrightsHtmlDev); - } else { - QGeoMap::copyrightsChanged(copyrightsHtml); + copyrightsHtmlFinal.prepend("" + + QObject::tr("Development access token, do not use in production!") + " - "); } + + if (d->m_activeMapType.name().startsWith("mapbox://")) { + copyrightsHtmlFinal = "
" + + copyrightsHtmlFinal + "
"; + } + + QGeoMap::copyrightsChanged(copyrightsHtmlFinal); } diff --git a/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.h b/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.h index 4e6bf575..d16d0a6a 100644 --- a/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.h +++ b/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.h @@ -51,6 +51,7 @@ public: QGeoMapMapboxGL(QGeoMappingManagerEngineMapboxGL *engine, QObject *parent); virtual ~QGeoMapMapboxGL(); + QString copyrightsStyleSheet() const Q_DECL_OVERRIDE; void setMapboxGLSettings(const QMapboxGLSettings &); private Q_SLOTS: -- cgit v1.2.1