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

@@ -15,5 +15,22 @@
\"Category\" : \"Version Control\",
\"Description\" : \"Git 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.git.commit\'>
<sub-class-of type=\'text/plain\'/>
<comment>Git Commit File</comment>
<glob pattern=\'COMMIT_MSG\'/>
<glob pattern=\'COMMIT_EDITMSG\'/>
</mime-type>
<mime-type type=\'text/vnd.qtcreator.git.rebase\'>
<sub-class-of type=\'text/plain\'/>
<comment>Git Commit File</comment>
<glob pattern=\'git-rebase-todo\'/>
</mime-type>
</mime-info>
\"
}

View File

@@ -1,14 +0,0 @@
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/vnd.qtcreator.git.commit">
<sub-class-of type="text/plain"/>
<comment>Git Commit File</comment>
<glob pattern="COMMIT_MSG"/>
<glob pattern="COMMIT_EDITMSG"/>
</mime-type>
<mime-type type="text/vnd.qtcreator.git.rebase">
<sub-class-of type="text/plain"/>
<comment>Git Commit File</comment>
<glob pattern="git-rebase-todo"/>
</mime-type>
</mime-info>

View File

@@ -1,6 +1,5 @@
<RCC>
<qresource prefix="/git">
<file>images/arrowup.png</file>
<file>Git.mimetypes.xml</file>
</qresource>
</RCC>

View File

@@ -59,7 +59,6 @@
#include <coreplugin/messagebox.h>
#include <utils/asconst.h>
#include <utils/mimetypes/mimedatabase.h>
#include <utils/qtcassert.h>
#include <utils/parameteraction.h>
#include <utils/pathchooser.h>
@@ -99,7 +98,6 @@ namespace Git {
namespace Internal {
const unsigned minimumRequiredVersion = 0x010800;
const char RC_GIT_MIME_XML[] = ":/git/Git.mimetypes.xml";
const VcsBaseEditorParameters editorParameters[] = {
{
@@ -642,8 +640,6 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
connect(VcsManager::instance(), &VcsManager::repositoryChanged,
this, &GitPlugin::updateBranches, Qt::QueuedConnection);
Utils::MimeDatabase::addMimeTypes(RC_GIT_MIME_XML);
/* "Gerrit" */
m_gerritPlugin = new Gerrit::Internal::GerritPlugin(this);
const bool ok = m_gerritPlugin->initialize(remoteRepositoryMenu);