diff options
author | Eike Ziller <eike.ziller@qt.io> | 2017-02-08 14:31:55 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2017-02-27 13:54:59 +0000 |
commit | d64e17ad55f155951fc76e4c2f04299aa9c7a912 (patch) | |
tree | 16890479318c917c88392035a461e9edbcf76621 /src/plugins/perforce | |
parent | ca1d1dfbe2c2b046b5661de20da9e20d4b511680 (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/perforce')
-rw-r--r-- | src/plugins/perforce/Perforce.json.in | 15 | ||||
-rw-r--r-- | src/plugins/perforce/Perforce.mimetypes.xml | 10 | ||||
-rw-r--r-- | src/plugins/perforce/perforce.pro | 2 | ||||
-rw-r--r-- | src/plugins/perforce/perforce.qbs | 1 | ||||
-rw-r--r-- | src/plugins/perforce/perforce.qrc | 5 | ||||
-rw-r--r-- | src/plugins/perforce/perforceplugin.cpp | 3 |
6 files changed, 14 insertions, 22 deletions
diff --git a/src/plugins/perforce/Perforce.json.in b/src/plugins/perforce/Perforce.json.in index 33d213319a4..7d408c00e4d 100644 --- a/src/plugins/perforce/Perforce.json.in +++ b/src/plugins/perforce/Perforce.json.in @@ -15,5 +15,18 @@ \"Category\" : \"Version Control\", \"Description\" : \"Perforce integration.\", \"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/vnd.qtcreator.p4.submit\'> + <comment>Perforce submit template</comment> + <sub-class-of type=\'text/plain\'/> + <magic priority=\'50\'> + <match value=\'# A Perforce Change Specification.\' type=\'string\' offset=\'0\'/> + </magic> + </mime-type> + </mime-info> + \" } diff --git a/src/plugins/perforce/Perforce.mimetypes.xml b/src/plugins/perforce/Perforce.mimetypes.xml deleted file mode 100644 index d65e3d017f4..00000000000 --- a/src/plugins/perforce/Perforce.mimetypes.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0"?> -<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> - <mime-type type="text/vnd.qtcreator.p4.submit"> - <comment>Perforce submit template</comment> - <sub-class-of type="text/plain"/> - <magic priority="50"> - <match value="# A Perforce Change Specification." type="string" offset="0"/> - </magic> - </mime-type> -</mime-info> diff --git a/src/plugins/perforce/perforce.pro b/src/plugins/perforce/perforce.pro index 9f7b07f58bd..ff50724b5f4 100644 --- a/src/plugins/perforce/perforce.pro +++ b/src/plugins/perforce/perforce.pro @@ -29,5 +29,3 @@ FORMS += settingspage.ui \ changenumberdialog.ui \ pendingchangesdialog.ui \ submitpanel.ui - -RESOURCES += perforce.qrc diff --git a/src/plugins/perforce/perforce.qbs b/src/plugins/perforce/perforce.qbs index 26ca73698d8..41bd8008cc6 100644 --- a/src/plugins/perforce/perforce.qbs +++ b/src/plugins/perforce/perforce.qbs @@ -19,7 +19,6 @@ QtcPlugin { "pendingchangesdialog.cpp", "pendingchangesdialog.h", "pendingchangesdialog.ui", - "perforce.qrc", "perforcechecker.cpp", "perforcechecker.h", "perforceeditor.cpp", diff --git a/src/plugins/perforce/perforce.qrc b/src/plugins/perforce/perforce.qrc deleted file mode 100644 index 3605faa03b2..00000000000 --- a/src/plugins/perforce/perforce.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/trolltech.perforce" > - <file>Perforce.mimetypes.xml</file> - </qresource> -</RCC> diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index e06c491eecb..ab85764b851 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -45,7 +45,6 @@ #include <coreplugin/locator/commandlocator.h> #include <texteditor/textdocument.h> #include <utils/fileutils.h> -#include <utils/mimetypes/mimedatabase.h> #include <utils/parameteraction.h> #include <utils/qtcassert.h> #include <utils/synchronousprocess.h> @@ -186,8 +185,6 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er initializeVcs(new PerforceVersionControl(this), context); - Utils::MimeDatabase::addMimeTypes(QLatin1String(":/trolltech.perforce/Perforce.mimetypes.xml")); - m_instance = this; m_settings.fromSettings(ICore::settings()); |