summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2015-12-10 16:33:09 -0800
committerThiago Marcos P. Santos <thiago@mapbox.com>2016-04-20 20:55:51 +0300
commitefb96e80ece9abbd8df73e44f381a4941fddd57c (patch)
tree6e77db5298d2bb04e42b82b07cd29bd7ecc18834 /platform
parentb9bbe68fe0232f554a7c79185e8954b087a48fde (diff)
downloadqtlocation-mapboxgl-efb96e80ece9abbd8df73e44f381a4941fddd57c.tar.gz
[Qt] Use Qt resources for bundling the certificates
Diffstat (limited to 'platform')
-rw-r--r--platform/qt/platform.gyp1
-rw-r--r--platform/qt/qmapbox.qrc5
-rw-r--r--platform/qt/qt.gypi8
-rw-r--r--platform/qt/scripts/configure.sh2
-rw-r--r--platform/qt/src/http_file_source.cpp10
5 files changed, 25 insertions, 1 deletions
diff --git a/platform/qt/platform.gyp b/platform/qt/platform.gyp
index 1135ec4a6a..0ab6169dd6 100644
--- a/platform/qt/platform.gyp
+++ b/platform/qt/platform.gyp
@@ -43,6 +43,7 @@
'../default/string_stdlib.cpp',
'../default/thread.cpp',
'include/qmapboxgl.hpp',
+ 'qmapbox.qrc',
'src/async_task.cpp',
'src/async_task_impl.hpp',
'src/http_file_source.cpp',
diff --git a/platform/qt/qmapbox.qrc b/platform/qt/qmapbox.qrc
new file mode 100644
index 0000000000..adb4cf20fd
--- /dev/null
+++ b/platform/qt/qmapbox.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file alias="ca-bundle.crt">../../common/ca-bundle.crt</file>
+</qresource>
+</RCC>
diff --git a/platform/qt/qt.gypi b/platform/qt/qt.gypi
index 4bec63cd89..e98b3254b0 100644
--- a/platform/qt/qt.gypi
+++ b/platform/qt/qt.gypi
@@ -8,5 +8,13 @@
'action': [ '<(qt_moc)', '<(RULE_INPUT_PATH)', '-o', '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_DIRNAME)/moc_<(RULE_INPUT_ROOT).cpp' ],
'message': 'Generating MOC <(RULE_INPUT_ROOT).cpp',
},
+ {
+ 'rule_name': 'QRC files',
+ 'extension': 'qrc',
+ 'process_outputs_as_sources': 1,
+ 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_DIRNAME)/qrc_<(RULE_INPUT_ROOT).cpp' ],
+ 'action': [ '<(qt_rcc)', '<(RULE_INPUT_PATH)', '-name', '<(RULE_INPUT_ROOT)', '-o', '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_DIRNAME)/qrc_<(RULE_INPUT_ROOT).cpp' ],
+ 'message': 'Generating QRC <(RULE_INPUT_ROOT).cpp',
+ },
],
}
diff --git a/platform/qt/scripts/configure.sh b/platform/qt/scripts/configure.sh
index 5be71e27b8..701207eaeb 100644
--- a/platform/qt/scripts/configure.sh
+++ b/platform/qt/scripts/configure.sh
@@ -31,7 +31,9 @@ function print_qt_flags {
QT_VERSION_MAJOR=$(qmake -query QT_VERSION | cut -d. -f1)
if [ ${QT_VERSION_MAJOR} -gt 4 ] ; then
CONFIG+=" 'qt_moc%': '$(pkg-config Qt${QT_VERSION_MAJOR}Core --variable=host_bins)/moc',"$LN
+ CONFIG+=" 'qt_rcc%': '$(pkg-config Qt${QT_VERSION_MAJOR}Core --variable=host_bins)/rcc',"$LN
else
CONFIG+=" 'qt_moc%': '$(pkg-config QtCore --variable=moc_location)',"$LN
+ CONFIG+=" 'qt_rcc%': '$(pkg-config QtCore --variable=rcc_location)',"$LN
fi
}
diff --git a/platform/qt/src/http_file_source.cpp b/platform/qt/src/http_file_source.cpp
index a38cf42363..87948609df 100644
--- a/platform/qt/src/http_file_source.cpp
+++ b/platform/qt/src/http_file_source.cpp
@@ -9,10 +9,18 @@
#include <QNetworkReply>
#include <QSslConfiguration>
+// Needs to be on the global namespace
+// for linking purposes.
+void initResources() {
+ Q_INIT_RESOURCE(qmapbox);
+}
+
namespace mbgl {
HTTPFileSource::Impl::Impl() : m_manager(new QNetworkAccessManager(this))
{
+ initResources();
+
QNetworkProxyFactory::setUseSystemConfiguration(true);
#if QT_VERSION >= 0x050000
@@ -22,7 +30,7 @@ HTTPFileSource::Impl::Impl() : m_manager(new QNetworkAccessManager(this))
m_ssl.setProtocol(QSsl::TlsV1);
#endif
- m_ssl.setCaCertificates(QSslCertificate::fromPath("ca-bundle.crt"));
+ m_ssl.setCaCertificates(QSslCertificate::fromPath(":ca-bundle.crt"));
if (m_ssl.caCertificates().isEmpty()) {
mbgl::Log::Warning(mbgl::Event::HttpRequest, "Could not load list of certificate authorities");
}