summaryrefslogtreecommitdiff
path: root/src/plugins/beautifier/abstractsettings.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2017-03-02 12:07:11 +0100
committerhjk <hjk@qt.io>2017-03-03 07:57:54 +0000
commit3f5caf4cdcb66e5187a9d33bbd2fa67d3bddd50d (patch)
tree1ad8ac1679aedae5cb84d499966819c6265b5af8 /src/plugins/beautifier/abstractsettings.cpp
parent2cd8378148362b53a29d2166136f248281293f30 (diff)
downloadqt-creator-3f5caf4cdcb66e5187a9d33bbd2fa67d3bddd50d.tar.gz
Utils: Wrap MimeDatabase into static functions
To avoid repeating the 'MimeDatabase mdb; mdb.something(); ' mantra all over the place. Change-Id: I4bfef62e73275a991455141671d6071162788e9d Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/beautifier/abstractsettings.cpp')
-rw-r--r--src/plugins/beautifier/abstractsettings.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/plugins/beautifier/abstractsettings.cpp b/src/plugins/beautifier/abstractsettings.cpp
index 31b9d98641..acd5ba41f7 100644
--- a/src/plugins/beautifier/abstractsettings.cpp
+++ b/src/plugins/beautifier/abstractsettings.cpp
@@ -155,10 +155,9 @@ QString AbstractSettings::supportedMimeTypesAsString() const
void AbstractSettings::setSupportedMimeTypes(const QString &mimes)
{
const QStringList stringTypes = mimes.split(';');
- const Utils::MimeDatabase mdb;
QStringList types;
for (const QString &type : stringTypes) {
- const Utils::MimeType mime = mdb.mimeTypeForName(type.trimmed());
+ const Utils::MimeType mime = Utils::mimeTypeForName(type.trimmed());
if (!mime.isValid())
continue;
const QString canonicalName = mime.name();
@@ -180,8 +179,7 @@ bool AbstractSettings::isApplicable(const Core::IDocument *document) const
if (m_supportedMimeTypes.isEmpty())
return true;
- const Utils::MimeDatabase mdb;
- const Utils::MimeType documentMimeType = mdb.mimeTypeForName(document->mimeType());
+ const Utils::MimeType documentMimeType = Utils::mimeTypeForName(document->mimeType());
return Utils::anyOf(m_supportedMimeTypes, [&documentMimeType](const QString &mime) {
return documentMimeType.inherits(mime);
});