From aed47778b6677f3a4ca5f87e806191f25de3c6a9 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 19 Oct 2016 15:32:03 +0300 Subject: Ignore .svgz images unless compression is enabled The imageformats plugin was trying to pass them off to QSvgRenderer, which can't handle them when QT_NO_COMPRESS is defined. Change-Id: I92241370d8fd4ed2328fb13a01306fa8a7e5ef6e Reviewed-by: Edward Welbourne Reviewed-by: Eirik Aavitsland --- src/plugins/imageformats/svg/main.cpp | 4 ++++ src/plugins/imageformats/svg/qsvgiohandler.cpp | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/plugins/imageformats/svg/main.cpp b/src/plugins/imageformats/svg/main.cpp index bf908f9..8eb80b3 100644 --- a/src/plugins/imageformats/svg/main.cpp +++ b/src/plugins/imageformats/svg/main.cpp @@ -62,7 +62,11 @@ QStringList QSvgPlugin::keys() const QImageIOPlugin::Capabilities QSvgPlugin::capabilities(QIODevice *device, const QByteArray &format) const { +#ifndef QT_NO_COMPRESS if (format == "svg" || format == "svgz") +#else + if (format == "svg") +#endif return Capabilities(CanRead); if (!format.isEmpty()) return 0; diff --git a/src/plugins/imageformats/svg/qsvgiohandler.cpp b/src/plugins/imageformats/svg/qsvgiohandler.cpp index 8a9cbb2..7a9c337 100644 --- a/src/plugins/imageformats/svg/qsvgiohandler.cpp +++ b/src/plugins/imageformats/svg/qsvgiohandler.cpp @@ -82,8 +82,10 @@ bool QSvgIOHandlerPrivate::load(QIODevice *device) const QByteArray &ba = buf->data(); res = r.load(QByteArray::fromRawData(ba.constData() + buf->pos(), ba.size() - buf->pos())); buf->seek(ba.size()); +#ifndef QT_NO_COMPRESS } else if (q->format() == "svgz") { res = r.load(device->readAll()); +#endif } else { xmlReader.setDevice(device); res = r.load(&xmlReader); @@ -119,10 +121,13 @@ bool QSvgIOHandler::canRead() const return true; // Will happen if we have been asked for the size QByteArray buf = device()->peek(8); +#ifndef QT_NO_COMPRESS if (buf.startsWith("\x1f\x8b")) { setFormat("svgz"); return true; - } else if (buf.contains("peek(8); - return buf.startsWith("\x1f\x8b") || buf.contains(" Date: Thu, 3 Nov 2016 18:24:08 +0100 Subject: remove dependencies from sync.profile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the CI obtains them from the qt5 super repo nowadays. Change-Id: Ib4d20a382925262109c5d5f63372d767af188aba Reviewed-by: Jędrzej Nowacki --- sync.profile | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/sync.profile b/sync.profile index e7d8f15..cd6c4bf 100644 --- a/sync.profile +++ b/sync.profile @@ -3,13 +3,3 @@ ); %moduleheaders = ( # restrict the module headers to those found in relative path ); -# Module dependencies. -# Every module that is required to build this module should have one entry. -# Each of the module version specifiers can take one of the following values: -# - A specific Git revision. -# - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch) -# - an empty string to use the same branch under test (dependencies will become "refs/heads/master" if we are in the master branch) -# -%dependencies = ( - "qtbase" => "", -); -- cgit v1.2.1 From 6d4eead2c5406b8cf23cf3648ea619338ac7f68a Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 19 Oct 2016 15:46:58 +0300 Subject: Imageformat plugin: Add mime type "image/svg+xml-compressed" Change-Id: I3cf5d9b6d6212128adab4682de33b192672f7c1f Reviewed-by: Edward Welbourne Reviewed-by: Eirik Aavitsland --- src/plugins/imageformats/svg/svg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/imageformats/svg/svg.json b/src/plugins/imageformats/svg/svg.json index c8825d4..970914d 100644 --- a/src/plugins/imageformats/svg/svg.json +++ b/src/plugins/imageformats/svg/svg.json @@ -1,4 +1,4 @@ { "Keys": [ "svg", "svgz" ], - "MimeTypes": [ "image/svg+xml" ] + "MimeTypes": [ "image/svg+xml", "image/svg+xml-compressed" ] } -- cgit v1.2.1 From 4704ecbf79053f2e1cde3c869b03c769be6ef207 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 19 Oct 2016 15:50:15 +0300 Subject: Use separate metadata files for plugins if QT_NO_COMPRESS is defined Change-Id: Ib15aa96c2ed84cf3ce9793385476f9fb3cacec8c Reviewed-by: Edward Welbourne Reviewed-by: Oswald Buddenhagen Reviewed-by: Eirik Aavitsland --- src/plugins/iconengines/svgiconengine/main.cpp | 4 ++++ src/plugins/iconengines/svgiconengine/qsvgiconengine-nocompress.json | 3 +++ src/plugins/iconengines/svgiconengine/svgiconengine.pro | 1 + src/plugins/imageformats/svg/main.cpp | 4 ++++ src/plugins/imageformats/svg/svg-nocompress.json | 4 ++++ 5 files changed, 16 insertions(+) create mode 100644 src/plugins/iconengines/svgiconengine/qsvgiconengine-nocompress.json create mode 100644 src/plugins/imageformats/svg/svg-nocompress.json diff --git a/src/plugins/iconengines/svgiconengine/main.cpp b/src/plugins/iconengines/svgiconengine/main.cpp index 8822982..0eade5a 100644 --- a/src/plugins/iconengines/svgiconengine/main.cpp +++ b/src/plugins/iconengines/svgiconengine/main.cpp @@ -47,7 +47,11 @@ QT_BEGIN_NAMESPACE class QSvgIconPlugin : public QIconEnginePlugin { Q_OBJECT +#ifndef QT_NO_COMPRESS Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QIconEngineFactoryInterface" FILE "qsvgiconengine.json") +#else + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QIconEngineFactoryInterface" FILE "qsvgiconengine-nocompress.json") +#endif public: QStringList keys() const; diff --git a/src/plugins/iconengines/svgiconengine/qsvgiconengine-nocompress.json b/src/plugins/iconengines/svgiconengine/qsvgiconengine-nocompress.json new file mode 100644 index 0000000..a3e1ac3 --- /dev/null +++ b/src/plugins/iconengines/svgiconengine/qsvgiconengine-nocompress.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "svg" ] +} diff --git a/src/plugins/iconengines/svgiconengine/svgiconengine.pro b/src/plugins/iconengines/svgiconengine/svgiconengine.pro index eb6847b..bfc739f 100644 --- a/src/plugins/iconengines/svgiconengine/svgiconengine.pro +++ b/src/plugins/iconengines/svgiconengine/svgiconengine.pro @@ -4,6 +4,7 @@ HEADERS += qsvgiconengine.h SOURCES += main.cpp \ qsvgiconengine.cpp OTHER_FILES += qsvgiconengine.json +OTHER_FILES += qsvgiconengine-nocompress.json QT += svg core-private gui-private PLUGIN_TYPE = iconengines diff --git a/src/plugins/imageformats/svg/main.cpp b/src/plugins/imageformats/svg/main.cpp index 8eb80b3..24a61b8 100644 --- a/src/plugins/imageformats/svg/main.cpp +++ b/src/plugins/imageformats/svg/main.cpp @@ -47,7 +47,11 @@ QT_BEGIN_NAMESPACE class QSvgPlugin : public QImageIOPlugin { Q_OBJECT +#ifndef QT_NO_COMPRESS Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "svg.json") +#else + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "svg-nocompress.json") +#endif public: QStringList keys() const; diff --git a/src/plugins/imageformats/svg/svg-nocompress.json b/src/plugins/imageformats/svg/svg-nocompress.json new file mode 100644 index 0000000..3b5a653 --- /dev/null +++ b/src/plugins/imageformats/svg/svg-nocompress.json @@ -0,0 +1,4 @@ +{ + "Keys": [ "svg" ], + "MimeTypes": [ "image/svg+xml" ] +} -- cgit v1.2.1