diff options
author | David Faure <david.faure@kdab.com> | 2017-10-08 18:31:26 +0200 |
---|---|---|
committer | David Faure <david.faure@kdab.com> | 2017-11-30 12:54:49 +0000 |
commit | 7a5644d6481a3c1a7416772998ca4e60c977bfbd (patch) | |
tree | d9667bb9597342cd0c9e832d60061e6e45790c3a /src/corelib/mimetypes/qmimetype.cpp | |
parent | 8835c0376befd009702b9a17c506639e31c842b9 (diff) |
QMimeDatabase: redesign to use both binary and XML providers
Previously, we would use mime.cache in all mime directories if at
least one of them had such a file (other than the most-local one),
otherwise the "source" XML would be used in all directories.
Now it's possible to use mime.cache in those directories which
have one, and XML in those directories that don't.
Not only is this more correct, it will allow in a subsequent
commit to bundle the binary cache in QtCore's qrc rather than
the very big XML file.
The design change to allow this is that now every provider
only deals with a single directory, and QMimeDatabasePrivate
takes care of creating multiple providers, one for each dir.
This required to move most of the loops from the binary provider
up to QMimeDatabasePrivate itself.
Change-Id: Iac82d5f5836b80d45076e586b903d16fa2525b34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/mimetypes/qmimetype.cpp')
-rw-r--r-- | src/corelib/mimetypes/qmimetype.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/corelib/mimetypes/qmimetype.cpp b/src/corelib/mimetypes/qmimetype.cpp index 668b22e7cf..8f6237c1cb 100644 --- a/src/corelib/mimetypes/qmimetype.cpp +++ b/src/corelib/mimetypes/qmimetype.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE QMimeTypePrivate::QMimeTypePrivate() - : loaded(false) + : loaded(false), fromCache(false) {} QMimeTypePrivate::QMimeTypePrivate(const QMimeType &other) @@ -76,7 +76,6 @@ void QMimeTypePrivate::clear() genericIconName.clear(); iconName.clear(); globPatterns.clear(); - loaded = false; } void QMimeTypePrivate::addGlobPattern(const QString &pattern) @@ -368,12 +367,12 @@ QStringList QMimeType::globPatterns() const */ QStringList QMimeType::parentMimeTypes() const { - return QMimeDatabasePrivate::instance()->parents(d->name); + return QMimeDatabasePrivate::instance()->mimeParents(d->name); } static void collectParentMimeTypes(const QString &mime, QStringList &allParents) { - const QStringList parents = QMimeDatabasePrivate::instance()->parents(mime); + const QStringList parents = QMimeDatabasePrivate::instance()->mimeParents(mime); for (const QString &parent : parents) { // I would use QSet, but since order matters I better not if (!allParents.contains(parent)) |