summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qresource.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2018-10-31 22:42:14 -0700
committerThiago Macieira <thiago.macieira@intel.com>2018-12-11 03:57:35 +0000
commitf25bc30d8d9d13fffd34213dfbf5e7373a18222a (patch)
treeb647201ffe2af97afd901ad09d47817270bb9968 /src/corelib/io/qresource.h
parent163b5c02785c0462a31b9a3f5f05cda54e03de78 (diff)
QResource: add support for resources compressed with Zstandard
See next commit for details on why this is a good idea. [ChangeLog][Important Behavior Changes] The Qt resource system now supports compressing content using the Zstandard (https://zstd.net) algorithm. Compared to zlib, it compresses better for the same CPU time, so this algorithm is the default. QResource::isCompressed() returns true for either compression algorithm. Use QResource::compressionAlgorithm() to find out which algorithm to decompress. QFile will automatically decompress using the correct algorithm. Change-Id: I343f2beed55440a7ac0bfffd1562e9a8f94933a7 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/io/qresource.h')
-rw-r--r--src/corelib/io/qresource.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/io/qresource.h b/src/corelib/io/qresource.h
index 895cf0456e..9aa17608ce 100644
--- a/src/corelib/io/qresource.h
+++ b/src/corelib/io/qresource.h
@@ -54,6 +54,12 @@ class QResourcePrivate;
class Q_CORE_EXPORT QResource
{
public:
+ enum Compression {
+ NoCompression,
+ ZlibCompression,
+ ZstdCompression
+ };
+
QResource(const QString &file=QString(), const QLocale &locale=QLocale());
~QResource();
@@ -67,6 +73,7 @@ public:
bool isValid() const;
bool isCompressed() const;
+ Compression compressionAlgorithm() const;
qint64 size() const;
const uchar *data() const;
QDateTime lastModified() const;