Move mimetype definitions to plugin specs

- Avoids the hassle of QRC files and manually registering mime types
- Avoids performance regressions because of mime types that are
  registered after mime database has been used
- Makes it technically possible to detect that a disabled plugin could
  handle a mime type if it was enabled

Change-Id: I373008b1b56e9c6b4853055f20b3eeb112a6eff9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2017-02-08 14:31:55 +01:00
parent ca1d1dfbe2
commit d64e17ad55
120 changed files with 596 additions and 650 deletions

View File

@@ -16,5 +16,47 @@
\"Category\" : \"Qt Quick\",
\"Description\" : \"Tools for analyzing Qml/JS code.\",
\"Url\" : \"http://www.qt.io\",
$$dependencyList
$$dependencyList,
\"Mimetypes\" : \"
<?xml version=\'1.0\'?>
<mime-info xmlns=\'http://www.freedesktop.org/standards/shared-mime-info\'>
<mime-type type=\'text/x-qml\'>
<alias type=\'application/x-qml\'/>
<!-- sub class is missing in the freedesktop.org definition -->
<sub-class-of type=\'text/plain\'/>
<comment>QML file</comment>
<glob pattern=\'*.qml\' weight=\'70\'/>
</mime-type>
<mime-type type=\'application/x-qt.qbs+qml\'>
<alias type=\'text/x-qt.qbs+qml\'/>
<sub-class-of type=\'text/x-qml\'/>
<comment>Qt Build Suite file</comment>
<glob pattern=\'*.qbs\' weight=\'70\'/>
</mime-type>
<mime-type type=\'application/x-qt.ui+qml\'>
<alias type=\'text/x-qt.ui+qml\'/>
<sub-class-of type=\'text/x-qml\'/>
<comment>QtQuick Designer ui file</comment>
<glob pattern=\'*.ui.qml\' weight=\'70\'/>
</mime-type>
<mime-type type=\'application/x-qmlproject\'>
<alias type=\'text/x-qmlproject\'/>
<sub-class-of type=\'text/x-qml\'/>
<comment>Qt Creator Qt UI project file</comment>
<glob pattern=\'*.qmlproject\' weight=\'70\'/>
</mime-type>
<mime-type type=\'application/x-qt.meta-info+qml\'>
<alias type=\'text/x-qt.meta-info+qml\'/>
<sub-class-of type=\'text/x-qml\'/>
<comment>QML file</comment>
<glob pattern=\'*.qmltypes\' weight=\'70\'/>
</mime-type>
<mime-type type=\'application/json\'>
<sub-class-of type=\'text/plain\'/>
<comment>JSON file</comment>
<glob pattern=\'*.json\' weight=\'70\'/>
</mime-type>
</mime-info>
\"
}

View File

@@ -1,39 +0,0 @@
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/x-qml">
<alias type="application/x-qml"/>
<!-- sub class is missing in the freedesktop.org definition -->
<sub-class-of type="text/plain"/>
<comment>QML file</comment>
<glob pattern="*.qml" weight="70"/>
</mime-type>
<mime-type type="application/x-qt.qbs+qml">
<alias type="text/x-qt.qbs+qml"/>
<sub-class-of type="text/x-qml"/>
<comment>Qt Build Suite file</comment>
<glob pattern="*.qbs" weight="70"/>
</mime-type>
<mime-type type="application/x-qt.ui+qml">
<alias type="text/x-qt.ui+qml"/>
<sub-class-of type="text/x-qml"/>
<comment>QtQuick Designer ui file</comment>
<glob pattern="*.ui.qml" weight="70"/>
</mime-type>
<mime-type type="application/x-qmlproject">
<alias type="text/x-qmlproject"/>
<sub-class-of type="text/x-qml"/>
<comment>Qt Creator Qt UI project file</comment>
<glob pattern="*.qmlproject" weight="70"/>
</mime-type>
<mime-type type="application/x-qt.meta-info+qml">
<alias type="text/x-qt.meta-info+qml"/>
<sub-class-of type="text/x-qml"/>
<comment>QML file</comment>
<glob pattern="*.qmltypes" weight="70"/>
</mime-type>
<mime-type type="application/json">
<sub-class-of type="text/plain"/>
<comment>JSON file</comment>
<glob pattern="*.json" weight="70"/>
</mime-type>
</mime-info>

View File

@@ -2,6 +2,5 @@
<qresource prefix="/qmljstools">
<file>images/category_qml.png</file>
<file>images/prompt.png</file>
<file>QmlJSTools.mimetypes.xml</file>
</qresource>
</RCC>

View File

@@ -38,7 +38,6 @@
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <utils/mimetypes/mimedatabase.h>
#include <QtPlugin>
#include <QMenu>
@@ -68,8 +67,6 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
Q_UNUSED(arguments)
Q_UNUSED(error)
Utils::MimeDatabase::addMimeTypes(QLatin1String(":/qmljstools/QmlJSTools.mimetypes.xml"));
m_settings = new QmlJSToolsSettings(this); // force registration of qmljstools settings
// Objects