summaryrefslogtreecommitdiff
path: root/src/plugins/geoservices
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2017-02-08 16:15:58 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2017-02-13 15:26:39 +0000
commit68b515cdff46dc1030b027a664ef5f3f6cde946a (patch)
tree6d4ac87cd512f25c21005be46e17d446d3ac379b /src/plugins/geoservices
parent331d8fe606ce0355a7126eb8b68749ceb8b3f15f (diff)
downloadqtlocation-68b515cdff46dc1030b027a664ef5f3f6cde946a.tar.gz
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 <paolo.angelelli@qt.io>
Diffstat (limited to 'src/plugins/geoservices')
-rw-r--r--src/plugins/geoservices/esri/geotiledmap_esri.cpp7
-rw-r--r--src/plugins/geoservices/mapboxgl/logo.pngbin0 -> 3620 bytes
-rw-r--r--src/plugins/geoservices/mapboxgl/mapboxgl.pro2
-rw-r--r--src/plugins/geoservices/mapboxgl/mapboxgl.qrc5
-rw-r--r--src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp22
-rw-r--r--src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.h1
-rw-r--r--src/plugins/geoservices/nokia/qgeotiledmap_nokia.cpp2
-rw-r--r--src/plugins/geoservices/nokia/resource.qrc2
-rw-r--r--src/plugins/geoservices/osm/qgeotiledmaposm.cpp7
9 files changed, 28 insertions, 20 deletions
diff --git a/src/plugins/geoservices/esri/geotiledmap_esri.cpp b/src/plugins/geoservices/esri/geotiledmap_esri.cpp
index 8caf055d..9171fc2b 100644
--- a/src/plugins/geoservices/esri/geotiledmap_esri.cpp
+++ b/src/plugins/geoservices/esri/geotiledmap_esri.cpp
@@ -44,11 +44,6 @@
QT_BEGIN_NAMESPACE
-static QString bodify(const QString &html)
-{
- return QStringLiteral("<body>") + html + QStringLiteral("</body>");
-}
-
GeoTiledMapEsri::GeoTiledMapEsri(GeoTiledMappingManagerEngineEsri *engine, QObject *parent) :
QGeoTiledMap(engine, parent), m_engine(engine), m_mapId(-1)
{
@@ -72,7 +67,7 @@ void GeoTiledMapEsri::evaluateCopyrights(const QSet<QGeoTileSpec> &visibleTiles)
GeoMapSource *mapSource = engine()->mapSource(m_mapId);
if (mapSource)
- emit copyrightsChanged(bodify(mapSource->copyright()));
+ emit copyrightsChanged(mapSource->copyright());
}
QT_END_NAMESPACE
diff --git a/src/plugins/geoservices/mapboxgl/logo.png b/src/plugins/geoservices/mapboxgl/logo.png
new file mode 100644
index 00000000..57410f79
--- /dev/null
+++ b/src/plugins/geoservices/mapboxgl/logo.png
Binary files 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 @@
+<RCC>
+ <qresource prefix="/mapboxgl">
+ <file>logo.png</file>
+ </qresource>
+</RCC>
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 &copyrightsHtml)
{
Q_D(QGeoMapMapboxGL);
+ QString copyrightsHtmlFinal = copyrightsHtml;
+
if (d->m_developmentMode) {
- QString copyrightsHtmlDev = "<a href=\"https://www.mapbox.com/pricing/\">"
- + tr("Development access token, do not use in production!") + "</a> - "
- + copyrightsHtml;
- QGeoMap::copyrightsChanged(copyrightsHtmlDev);
- } else {
- QGeoMap::copyrightsChanged(copyrightsHtml);
+ copyrightsHtmlFinal.prepend("<a href='https://www.mapbox.com/pricing'>"
+ + QObject::tr("Development access token, do not use in production!") + "</a> - ");
}
+
+ if (d->m_activeMapType.name().startsWith("mapbox://")) {
+ copyrightsHtmlFinal = "<table><tr><th><img src='qrc:/mapboxgl/logo.png'/></th><th>"
+ + copyrightsHtmlFinal + "</th></tr></table>";
+ }
+
+ 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:
diff --git a/src/plugins/geoservices/nokia/qgeotiledmap_nokia.cpp b/src/plugins/geoservices/nokia/qgeotiledmap_nokia.cpp
index 5179fff4..90be0ae9 100644
--- a/src/plugins/geoservices/nokia/qgeotiledmap_nokia.cpp
+++ b/src/plugins/geoservices/nokia/qgeotiledmap_nokia.cpp
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
*/
QGeoTiledMapNokia::QGeoTiledMapNokia(QGeoTiledMappingManagerEngineNokia *engine, QObject *parent /*= 0*/) :
QGeoTiledMap(engine, parent),
- m_logo(":/images/logo.png"), // HERE logo image
+ m_logo(":/nokia/logo.png"), // HERE logo image
m_engine(engine)
{}
diff --git a/src/plugins/geoservices/nokia/resource.qrc b/src/plugins/geoservices/nokia/resource.qrc
index d48a6ca2..41d973c5 100644
--- a/src/plugins/geoservices/nokia/resource.qrc
+++ b/src/plugins/geoservices/nokia/resource.qrc
@@ -1,5 +1,5 @@
<RCC>
- <qresource prefix="/images">
+ <qresource prefix="/nokia">
<file>logo.png</file>
</qresource>
</RCC>
diff --git a/src/plugins/geoservices/osm/qgeotiledmaposm.cpp b/src/plugins/geoservices/osm/qgeotiledmaposm.cpp
index e1383afb..e31cbdd5 100644
--- a/src/plugins/geoservices/osm/qgeotiledmaposm.cpp
+++ b/src/plugins/geoservices/osm/qgeotiledmaposm.cpp
@@ -45,11 +45,6 @@
QT_BEGIN_NAMESPACE
-static QString bodify(const QString &html)
-{
- return QStringLiteral("<body>") + html + QStringLiteral("</body>");
-}
-
QGeoTiledMapOsm::QGeoTiledMapOsm(QGeoTiledMappingManagerEngineOsm *engine, QObject *parent)
: QGeoTiledMap(engine, parent), m_mapId(-1), m_engine(engine)
{
@@ -114,7 +109,7 @@ void QGeoTiledMapOsm::onProviderDataUpdated(const QGeoTileProviderOsm *provider)
if (copyRights.isEmpty() && provider->mapType().style() == QGeoMapType::CustomMap)
copyRights = m_engine->customCopyright();
- emit copyrightsChanged(bodify(copyRights));
+ emit copyrightsChanged(copyRights);
}
QT_END_NAMESPACE