aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/glsleditor
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2017-02-08 14:31:55 +0100
committerEike Ziller <eike.ziller@qt.io>2017-02-27 13:54:59 +0000
commitd64e17ad55f155951fc76e4c2f04299aa9c7a912 (patch)
tree16890479318c917c88392035a461e9edbcf76621 /src/plugins/glsleditor
parentca1d1dfbe2c2b046b5661de20da9e20d4b511680 (diff)
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>
Diffstat (limited to 'src/plugins/glsleditor')
-rw-r--r--src/plugins/glsleditor/GLSLEditor.json.in47
-rw-r--r--src/plugins/glsleditor/GLSLEditor.mimetypes.xml42
-rw-r--r--src/plugins/glsleditor/glsleditor.qrc1
-rw-r--r--src/plugins/glsleditor/glsleditorplugin.cpp3
4 files changed, 46 insertions, 47 deletions
diff --git a/src/plugins/glsleditor/GLSLEditor.json.in b/src/plugins/glsleditor/GLSLEditor.json.in
index 3e5ff3831c..915ae7ae02 100644
--- a/src/plugins/glsleditor/GLSLEditor.json.in
+++ b/src/plugins/glsleditor/GLSLEditor.json.in
@@ -15,5 +15,50 @@
\"Category\" : \"Other Languages\",
\"Description\" : \"Editor for GLSL.\",
\"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=\'application/x-glsl\'>
+ <alias type=\'text/x-glsl\'/>
+ <sub-class-of type=\'text/plain\'/>
+ <comment>GLSL Shader file</comment>
+ <glob pattern=\'*.glsl\'/>
+ <glob pattern=\'*.shader\'/>
+ </mime-type>
+
+ <mime-type type=\'text/x-glsl-frag\'>
+ <sub-class-of type=\'text/x-glsl\'/>
+ <comment>GLSL Fragment Shader file</comment>
+ <glob pattern=\'*.frag\'/>
+ </mime-type>
+
+ <mime-type type=\'text/x-glsl-es-frag\'>
+ <sub-class-of type=\'text/x-glsl\'/>
+ <comment>GLSL/ES Fragment Shader file</comment>
+ <glob pattern=\'*.fsh\'/>
+ </mime-type>
+
+ <mime-type type=\'text/x-glsl-vert\'>
+ <sub-class-of type=\'text/x-glsl\'/>
+ <comment>GLSL Vertex Shader file</comment>
+ <glob pattern=\'*.vert\'/>
+ </mime-type>
+
+ <mime-type type=\'text/x-glsl-es-vert\'>
+ <sub-class-of type=\'text/x-glsl\'/>
+ <comment>GLSL/ES Vertex Shader file</comment>
+ <glob pattern=\'*.vsh\'/>
+ </mime-type>
+
+ <mime-type type=\'text/x-glsl-es-geometry\'>
+ <sub-class-of type=\'text/x-glsl\'/>
+ <comment>GLSL/ES Geometry Shader file</comment>
+ <glob pattern=\'*.gsh\'/>
+ </mime-type>
+
+ </mime-info>
+ \"
}
diff --git a/src/plugins/glsleditor/GLSLEditor.mimetypes.xml b/src/plugins/glsleditor/GLSLEditor.mimetypes.xml
deleted file mode 100644
index 8f4570980a..0000000000
--- a/src/plugins/glsleditor/GLSLEditor.mimetypes.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
-
- <mime-type type="application/x-glsl">
- <alias type="text/x-glsl"/>
- <sub-class-of type="text/plain"/>
- <comment>GLSL Shader file</comment>
- <glob pattern="*.glsl"/>
- <glob pattern="*.shader"/>
- </mime-type>
-
- <mime-type type="text/x-glsl-frag">
- <sub-class-of type="text/x-glsl"/>
- <comment>GLSL Fragment Shader file</comment>
- <glob pattern="*.frag"/>
- </mime-type>
-
- <mime-type type="text/x-glsl-es-frag">
- <sub-class-of type="text/x-glsl"/>
- <comment>GLSL/ES Fragment Shader file</comment>
- <glob pattern="*.fsh"/>
- </mime-type>
-
- <mime-type type="text/x-glsl-vert">
- <sub-class-of type="text/x-glsl"/>
- <comment>GLSL Vertex Shader file</comment>
- <glob pattern="*.vert"/>
- </mime-type>
-
- <mime-type type="text/x-glsl-es-vert">
- <sub-class-of type="text/x-glsl"/>
- <comment>GLSL/ES Vertex Shader file</comment>
- <glob pattern="*.vsh"/>
- </mime-type>
-
- <mime-type type="text/x-glsl-es-geometry">
- <sub-class-of type="text/x-glsl"/>
- <comment>GLSL/ES Geometry Shader file</comment>
- <glob pattern="*.gsh"/>
- </mime-type>
-
-</mime-info>
diff --git a/src/plugins/glsleditor/glsleditor.qrc b/src/plugins/glsleditor/glsleditor.qrc
index cb1c737c9a..88d7aea098 100644
--- a/src/plugins/glsleditor/glsleditor.qrc
+++ b/src/plugins/glsleditor/glsleditor.qrc
@@ -1,6 +1,5 @@
<RCC>
<qresource prefix="/glsleditor">
- <file>GLSLEditor.mimetypes.xml</file>
<file>images/glslfile.png</file>
</qresource>
</RCC>
diff --git a/src/plugins/glsleditor/glsleditorplugin.cpp b/src/plugins/glsleditor/glsleditorplugin.cpp
index 78455da651..945e94f03b 100644
--- a/src/plugins/glsleditor/glsleditorplugin.cpp
+++ b/src/plugins/glsleditor/glsleditorplugin.cpp
@@ -46,7 +46,6 @@
#include <texteditor/texteditorconstants.h>
-#include <utils/mimetypes/mimedatabase.h>
#include <utils/qtcassert.h>
#include <QAction>
@@ -117,8 +116,6 @@ GlslEditorPlugin::~GlslEditorPlugin()
bool GlslEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
{
- Utils::MimeDatabase::addMimeTypes(QLatin1String(":/glsleditor/GLSLEditor.mimetypes.xml"));
-
addAutoReleasedObject(new GlslEditorFactory);
addAutoReleasedObject(new GlslCompletionAssistProvider);