summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2017-05-11 15:41:37 +0300
committerPaolo Angelelli <paolo.angelelli@qt.io>2017-05-20 09:29:20 +0000
commit5767601d95e33b20962d0cd88cc6ce5c8c724a91 (patch)
tree5e82ea58d1117204a4a07cd169394c38fc0af6cc
parent5bae353bc2faf0aab222d09b1bf21fc0e0dc37eb (diff)
downloadqtlocation-5767601d95e33b20962d0cd88cc6ce5c8c724a91.tar.gz
Fix resources not loading on static builds
Explicitly call Q_INIT_RESOURCE, otherwise the resources are not found and the plugins using resources are broken when building Qt with -static. This patch also adds a prefix to these resources to avoid collision, since they are very generic like "logo.png" or "maps.json". Task-number: QTBUG-60007 Change-Id: Ifb73e9b97af107f2e24f5478f3de534bbd40e158 Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
-rw-r--r--src/plugins/geoservices/esri/esri.qrc2
-rw-r--r--src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.cpp2
-rw-r--r--src/plugins/geoservices/mapboxgl/qgeoserviceproviderpluginmapboxgl.cpp10
-rw-r--r--src/plugins/geoservices/mapboxgl/qgeoserviceproviderpluginmapboxgl.h2
-rw-r--r--src/plugins/geoservices/nokia/nokia.pro2
-rw-r--r--src/plugins/geoservices/nokia/nokia.qrc (renamed from src/plugins/geoservices/nokia/resource.qrc)0
-rw-r--r--src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.cpp10
-rw-r--r--src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.h2
8 files changed, 27 insertions, 3 deletions
diff --git a/src/plugins/geoservices/esri/esri.qrc b/src/plugins/geoservices/esri/esri.qrc
index 43b0857f..d085b09f 100644
--- a/src/plugins/geoservices/esri/esri.qrc
+++ b/src/plugins/geoservices/esri/esri.qrc
@@ -1,5 +1,5 @@
<RCC>
- <qresource prefix="/">
+ <qresource prefix="/esri">
<file>maps.json</file>
</qresource>
</RCC>
diff --git a/src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.cpp b/src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.cpp
index 00d17327..23783d7e 100644
--- a/src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.cpp
+++ b/src/plugins/geoservices/esri/geotiledmappingmanagerengine_esri.cpp
@@ -240,7 +240,7 @@ bool GeoTiledMappingManagerEngineEsri::initializeMapSources(QGeoServiceProvider:
QString *errorString)
{
initResources();
- QFile mapsFile(":/maps.json");
+ QFile mapsFile(":/esri/maps.json");
if (!mapsFile.open(QIODevice::ReadOnly)) {
*error = QGeoServiceProvider::NotSupportedError;
diff --git a/src/plugins/geoservices/mapboxgl/qgeoserviceproviderpluginmapboxgl.cpp b/src/plugins/geoservices/mapboxgl/qgeoserviceproviderpluginmapboxgl.cpp
index fb8dd19e..c7d5d3ee 100644
--- a/src/plugins/geoservices/mapboxgl/qgeoserviceproviderpluginmapboxgl.cpp
+++ b/src/plugins/geoservices/mapboxgl/qgeoserviceproviderpluginmapboxgl.cpp
@@ -40,8 +40,18 @@
#include <QtGui/QOpenGLContext>
+static void initResources()
+{
+ Q_INIT_RESOURCE(mapboxgl);
+}
+
QT_BEGIN_NAMESPACE
+QGeoServiceProviderFactoryMapboxGL::QGeoServiceProviderFactoryMapboxGL()
+{
+ initResources();
+}
+
QGeoCodingManagerEngine *QGeoServiceProviderFactoryMapboxGL::createGeocodingManagerEngine(
const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString) const
{
diff --git a/src/plugins/geoservices/mapboxgl/qgeoserviceproviderpluginmapboxgl.h b/src/plugins/geoservices/mapboxgl/qgeoserviceproviderpluginmapboxgl.h
index 2bba96f1..b9c0098a 100644
--- a/src/plugins/geoservices/mapboxgl/qgeoserviceproviderpluginmapboxgl.h
+++ b/src/plugins/geoservices/mapboxgl/qgeoserviceproviderpluginmapboxgl.h
@@ -51,6 +51,8 @@ class QGeoServiceProviderFactoryMapboxGL: public QObject, public QGeoServiceProv
FILE "mapboxgl_plugin.json")
public:
+ QGeoServiceProviderFactoryMapboxGL();
+
QGeoCodingManagerEngine *createGeocodingManagerEngine(const QVariantMap &parameters,
QGeoServiceProvider::Error *error,
QString *errorString) const;
diff --git a/src/plugins/geoservices/nokia/nokia.pro b/src/plugins/geoservices/nokia/nokia.pro
index c60bc7af..c6dadd86 100644
--- a/src/plugins/geoservices/nokia/nokia.pro
+++ b/src/plugins/geoservices/nokia/nokia.pro
@@ -45,7 +45,7 @@ SOURCES += \
include(placesv2/placesv2.pri)
-RESOURCES += resource.qrc
+RESOURCES += nokia.qrc
INCLUDEPATH += ../../../location/maps
diff --git a/src/plugins/geoservices/nokia/resource.qrc b/src/plugins/geoservices/nokia/nokia.qrc
index 41d973c5..41d973c5 100644
--- a/src/plugins/geoservices/nokia/resource.qrc
+++ b/src/plugins/geoservices/nokia/nokia.qrc
diff --git a/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.cpp b/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.cpp
index 4deac4ee..f68a0d99 100644
--- a/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.cpp
+++ b/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.cpp
@@ -47,6 +47,11 @@
#include <QNetworkProxy>
#include <QCoreApplication>
+static void initResources()
+{
+ Q_INIT_RESOURCE(nokia);
+}
+
QT_BEGIN_NAMESPACE
namespace
@@ -110,6 +115,11 @@ namespace
}
}
+QGeoServiceProviderFactoryNokia::QGeoServiceProviderFactoryNokia()
+{
+ initResources();
+}
+
QGeoCodingManagerEngine *QGeoServiceProviderFactoryNokia::createGeocodingManagerEngine(
const QVariantMap &parameters,
QGeoServiceProvider::Error *error,
diff --git a/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.h b/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.h
index bce65cbf..5ed2645e 100644
--- a/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.h
+++ b/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.h
@@ -52,6 +52,8 @@ class QGeoServiceProviderFactoryNokia : public QObject, public QGeoServiceProvid
FILE "nokia_plugin.json")
public:
+ QGeoServiceProviderFactoryNokia();
+
QGeoCodingManagerEngine *createGeocodingManagerEngine(const QVariantMap &parameters,
QGeoServiceProvider::Error *error,
QString *errorString) const;