forked from qt-creator/qt-creator
Use new mime database
Change-Id: I4305872b6b11ef3e8a364280ffa5209a5a793600 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
8
src/plugins/android/Android.mimetypes.xml
Normal file
8
src/plugins/android/Android.mimetypes.xml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
||||||
|
<mime-type type="application/vnd.google.android.android_manifest">
|
||||||
|
<comment>Android manifest file</comment>
|
||||||
|
<sub-class-of type="application/xml"/>
|
||||||
|
<glob pattern="AndroidManifest.xml"/>
|
||||||
|
</mime-type>
|
||||||
|
</mime-info>
|
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
|
||||||
<mime-type type="text/x-java">
|
|
||||||
<sub-class-of type="text/x-csrc"/>
|
|
||||||
<comment>Java Source file</comment>
|
|
||||||
<glob pattern="*.java"/>
|
|
||||||
</mime-type>
|
|
||||||
</mime-info>
|
|
@@ -2,6 +2,6 @@
|
|||||||
<qresource prefix="/android">
|
<qresource prefix="/android">
|
||||||
<file>images/QtAndroid.png</file>
|
<file>images/QtAndroid.png</file>
|
||||||
<file>images/download.png</file>
|
<file>images/download.png</file>
|
||||||
<file>Java.mimetypes.xml</file>
|
<file>Android.mimetypes.xml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@@ -50,10 +50,10 @@
|
|||||||
# include "androidqbspropertyprovider.h"
|
# include "androidqbspropertyprovider.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <projectexplorer/kitmanager.h>
|
#include <projectexplorer/kitmanager.h>
|
||||||
#include <qtsupport/qtversionmanager.h>
|
#include <qtsupport/qtversionmanager.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
|
||||||
@@ -82,23 +82,10 @@ bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessa
|
|||||||
addAutoReleasedObject(new Internal::JavaEditorFactory);
|
addAutoReleasedObject(new Internal::JavaEditorFactory);
|
||||||
ProjectExplorer::KitManager::registerKitInformation(new Internal::AndroidGdbServerKitInformation);
|
ProjectExplorer::KitManager::registerKitInformation(new Internal::AndroidGdbServerKitInformation);
|
||||||
|
|
||||||
// AndroidManifest.xml editor
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":/android/Android.mimetypes.xml"));
|
||||||
Core::MimeGlobPattern androidManifestGlobPattern(QLatin1String("AndroidManifest.xml"), Core::MimeGlobPattern::MaxWeight);
|
|
||||||
Core::MimeType androidManifestMimeType;
|
|
||||||
androidManifestMimeType.setType(QLatin1String(Constants::ANDROID_MANIFEST_MIME_TYPE));
|
|
||||||
androidManifestMimeType.setComment(tr("Android Manifest file"));
|
|
||||||
androidManifestMimeType.setGlobPatterns(QList<Core::MimeGlobPattern>() << androidManifestGlobPattern);
|
|
||||||
androidManifestMimeType.setSubClassesOf(QStringList() << QLatin1String("application/xml"));
|
|
||||||
|
|
||||||
if (!Core::MimeDatabase::addMimeType(androidManifestMimeType)) {
|
|
||||||
*errorMessage = tr("Could not add mime-type for AndroidManifest.xml editor.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
addAutoReleasedObject(new Internal::AndroidManifestEditorFactory);
|
addAutoReleasedObject(new Internal::AndroidManifestEditorFactory);
|
||||||
|
|
||||||
if (!Core::MimeDatabase::addMimeTypes(QLatin1String(":android/Java.mimetypes.xml"), errorMessage))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsLoaded()),
|
connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsLoaded()),
|
||||||
this, SLOT(kitsRestored()));
|
this, SLOT(kitsRestored()));
|
||||||
|
|
||||||
|
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
|
||||||
<mime-type type="text/x-makefile">
|
|
||||||
<sub-class-of type="text/plain"/>
|
|
||||||
<comment>Automake based Makefile</comment>
|
|
||||||
<glob weight="10" pattern="Makefile.am"/>
|
|
||||||
</mime-type>
|
|
||||||
</mime-info>
|
|
@@ -40,7 +40,6 @@
|
|||||||
#include "configurestep.h"
|
#include "configurestep.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <projectexplorer/buildinfo.h>
|
#include <projectexplorer/buildinfo.h>
|
||||||
#include <projectexplorer/buildsteplist.h>
|
#include <projectexplorer/buildsteplist.h>
|
||||||
#include <projectexplorer/kitinformation.h>
|
#include <projectexplorer/kitinformation.h>
|
||||||
@@ -48,6 +47,7 @@
|
|||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
#include <projectexplorer/toolchain.h>
|
#include <projectexplorer/toolchain.h>
|
||||||
#include <qtsupport/customexecutablerunconfiguration.h>
|
#include <qtsupport/customexecutablerunconfiguration.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
@@ -104,8 +104,10 @@ QList<BuildInfo *> AutotoolsBuildConfigurationFactory::availableBuilds(const Tar
|
|||||||
|
|
||||||
int AutotoolsBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
|
int AutotoolsBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
|
||||||
{
|
{
|
||||||
return (k && Core::MimeDatabase::findByFile(QFileInfo(projectPath))
|
Utils::MimeDatabase mdb;
|
||||||
.matchesType(QLatin1String(Constants::MAKEFILE_MIMETYPE))) ? 0 : -1;
|
if (k && mdb.mimeTypeForFile(projectPath).matchesName(QLatin1String(Constants::MAKEFILE_MIMETYPE)))
|
||||||
|
return 0;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<BuildInfo *> AutotoolsBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
QList<BuildInfo *> AutotoolsBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
||||||
|
@@ -29,4 +29,3 @@ SOURCES = autotoolsprojectplugin.cpp\
|
|||||||
configurestep.cpp\
|
configurestep.cpp\
|
||||||
makefileparserthread.cpp\
|
makefileparserthread.cpp\
|
||||||
makefileparser.cpp
|
makefileparser.cpp
|
||||||
RESOURCES += autotoolsproject.qrc
|
|
||||||
|
@@ -39,8 +39,6 @@
|
|||||||
#include "configurestep.h"
|
#include "configurestep.h"
|
||||||
#include "autotoolsprojectconstants.h"
|
#include "autotoolsprojectconstants.h"
|
||||||
|
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
|
||||||
@@ -57,10 +55,8 @@ void AutotoolsProjectPlugin::extensionsInitialized()
|
|||||||
bool AutotoolsProjectPlugin::initialize(const QStringList &arguments,
|
bool AutotoolsProjectPlugin::initialize(const QStringList &arguments,
|
||||||
QString *errorString)
|
QString *errorString)
|
||||||
{
|
{
|
||||||
Q_UNUSED(arguments);
|
Q_UNUSED(arguments)
|
||||||
|
Q_UNUSED(errorString)
|
||||||
if (!Core::MimeDatabase::addMimeTypes(QLatin1String(":autotoolsproject/AutotoolsProjectManager.mimetypes.xml"), errorString))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
addAutoReleasedObject(new AutotoolsBuildConfigurationFactory);
|
addAutoReleasedObject(new AutotoolsBuildConfigurationFactory);
|
||||||
addAutoReleasedObject(new MakeStepFactory);
|
addAutoReleasedObject(new MakeStepFactory);
|
||||||
|
@@ -56,7 +56,6 @@
|
|||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
#include <coreplugin/find/ifindsupport.h>
|
#include <coreplugin/find/ifindsupport.h>
|
||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <utils/reloadpromptutils.h>
|
#include <utils/reloadpromptutils.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
@@ -34,7 +34,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
|
|
||||||
#include <cplusplus/BackwardsScanner.h>
|
#include <cplusplus/BackwardsScanner.h>
|
||||||
#include <cplusplus/ExpressionUnderCursor.h>
|
#include <cplusplus/ExpressionUnderCursor.h>
|
||||||
@@ -58,6 +57,7 @@
|
|||||||
#include <texteditor/completionsettings.h>
|
#include <texteditor/completionsettings.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
@@ -1095,7 +1095,8 @@ bool ClangCompletionAssistProcessor::completeInclude(const QTextCursor &cursor)
|
|||||||
if (!headerPaths.contains(currentFilePath))
|
if (!headerPaths.contains(currentFilePath))
|
||||||
headerPaths.append(currentFilePath);
|
headerPaths.append(currentFilePath);
|
||||||
|
|
||||||
const Core::MimeType mimeType = Core::MimeDatabase::findByType(QLatin1String("text/x-c++hdr"));
|
Utils::MimeDatabase mdb;
|
||||||
|
const Utils::MimeType mimeType = mdb.mimeTypeForName(QLatin1String("text/x-c++hdr"));
|
||||||
const QStringList suffixes = mimeType.suffixes();
|
const QStringList suffixes = mimeType.suffixes();
|
||||||
|
|
||||||
foreach (const ProjectPart::HeaderPath &headerPath, headerPaths) {
|
foreach (const ProjectPart::HeaderPath &headerPath, headerPaths) {
|
||||||
|
@@ -52,13 +52,13 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/infobar.h>
|
#include <coreplugin/infobar.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
#include <coreplugin/progressmanager/progressmanager.h>
|
||||||
#include <coreplugin/locator/commandlocator.h>
|
#include <coreplugin/locator/commandlocator.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/iprojectmanager.h>
|
#include <projectexplorer/iprojectmanager.h>
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/synchronousprocess.h>
|
#include <utils/synchronousprocess.h>
|
||||||
#include <utils/parameteraction.h>
|
#include <utils/parameteraction.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
@@ -441,6 +441,7 @@ static const VcsBaseSubmitEditorParameters submitParameters = {
|
|||||||
|
|
||||||
bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *errorMessage)
|
bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *errorMessage)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(errorMessage)
|
||||||
using namespace Constants;
|
using namespace Constants;
|
||||||
using namespace Core::Constants;
|
using namespace Core::Constants;
|
||||||
|
|
||||||
@@ -453,8 +454,7 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
|
|||||||
connect(ProgressManager::instance(), SIGNAL(allTasksFinished(Core::Id)),
|
connect(ProgressManager::instance(), SIGNAL(allTasksFinished(Core::Id)),
|
||||||
this, SLOT(tasksFinished(Core::Id)));
|
this, SLOT(tasksFinished(Core::Id)));
|
||||||
|
|
||||||
if (!MimeDatabase::addMimeTypes(QLatin1String(":/clearcase/ClearCase.mimetypes.xml"), errorMessage))
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":/clearcase/ClearCase.mimetypes.xml"));
|
||||||
return false;
|
|
||||||
|
|
||||||
m_settings.fromSettings(ICore::settings());
|
m_settings.fromSettings(ICore::settings());
|
||||||
|
|
||||||
|
@@ -37,7 +37,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/documentmanager.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
|
|
||||||
#include <projectexplorer/buildsteplist.h>
|
#include <projectexplorer/buildsteplist.h>
|
||||||
#include <projectexplorer/kit.h>
|
#include <projectexplorer/kit.h>
|
||||||
@@ -45,6 +44,7 @@
|
|||||||
#include <projectexplorer/projectmacroexpander.h>
|
#include <projectexplorer/projectmacroexpander.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
@@ -161,8 +161,10 @@ QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableBui
|
|||||||
|
|
||||||
int CMakeBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const
|
int CMakeBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const
|
||||||
{
|
{
|
||||||
return (k && Core::MimeDatabase::findByFile(QFileInfo(projectPath))
|
Utils::MimeDatabase mdb;
|
||||||
.matchesType(QLatin1String(Constants::CMAKEPROJECTMIMETYPE))) ? 0 : -1;
|
if (k && mdb.mimeTypeForFile(projectPath).matchesName(QLatin1String(Constants::CMAKEPROJECTMIMETYPE)))
|
||||||
|
return 0;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit *k,
|
QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit *k,
|
||||||
|
@@ -41,7 +41,7 @@
|
|||||||
#include "cmakesettingspage.h"
|
#include "cmakesettingspage.h"
|
||||||
|
|
||||||
#include <coreplugin/featureprovider.h>
|
#include <coreplugin/featureprovider.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -59,8 +59,8 @@ CMakeProjectPlugin::~CMakeProjectPlugin()
|
|||||||
|
|
||||||
bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
|
bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
|
||||||
{
|
{
|
||||||
if (!Core::MimeDatabase::addMimeTypes(QLatin1String(":cmakeproject/CMakeProjectManager.mimetypes.xml"), errorMessage))
|
Q_UNUSED(errorMessage)
|
||||||
return false;
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":cmakeproject/CMakeProjectManager.mimetypes.xml"));
|
||||||
|
|
||||||
CMakeSettingsPage *cmp = new CMakeSettingsPage();
|
CMakeSettingsPage *cmp = new CMakeSettingsPage();
|
||||||
addAutoReleasedObject(cmp);
|
addAutoReleasedObject(cmp);
|
||||||
|
@@ -34,14 +34,14 @@
|
|||||||
#include "icontext.h"
|
#include "icontext.h"
|
||||||
#include "icore.h"
|
#include "icore.h"
|
||||||
#include "ifilewizardextension.h"
|
#include "ifilewizardextension.h"
|
||||||
#include "mimedatabase.h"
|
|
||||||
#include "editormanager/editormanager.h"
|
#include "editormanager/editormanager.h"
|
||||||
#include "dialogs/promptoverwritedialog.h"
|
#include "dialogs/promptoverwritedialog.h"
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <utils/filewizardpage.h>
|
#include <utils/filewizardpage.h>
|
||||||
#include <utils/wizard.h>
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
|
#include <utils/wizard.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
@@ -476,7 +476,11 @@ QString BaseFileWizardFactory::buildFileName(const QString &path,
|
|||||||
|
|
||||||
QString BaseFileWizardFactory::preferredSuffix(const QString &mimeType)
|
QString BaseFileWizardFactory::preferredSuffix(const QString &mimeType)
|
||||||
{
|
{
|
||||||
const QString rc = MimeDatabase::preferredSuffixByType(mimeType);
|
QString rc;
|
||||||
|
Utils::MimeDatabase mdb;
|
||||||
|
Utils::MimeType mt = mdb.mimeTypeForName(mimeType);
|
||||||
|
if (mt.isValid())
|
||||||
|
rc = mt.preferredSuffix();
|
||||||
if (rc.isEmpty())
|
if (rc.isEmpty())
|
||||||
qWarning("%s: WARNING: Unable to find a preferred suffix for %s.",
|
qWarning("%s: WARNING: Unable to find a preferred suffix for %s.",
|
||||||
Q_FUNC_INFO, mimeType.toUtf8().constData());
|
Q_FUNC_INFO, mimeType.toUtf8().constData());
|
||||||
|
@@ -63,7 +63,6 @@
|
|||||||
<file>images/category_core.png</file>
|
<file>images/category_core.png</file>
|
||||||
<file>images/category_texteditor.png</file>
|
<file>images/category_texteditor.png</file>
|
||||||
<file>images/category_design.png</file>
|
<file>images/category_design.png</file>
|
||||||
<file>editormanager/BinFiles.mimetypes.xml</file>
|
|
||||||
<file>images/progressbar.png</file>
|
<file>images/progressbar.png</file>
|
||||||
<file>images/progressbar@2x.png</file>
|
<file>images/progressbar@2x.png</file>
|
||||||
<file>images/help.png</file>
|
<file>images/help.png</file>
|
||||||
|
@@ -30,9 +30,8 @@
|
|||||||
|
|
||||||
#include "corejsextensions.h"
|
#include "corejsextensions.h"
|
||||||
|
|
||||||
#include "mimedatabase.h"
|
|
||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -90,7 +89,11 @@ QString UtilsJsExtension::absoluteFilePath(const QString &in) const
|
|||||||
|
|
||||||
QString UtilsJsExtension::preferredSuffix(const QString &mimetype) const
|
QString UtilsJsExtension::preferredSuffix(const QString &mimetype) const
|
||||||
{
|
{
|
||||||
return MimeDatabase::preferredSuffixByType(mimetype);
|
Utils::MimeDatabase mdb;
|
||||||
|
Utils::MimeType mt = mdb.mimeTypeForName(mimetype);
|
||||||
|
if (mt.isValid())
|
||||||
|
return mt.preferredSuffix();
|
||||||
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString UtilsJsExtension::fileName(const QString &path, const QString &extension) const
|
QString UtilsJsExtension::fileName(const QString &path, const QString &extension) const
|
||||||
|
@@ -33,7 +33,6 @@
|
|||||||
#include "editmode.h"
|
#include "editmode.h"
|
||||||
#include "helpmanager.h"
|
#include "helpmanager.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "mimedatabase.h"
|
|
||||||
#include "modemanager.h"
|
#include "modemanager.h"
|
||||||
#include "infobar.h"
|
#include "infobar.h"
|
||||||
#include "iwizardfactory.h"
|
#include "iwizardfactory.h"
|
||||||
@@ -212,7 +211,8 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
|||||||
|
|
||||||
void CorePlugin::extensionsInitialized()
|
void CorePlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
MimeDatabase::syncUserModifiedMimeTypes();
|
// TODO
|
||||||
|
// MimeDatabase::syncUserModifiedMimeTypes();
|
||||||
if (m_designMode->designModeIsRequired())
|
if (m_designMode->designModeIsRequired())
|
||||||
addObject(m_designMode);
|
addObject(m_designMode);
|
||||||
m_findPlugin->extensionsInitialized();
|
m_findPlugin->extensionsInitialized();
|
||||||
|
@@ -72,7 +72,6 @@ SOURCES += corejsextensions.cpp \
|
|||||||
rightpane.cpp \
|
rightpane.cpp \
|
||||||
sidebar.cpp \
|
sidebar.cpp \
|
||||||
fileiconprovider.cpp \
|
fileiconprovider.cpp \
|
||||||
mimedatabase.cpp \
|
|
||||||
icore.cpp \
|
icore.cpp \
|
||||||
infobar.cpp \
|
infobar.cpp \
|
||||||
editormanager/ieditor.cpp \
|
editormanager/ieditor.cpp \
|
||||||
@@ -196,7 +195,6 @@ HEADERS += corejsextensions.h \
|
|||||||
rightpane.h \
|
rightpane.h \
|
||||||
sidebar.h \
|
sidebar.h \
|
||||||
fileiconprovider.h \
|
fileiconprovider.h \
|
||||||
mimedatabase.h \
|
|
||||||
settingsdatabase.h \
|
settingsdatabase.h \
|
||||||
editormanager/systemeditor.h \
|
editormanager/systemeditor.h \
|
||||||
designmode.h \
|
designmode.h \
|
||||||
|
@@ -32,7 +32,6 @@
|
|||||||
|
|
||||||
#include "icore.h"
|
#include "icore.h"
|
||||||
#include "idocument.h"
|
#include "idocument.h"
|
||||||
#include "mimedatabase.h"
|
|
||||||
#include "coreconstants.h"
|
#include "coreconstants.h"
|
||||||
|
|
||||||
#include <coreplugin/dialogs/readonlyfilesdialog.h>
|
#include <coreplugin/dialogs/readonlyfilesdialog.h>
|
||||||
@@ -46,6 +45,7 @@
|
|||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/pathchooser.h>
|
#include <utils/pathchooser.h>
|
||||||
#include <utils/reloadpromptutils.h>
|
#include <utils/reloadpromptutils.h>
|
||||||
@@ -740,7 +740,9 @@ QString DocumentManager::getSaveAsFileName(const IDocument *document, const QStr
|
|||||||
|
|
||||||
QString filterString;
|
QString filterString;
|
||||||
if (filter.isEmpty()) {
|
if (filter.isEmpty()) {
|
||||||
if (const MimeType &mt = MimeDatabase::findByFile(fi))
|
Utils::MimeDatabase mdb;
|
||||||
|
const Utils::MimeType &mt = mdb.mimeTypeForFile(fi);
|
||||||
|
if (mt.isValid())
|
||||||
filterString = mt.filterString();
|
filterString = mt.filterString();
|
||||||
selectedFilter = &filterString;
|
selectedFilter = &filterString;
|
||||||
} else {
|
} else {
|
||||||
@@ -1391,7 +1393,9 @@ void DocumentManager::populateOpenWithMenu(QMenu *menu, const QString &fileName)
|
|||||||
|
|
||||||
bool anyMatches = false;
|
bool anyMatches = false;
|
||||||
|
|
||||||
if (const MimeType mt = MimeDatabase::findByFile(QFileInfo(fileName))) {
|
Utils::MimeDatabase mdb;
|
||||||
|
const Utils::MimeType mt = mdb.mimeTypeForFile(fileName);
|
||||||
|
if (mt.isValid()) {
|
||||||
const EditorFactoryList factories = EditorManager::editorFactories(mt, false);
|
const EditorFactoryList factories = EditorManager::editorFactories(mt, false);
|
||||||
const ExternalEditorList externalEditors = EditorManager::externalEditors(mt, false);
|
const ExternalEditorList externalEditors = EditorManager::externalEditors(mt, false);
|
||||||
anyMatches = !factories.empty() || !externalEditors.empty();
|
anyMatches = !factories.empty() || !externalEditors.empty();
|
||||||
|
@@ -1,18 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
|
||||||
<mime-type type="application/octet-stream">
|
|
||||||
<comment>unknown</comment>
|
|
||||||
<glob pattern="*.a"/>
|
|
||||||
<glob pattern="*.dll"/>
|
|
||||||
<glob pattern="*.exe"/>
|
|
||||||
<glob pattern="*.lib"/>
|
|
||||||
<glob pattern="*.o"/>
|
|
||||||
<glob pattern="*.obj"/>
|
|
||||||
<glob pattern="*.out"/>
|
|
||||||
<glob pattern="*.so"/>
|
|
||||||
<!-- Magic for ELF binaries -->
|
|
||||||
<magic priority="99">
|
|
||||||
<match type="byte" offset="0" value="\0x7f\0x45\0x4c\0x46"/>
|
|
||||||
</magic>
|
|
||||||
</mime-type>
|
|
||||||
</mime-info>
|
|
@@ -54,7 +54,6 @@
|
|||||||
#include <coreplugin/imode.h>
|
#include <coreplugin/imode.h>
|
||||||
#include <coreplugin/infobar.h>
|
#include <coreplugin/infobar.h>
|
||||||
#include <coreplugin/iversioncontrol.h>
|
#include <coreplugin/iversioncontrol.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/modemanager.h>
|
#include <coreplugin/modemanager.h>
|
||||||
#include <coreplugin/outputpane.h>
|
#include <coreplugin/outputpane.h>
|
||||||
#include <coreplugin/outputpanemanager.h>
|
#include <coreplugin/outputpanemanager.h>
|
||||||
@@ -68,6 +67,7 @@
|
|||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/macroexpander.h>
|
#include <utils/macroexpander.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
@@ -774,10 +774,11 @@ void EditorManagerPrivate::showPopupOrSelectDocument()
|
|||||||
Id EditorManagerPrivate::getOpenWithEditorId(const QString &fileName, bool *isExternalEditor)
|
Id EditorManagerPrivate::getOpenWithEditorId(const QString &fileName, bool *isExternalEditor)
|
||||||
{
|
{
|
||||||
// Collect editors that can open the file
|
// Collect editors that can open the file
|
||||||
MimeType mt = MimeDatabase::findByFile(fileName);
|
Utils::MimeDatabase mdb;
|
||||||
|
Utils::MimeType mt = mdb.mimeTypeForFile(fileName);
|
||||||
//Unable to determine mime type of fileName. Falling back to text/plain",
|
//Unable to determine mime type of fileName. Falling back to text/plain",
|
||||||
if (!mt)
|
if (!mt.isValid())
|
||||||
mt = MimeDatabase::findByType(QLatin1String("text/plain"));
|
mt = mdb.mimeTypeForName(QLatin1String("text/plain"));
|
||||||
QList<Id> allEditorIds;
|
QList<Id> allEditorIds;
|
||||||
QStringList allEditorDisplayNames;
|
QStringList allEditorDisplayNames;
|
||||||
QList<Id> externalEditorIds;
|
QList<Id> externalEditorIds;
|
||||||
@@ -889,16 +890,17 @@ IEditor *EditorManagerPrivate::createEditor(Id editorId, const QString &fileName
|
|||||||
if (!editorId.isValid()) {
|
if (!editorId.isValid()) {
|
||||||
const QFileInfo fileInfo(fileName);
|
const QFileInfo fileInfo(fileName);
|
||||||
// Find by mime type
|
// Find by mime type
|
||||||
MimeType mimeType = MimeDatabase::findByFile(fileInfo);
|
Utils::MimeDatabase mdb;
|
||||||
if (!mimeType) {
|
Utils::MimeType mimeType = mdb.mimeTypeForFile(fileInfo);
|
||||||
|
if (!mimeType.isValid()) {
|
||||||
qWarning("%s unable to determine mime type of %s/%s. Falling back to text/plain",
|
qWarning("%s unable to determine mime type of %s/%s. Falling back to text/plain",
|
||||||
Q_FUNC_INFO, fileName.toUtf8().constData(), editorId.name().constData());
|
Q_FUNC_INFO, fileName.toUtf8().constData(), editorId.name().constData());
|
||||||
mimeType = MimeDatabase::findByType(QLatin1String("text/plain"));
|
mimeType = mdb.mimeTypeForName(QLatin1String("text/plain"));
|
||||||
}
|
}
|
||||||
// open text files > 48 MB in binary editor
|
// open text files > 48 MB in binary editor
|
||||||
if (fileInfo.size() > EditorManager::maxTextFileSize()
|
if (fileInfo.size() > EditorManager::maxTextFileSize()
|
||||||
&& mimeType.type().startsWith(QLatin1String("text"))) {
|
&& mimeType.name().startsWith(QLatin1String("text"))) {
|
||||||
mimeType = MimeDatabase::findByType(QLatin1String("application/octet-stream"));
|
mimeType = mdb.mimeTypeForName(QLatin1String("application/octet-stream"));
|
||||||
}
|
}
|
||||||
factories = EditorManager::editorFactories(mimeType, true);
|
factories = EditorManager::editorFactories(mimeType, true);
|
||||||
} else {
|
} else {
|
||||||
@@ -1692,11 +1694,12 @@ bool EditorManagerPrivate::saveDocumentAs(IDocument *document)
|
|||||||
if (!document)
|
if (!document)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const QString filter = MimeDatabase::allFiltersString();
|
Utils::MimeDatabase mdb;
|
||||||
|
const QString filter = Utils::MimeDatabase::allFiltersString();
|
||||||
QString selectedFilter =
|
QString selectedFilter =
|
||||||
MimeDatabase::findByFile(document->filePath().toFileInfo()).filterString();
|
mdb.mimeTypeForFile(document->filePath().toFileInfo()).filterString();
|
||||||
if (selectedFilter.isEmpty())
|
if (selectedFilter.isEmpty())
|
||||||
selectedFilter = MimeDatabase::findByType(document->mimeType()).filterString();
|
selectedFilter = mdb.mimeTypeForName(document->mimeType()).filterString();
|
||||||
const QString &absoluteFilePath =
|
const QString &absoluteFilePath =
|
||||||
DocumentManager::getSaveAsFileName(document, filter, &selectedFilter);
|
DocumentManager::getSaveAsFileName(document, filter, &selectedFilter);
|
||||||
|
|
||||||
@@ -2192,54 +2195,58 @@ IEditor *EditorManager::activateEditorForDocument(IDocument *document, OpenEdito
|
|||||||
* or IExternalEditor), find the one best matching the mimetype passed in.
|
* or IExternalEditor), find the one best matching the mimetype passed in.
|
||||||
* Recurse over the parent classes of the mimetype to find them. */
|
* Recurse over the parent classes of the mimetype to find them. */
|
||||||
template <class EditorFactoryLike>
|
template <class EditorFactoryLike>
|
||||||
static void mimeTypeFactoryRecursion(const MimeType &mimeType,
|
static void mimeTypeFactoryRecursion(const Utils::MimeType &mimeType,
|
||||||
const QList<EditorFactoryLike*> &allFactories,
|
const QList<EditorFactoryLike*> &allFactories,
|
||||||
bool firstMatchOnly,
|
bool firstMatchOnly,
|
||||||
QList<EditorFactoryLike*> *list)
|
QList<EditorFactoryLike*> *list)
|
||||||
{
|
{
|
||||||
typedef typename QList<EditorFactoryLike*>::const_iterator EditorFactoryLikeListConstIterator;
|
typedef typename QList<EditorFactoryLike*>::const_iterator EditorFactoryLikeListConstIterator;
|
||||||
// Loop factories to find type
|
// Loop factories to find type
|
||||||
const QString type = mimeType.type();
|
|
||||||
const EditorFactoryLikeListConstIterator fcend = allFactories.constEnd();
|
const EditorFactoryLikeListConstIterator fcend = allFactories.constEnd();
|
||||||
for (EditorFactoryLikeListConstIterator fit = allFactories.constBegin(); fit != fcend; ++fit) {
|
for (EditorFactoryLikeListConstIterator fit = allFactories.constBegin(); fit != fcend; ++fit) {
|
||||||
// Exclude duplicates when recursing over xml or C++ -> C -> text.
|
// Exclude duplicates when recursing over xml or C++ -> C -> text.
|
||||||
EditorFactoryLike *factory = *fit;
|
EditorFactoryLike *factory = *fit;
|
||||||
if (!list->contains(factory) && factory->mimeTypes().contains(type)) {
|
if (!list->contains(factory)) {
|
||||||
list->push_back(*fit);
|
foreach (const QString &mt, factory->mimeTypes()) {
|
||||||
if (firstMatchOnly)
|
if (mimeType.matchesName(mt)) {
|
||||||
return;
|
list->push_back(*fit);
|
||||||
|
if (firstMatchOnly)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Any parent mime type classes? -> recurse
|
// Any parent mime type classes? -> recurse
|
||||||
QStringList parentTypes = mimeType.subClassesOf();
|
QStringList parentNames = mimeType.parentMimeTypes();
|
||||||
if (parentTypes.empty())
|
if (parentNames.empty())
|
||||||
return;
|
return;
|
||||||
const QStringList::const_iterator pcend = parentTypes .constEnd();
|
Utils::MimeDatabase mdb;
|
||||||
for (QStringList::const_iterator pit = parentTypes .constBegin(); pit != pcend; ++pit) {
|
foreach (const QString &parentName, parentNames) {
|
||||||
if (const MimeType parent = MimeDatabase::findByType(*pit))
|
const Utils::MimeType parent = mdb.mimeTypeForName(parentName);
|
||||||
|
if (parent.isValid())
|
||||||
mimeTypeFactoryRecursion(parent, allFactories, firstMatchOnly, list);
|
mimeTypeFactoryRecursion(parent, allFactories, firstMatchOnly, list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorManager::EditorFactoryList
|
EditorManager::EditorFactoryList
|
||||||
EditorManager::editorFactories(const MimeType &mimeType, bool bestMatchOnly)
|
EditorManager::editorFactories(const Utils::MimeType &mimeType, bool bestMatchOnly)
|
||||||
{
|
{
|
||||||
EditorFactoryList rc;
|
EditorFactoryList rc;
|
||||||
const EditorFactoryList allFactories = ExtensionSystem::PluginManager::getObjects<IEditorFactory>();
|
const EditorFactoryList allFactories = ExtensionSystem::PluginManager::getObjects<IEditorFactory>();
|
||||||
mimeTypeFactoryRecursion(mimeType, allFactories, bestMatchOnly, &rc);
|
mimeTypeFactoryRecursion(mimeType, allFactories, bestMatchOnly, &rc);
|
||||||
if (debugEditorManager)
|
if (debugEditorManager)
|
||||||
qDebug() << Q_FUNC_INFO << mimeType.type() << " returns " << rc;
|
qDebug() << Q_FUNC_INFO << mimeType.name() << " returns " << rc;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorManager::ExternalEditorList
|
EditorManager::ExternalEditorList
|
||||||
EditorManager::externalEditors(const MimeType &mimeType, bool bestMatchOnly)
|
EditorManager::externalEditors(const Utils::MimeType &mimeType, bool bestMatchOnly)
|
||||||
{
|
{
|
||||||
ExternalEditorList rc;
|
ExternalEditorList rc;
|
||||||
const ExternalEditorList allEditors = ExtensionSystem::PluginManager::getObjects<IExternalEditor>();
|
const ExternalEditorList allEditors = ExtensionSystem::PluginManager::getObjects<IExternalEditor>();
|
||||||
mimeTypeFactoryRecursion(mimeType, allEditors, bestMatchOnly, &rc);
|
mimeTypeFactoryRecursion(mimeType, allEditors, bestMatchOnly, &rc);
|
||||||
if (debugEditorManager)
|
if (debugEditorManager)
|
||||||
qDebug() << Q_FUNC_INFO << mimeType.type() << " returns " << rc;
|
qDebug() << Q_FUNC_INFO << mimeType.name() << " returns " << rc;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2308,7 +2315,7 @@ bool EditorManager::openExternalEditor(const QString &fileName, Id editorId)
|
|||||||
QStringList EditorManager::getOpenFileNames()
|
QStringList EditorManager::getOpenFileNames()
|
||||||
{
|
{
|
||||||
QString selectedFilter;
|
QString selectedFilter;
|
||||||
const QString &fileFilters = MimeDatabase::allFiltersString(&selectedFilter);
|
const QString &fileFilters = Utils::MimeDatabase::allFiltersString(&selectedFilter);
|
||||||
return DocumentManager::getOpenFileNames(fileFilters, QString(), &selectedFilter);
|
return DocumentManager::getOpenFileNames(fileFilters, QString(), &selectedFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/id.h>
|
#include <coreplugin/id.h>
|
||||||
#include <coreplugin/idocument.h> // enumerations
|
#include <coreplugin/idocument.h> // enumerations
|
||||||
|
#include <utils/mimetypes/mimetype.h>
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
@@ -53,7 +54,6 @@ class IContext;
|
|||||||
class IEditor;
|
class IEditor;
|
||||||
class IEditorFactory;
|
class IEditorFactory;
|
||||||
class IExternalEditor;
|
class IExternalEditor;
|
||||||
class MimeType;
|
|
||||||
class IDocument;
|
class IDocument;
|
||||||
class IMode;
|
class IMode;
|
||||||
class IVersionControl;
|
class IVersionControl;
|
||||||
@@ -157,8 +157,8 @@ public:
|
|||||||
QObject *object = 0, const char *member = 0);
|
QObject *object = 0, const char *member = 0);
|
||||||
static void hideEditorStatusBar(const QString &id);
|
static void hideEditorStatusBar(const QString &id);
|
||||||
|
|
||||||
static EditorFactoryList editorFactories(const MimeType &mimeType, bool bestMatchOnly = true);
|
static EditorFactoryList editorFactories(const Utils::MimeType &mimeType, bool bestMatchOnly = true);
|
||||||
static ExternalEditorList externalEditors(const MimeType &mimeType, bool bestMatchOnly = true);
|
static ExternalEditorList externalEditors(const Utils::MimeType &mimeType, bool bestMatchOnly = true);
|
||||||
|
|
||||||
static bool isAutoSaveFile(const QString &fileName);
|
static bool isAutoSaveFile(const QString &fileName);
|
||||||
|
|
||||||
|
@@ -29,9 +29,9 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "fileiconprovider.h"
|
#include "fileiconprovider.h"
|
||||||
#include "mimedatabase.h"
|
|
||||||
|
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@@ -91,7 +91,7 @@ public:
|
|||||||
m_cache.insert(suffix, fileIconPixmap);
|
m_cache.insert(suffix, fileIconPixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void registerIconOverlayForMimeType(const QIcon &icon, const MimeType &mimeType)
|
void registerIconOverlayForMimeType(const QIcon &icon, const Utils::MimeType &mimeType)
|
||||||
{
|
{
|
||||||
foreach (const QString &suffix, mimeType.suffixes())
|
foreach (const QString &suffix, mimeType.suffixes())
|
||||||
registerIconOverlayForSuffix(icon, suffix);
|
registerIconOverlayForSuffix(icon, suffix);
|
||||||
@@ -181,7 +181,9 @@ void registerIconOverlayForSuffix(const char *path, const char *suffix)
|
|||||||
*/
|
*/
|
||||||
void registerIconOverlayForMimeType(const QIcon &icon, const char *mimeType)
|
void registerIconOverlayForMimeType(const QIcon &icon, const char *mimeType)
|
||||||
{
|
{
|
||||||
instance()->registerIconOverlayForMimeType(icon, MimeDatabase::findByType(QString::fromLatin1(mimeType)));
|
Utils::MimeDatabase mdb;
|
||||||
|
instance()->registerIconOverlayForMimeType(icon,
|
||||||
|
mdb.mimeTypeForName(QString::fromLatin1(mimeType)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -189,7 +191,9 @@ void registerIconOverlayForMimeType(const QIcon &icon, const char *mimeType)
|
|||||||
*/
|
*/
|
||||||
void registerIconOverlayForMimeType(const char *path, const char *mimeType)
|
void registerIconOverlayForMimeType(const char *path, const char *mimeType)
|
||||||
{
|
{
|
||||||
instance()->registerIconOverlayForMimeType(QIcon(QLatin1String(path)), MimeDatabase::findByType(QString::fromLatin1(mimeType)));
|
Utils::MimeDatabase mdb;
|
||||||
|
instance()->registerIconOverlayForMimeType(QIcon(QLatin1String(path)),
|
||||||
|
mdb.mimeTypeForName(QString::fromLatin1(mimeType)));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace FileIconProvider
|
} // namespace FileIconProvider
|
||||||
|
@@ -38,8 +38,6 @@
|
|||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
class MimeType;
|
|
||||||
|
|
||||||
namespace FileIconProvider {
|
namespace FileIconProvider {
|
||||||
|
|
||||||
// Access to the single instance
|
// Access to the single instance
|
||||||
|
@@ -100,12 +100,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn MimeDatabase *ICore::mimeDatabase()
|
|
||||||
|
|
||||||
Uses the MIME database to manage MIME types.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QSettings *ICore::settings(QSettings::Scope scope = QSettings::UserScope)
|
\fn QSettings *ICore::settings(QSettings::Scope scope = QSettings::UserScope)
|
||||||
|
|
||||||
|
@@ -40,7 +40,6 @@
|
|||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
class MimeType;
|
|
||||||
class InfoBar;
|
class InfoBar;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
@@ -42,7 +42,6 @@
|
|||||||
#include "idocumentfactory.h"
|
#include "idocumentfactory.h"
|
||||||
#include "messagemanager.h"
|
#include "messagemanager.h"
|
||||||
#include "modemanager.h"
|
#include "modemanager.h"
|
||||||
#include "mimedatabase.h"
|
|
||||||
#include "outputpanemanager.h"
|
#include "outputpanemanager.h"
|
||||||
#include "plugindialog.h"
|
#include "plugindialog.h"
|
||||||
#include "vcsmanager.h"
|
#include "vcsmanager.h"
|
||||||
@@ -77,6 +76,7 @@
|
|||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/historycompleter.h>
|
#include <utils/historycompleter.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/stylehelper.h>
|
#include <utils/stylehelper.h>
|
||||||
#include <utils/theme/theme.h>
|
#include <utils/theme/theme.h>
|
||||||
@@ -124,7 +124,6 @@ MainWindow::MainWindow() :
|
|||||||
m_vcsManager(new VcsManager),
|
m_vcsManager(new VcsManager),
|
||||||
m_statusBarManager(0),
|
m_statusBarManager(0),
|
||||||
m_modeManager(0),
|
m_modeManager(0),
|
||||||
m_mimeDatabase(new MimeDatabase),
|
|
||||||
m_helpManager(new HelpManager),
|
m_helpManager(new HelpManager),
|
||||||
m_modeStack(new FancyTabWidget(this)),
|
m_modeStack(new FancyTabWidget(this)),
|
||||||
m_navigationWidget(0),
|
m_navigationWidget(0),
|
||||||
@@ -298,8 +297,6 @@ MainWindow::~MainWindow()
|
|||||||
|
|
||||||
delete m_modeManager;
|
delete m_modeManager;
|
||||||
m_modeManager = 0;
|
m_modeManager = 0;
|
||||||
delete m_mimeDatabase;
|
|
||||||
m_mimeDatabase = 0;
|
|
||||||
|
|
||||||
delete m_helpManager;
|
delete m_helpManager;
|
||||||
m_helpManager = 0;
|
m_helpManager = 0;
|
||||||
@@ -311,9 +308,6 @@ bool MainWindow::init(QString *errorMessage)
|
|||||||
{
|
{
|
||||||
Q_UNUSED(errorMessage)
|
Q_UNUSED(errorMessage)
|
||||||
|
|
||||||
if (!MimeDatabase::addMimeTypes(QLatin1String(":/core/editormanager/BinFiles.mimetypes.xml"), errorMessage))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
PluginManager::addObject(m_coreImpl);
|
PluginManager::addObject(m_coreImpl);
|
||||||
m_statusBarManager->init();
|
m_statusBarManager->init();
|
||||||
m_modeManager->init();
|
m_modeManager->init();
|
||||||
@@ -751,10 +745,12 @@ void MainWindow::openFile()
|
|||||||
static IDocumentFactory *findDocumentFactory(const QList<IDocumentFactory*> &fileFactories,
|
static IDocumentFactory *findDocumentFactory(const QList<IDocumentFactory*> &fileFactories,
|
||||||
const QFileInfo &fi)
|
const QFileInfo &fi)
|
||||||
{
|
{
|
||||||
if (const MimeType mt = MimeDatabase::findByFile(fi)) {
|
Utils::MimeDatabase mdb;
|
||||||
const QString type = mt.type();
|
const Utils::MimeType mt = mdb.mimeTypeForFile(fi);
|
||||||
|
if (mt.isValid()) {
|
||||||
|
const QString typeName = mt.name();
|
||||||
foreach (IDocumentFactory *factory, fileFactories) {
|
foreach (IDocumentFactory *factory, fileFactories) {
|
||||||
if (factory->mimeTypes().contains(type))
|
if (factory->mimeTypes().contains(typeName))
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -58,7 +58,6 @@ class IDocument;
|
|||||||
class IWizardFactory;
|
class IWizardFactory;
|
||||||
class JsExpander;
|
class JsExpander;
|
||||||
class MessageManager;
|
class MessageManager;
|
||||||
class MimeDatabase;
|
|
||||||
class ModeManager;
|
class ModeManager;
|
||||||
class ProgressManager;
|
class ProgressManager;
|
||||||
class NavigationWidget;
|
class NavigationWidget;
|
||||||
@@ -172,7 +171,6 @@ private:
|
|||||||
VcsManager *m_vcsManager;
|
VcsManager *m_vcsManager;
|
||||||
StatusBarManager *m_statusBarManager;
|
StatusBarManager *m_statusBarManager;
|
||||||
ModeManager *m_modeManager;
|
ModeManager *m_modeManager;
|
||||||
MimeDatabase *m_mimeDatabase;
|
|
||||||
HelpManager *m_helpManager;
|
HelpManager *m_helpManager;
|
||||||
FancyTabWidget *m_modeStack;
|
FancyTabWidget *m_modeStack;
|
||||||
NavigationWidget *m_navigationWidget;
|
NavigationWidget *m_navigationWidget;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,318 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2015 The Qt Company Ltd.
|
|
||||||
** Contact: http://www.qt.io/licensing
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms and
|
|
||||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
|
||||||
** use the contact form at http://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 or version 3 as published by the Free
|
|
||||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
||||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
||||||
** following information to ensure the GNU Lesser General Public License
|
|
||||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
||||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
||||||
** rights. These rights are described in The Qt Company LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef MIMEDATABASE_H
|
|
||||||
#define MIMEDATABASE_H
|
|
||||||
|
|
||||||
#include <coreplugin/core_global.h>
|
|
||||||
#include <QStringList>
|
|
||||||
#include <QSharedDataPointer>
|
|
||||||
#include <QSharedPointer>
|
|
||||||
#include <QByteArray>
|
|
||||||
#include <QMutex>
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QPair>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QIODevice;
|
|
||||||
class QDebug;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
|
|
||||||
class MimeTypeData;
|
|
||||||
class MimeDatabasePrivate;
|
|
||||||
|
|
||||||
namespace Internal {
|
|
||||||
class BaseMimeTypeParser;
|
|
||||||
class FileMatchContext;
|
|
||||||
class MainWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
class CORE_EXPORT IMagicMatcher
|
|
||||||
{
|
|
||||||
Q_DISABLE_COPY(IMagicMatcher)
|
|
||||||
|
|
||||||
protected:
|
|
||||||
IMagicMatcher() {}
|
|
||||||
|
|
||||||
public:
|
|
||||||
typedef QSharedPointer<IMagicMatcher> IMagicMatcherSharedPointer;
|
|
||||||
typedef QList<IMagicMatcherSharedPointer> IMagicMatcherList;
|
|
||||||
|
|
||||||
// Check for a match on contents of a file
|
|
||||||
virtual bool matches(const QByteArray &data) const = 0;
|
|
||||||
// Return a priority value from 1..100
|
|
||||||
virtual int priority() const = 0;
|
|
||||||
virtual ~IMagicMatcher() {}
|
|
||||||
};
|
|
||||||
|
|
||||||
class CORE_EXPORT MagicRule
|
|
||||||
{
|
|
||||||
Q_DISABLE_COPY(MagicRule)
|
|
||||||
public:
|
|
||||||
MagicRule(int startPos, int endPos);
|
|
||||||
virtual ~MagicRule();
|
|
||||||
|
|
||||||
virtual QString matchType() const = 0;
|
|
||||||
virtual QString matchValue() const = 0;
|
|
||||||
virtual bool matches(const QByteArray &data) const = 0;
|
|
||||||
|
|
||||||
int startPos() const;
|
|
||||||
int endPos() const;
|
|
||||||
|
|
||||||
static QString toOffset(const QPair<int, int> &startEnd);
|
|
||||||
static QPair<int, int> fromOffset(const QString &offset);
|
|
||||||
|
|
||||||
private:
|
|
||||||
static const QChar kColon;
|
|
||||||
|
|
||||||
const int m_startPos;
|
|
||||||
const int m_endPos;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CORE_EXPORT MagicStringRule : public MagicRule
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
MagicStringRule(const QString &s, int startPos, int endPos);
|
|
||||||
virtual ~MagicStringRule();
|
|
||||||
|
|
||||||
virtual QString matchType() const;
|
|
||||||
virtual QString matchValue() const;
|
|
||||||
virtual bool matches(const QByteArray &data) const;
|
|
||||||
|
|
||||||
static const QString kMatchType;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const QByteArray m_pattern;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CORE_EXPORT MagicByteRule : public MagicRule
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
MagicByteRule(const QString &s, int startPos, int endPos);
|
|
||||||
virtual ~MagicByteRule();
|
|
||||||
|
|
||||||
virtual QString matchType() const;
|
|
||||||
virtual QString matchValue() const;
|
|
||||||
virtual bool matches(const QByteArray &data) const;
|
|
||||||
|
|
||||||
static bool validateByteSequence(const QString &sequence, QList<int> *bytes = 0);
|
|
||||||
|
|
||||||
static const QString kMatchType;
|
|
||||||
|
|
||||||
private:
|
|
||||||
int m_bytesSize;
|
|
||||||
QList<int> m_bytes;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CORE_EXPORT MagicRuleMatcher : public IMagicMatcher
|
|
||||||
{
|
|
||||||
Q_DISABLE_COPY(MagicRuleMatcher)
|
|
||||||
public:
|
|
||||||
typedef QSharedPointer<MagicRule> MagicRuleSharedPointer;
|
|
||||||
typedef QList<MagicRuleSharedPointer> MagicRuleList;
|
|
||||||
|
|
||||||
MagicRuleMatcher();
|
|
||||||
|
|
||||||
void add(const MagicRuleSharedPointer &rule);
|
|
||||||
void add(const MagicRuleList &ruleList);
|
|
||||||
MagicRuleList magicRules() const;
|
|
||||||
|
|
||||||
virtual bool matches(const QByteArray &data) const;
|
|
||||||
|
|
||||||
virtual int priority() const;
|
|
||||||
void setPriority(int p);
|
|
||||||
|
|
||||||
// Create a list of MagicRuleMatchers from a hash of rules indexed by priorities.
|
|
||||||
static IMagicMatcher::IMagicMatcherList createMatchers(const QHash<int, MagicRuleList> &);
|
|
||||||
|
|
||||||
private:
|
|
||||||
MagicRuleList m_list;
|
|
||||||
int m_priority;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CORE_EXPORT MimeGlobPattern
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static const unsigned MaxWeight = 100;
|
|
||||||
static const unsigned MinWeight = 1;
|
|
||||||
|
|
||||||
explicit MimeGlobPattern(const QString &pattern, unsigned weight = MaxWeight);
|
|
||||||
~MimeGlobPattern();
|
|
||||||
|
|
||||||
bool matches(const QString &fileName) const;
|
|
||||||
unsigned weight() const { return m_weight; }
|
|
||||||
QString pattern() const { return m_pattern; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
enum { Suffix, Exact, Glob } m_type;
|
|
||||||
QString m_pattern;
|
|
||||||
QRegExp m_regexp; // Will be used in \c Glob case only.
|
|
||||||
unsigned m_weight;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CORE_EXPORT MimeType
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef IMagicMatcher::IMagicMatcherList IMagicMatcherList;
|
|
||||||
typedef IMagicMatcher::IMagicMatcherSharedPointer IMagicMatcherSharedPointer;
|
|
||||||
|
|
||||||
MimeType();
|
|
||||||
MimeType(const MimeType&);
|
|
||||||
MimeType &operator=(const MimeType&);
|
|
||||||
~MimeType();
|
|
||||||
|
|
||||||
void clear();
|
|
||||||
bool isNull() const;
|
|
||||||
operator bool() const;
|
|
||||||
|
|
||||||
bool isTopLevel() const;
|
|
||||||
|
|
||||||
QString type() const;
|
|
||||||
void setType(const QString &type);
|
|
||||||
|
|
||||||
QStringList aliases() const;
|
|
||||||
void setAliases(const QStringList &);
|
|
||||||
|
|
||||||
QString comment() const;
|
|
||||||
void setComment(const QString &comment);
|
|
||||||
|
|
||||||
QString localeComment(const QString &locale = QString() /* en, de...*/) const;
|
|
||||||
void setLocaleComment(const QString &locale, const QString &comment);
|
|
||||||
|
|
||||||
QList<MimeGlobPattern> globPatterns() const;
|
|
||||||
void setGlobPatterns(const QList<MimeGlobPattern> &);
|
|
||||||
|
|
||||||
QStringList subClassesOf() const;
|
|
||||||
void setSubClassesOf(const QStringList &);
|
|
||||||
|
|
||||||
// Extension over standard mime data
|
|
||||||
QStringList suffixes() const;
|
|
||||||
QString preferredSuffix() const;
|
|
||||||
bool setPreferredSuffix(const QString&);
|
|
||||||
|
|
||||||
// Check for type or one of the aliases
|
|
||||||
bool matchesType(const QString &type) const;
|
|
||||||
|
|
||||||
// Check glob patterns weights and magic priorities so the highest
|
|
||||||
// value is returned. A 0 (zero) indicates no match.
|
|
||||||
unsigned matchesFile(const QFileInfo &file) const;
|
|
||||||
|
|
||||||
// Return a filter string usable for a file dialog
|
|
||||||
QString filterString() const;
|
|
||||||
|
|
||||||
void addMagicMatcher(const IMagicMatcherSharedPointer &matcher);
|
|
||||||
|
|
||||||
const IMagicMatcherList &magicMatchers() const;
|
|
||||||
void setMagicMatchers(const IMagicMatcherList &matchers);
|
|
||||||
|
|
||||||
// Convenience for rule-base matchers.
|
|
||||||
IMagicMatcherList magicRuleMatchers() const;
|
|
||||||
void setMagicRuleMatchers(const IMagicMatcherList &matchers);
|
|
||||||
|
|
||||||
friend QDebug operator<<(QDebug d, const MimeType &mt);
|
|
||||||
|
|
||||||
static QString formatFilterString(const QString &description,
|
|
||||||
const QList<MimeGlobPattern> &globs);
|
|
||||||
|
|
||||||
private:
|
|
||||||
explicit MimeType(const MimeTypeData &d);
|
|
||||||
unsigned matchesFileBySuffix(Internal::FileMatchContext &c) const;
|
|
||||||
unsigned matchesFileByContent(Internal::FileMatchContext &c) const;
|
|
||||||
unsigned matchesData(const QByteArray &data) const;
|
|
||||||
|
|
||||||
friend class Internal::BaseMimeTypeParser;
|
|
||||||
friend class MimeDatabasePrivate;
|
|
||||||
QSharedDataPointer<MimeTypeData> m_d;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CORE_EXPORT MimeDatabase
|
|
||||||
{
|
|
||||||
Q_DISABLE_COPY(MimeDatabase)
|
|
||||||
public:
|
|
||||||
typedef IMagicMatcher::IMagicMatcherList IMagicMatcherList;
|
|
||||||
typedef IMagicMatcher::IMagicMatcherSharedPointer IMagicMatcherSharedPointer;
|
|
||||||
|
|
||||||
static bool addMimeTypes(const QString &fileName, QString *errorMessage);
|
|
||||||
static bool addMimeTypes(QIODevice *device, QString *errorMessage);
|
|
||||||
static bool addMimeType(const MimeType &mt);
|
|
||||||
|
|
||||||
// Returns a mime type or Null one if none found
|
|
||||||
static MimeType findByType(const QString &type);
|
|
||||||
|
|
||||||
// Returns a mime type or Null one if none found
|
|
||||||
static MimeType findByFile(const QFileInfo &f);
|
|
||||||
|
|
||||||
// Returns a mime type or Null one if none found
|
|
||||||
static MimeType findByData(const QByteArray &data);
|
|
||||||
|
|
||||||
// Return all known suffixes
|
|
||||||
static QStringList suffixes();
|
|
||||||
static bool setPreferredSuffix(const QString &typeOrAlias, const QString &suffix);
|
|
||||||
static QString preferredSuffixByType(const QString &type);
|
|
||||||
static QString preferredSuffixByFile(const QFileInfo &f);
|
|
||||||
|
|
||||||
static QStringList filterStrings();
|
|
||||||
// Return a string with all the possible file filters, for use with file dialogs
|
|
||||||
static QString allFiltersString(QString *allFilesFilter = 0);
|
|
||||||
|
|
||||||
static QList<MimeGlobPattern> globPatterns();
|
|
||||||
static void setGlobPatterns(const QString &typeOrAlias, const QList<MimeGlobPattern> &globPatterns);
|
|
||||||
|
|
||||||
static IMagicMatcherList magicMatchers();
|
|
||||||
static void setMagicMatchers(const QString &typeOrAlias, const IMagicMatcherList &matchers);
|
|
||||||
|
|
||||||
static QList<MimeType> mimeTypes();
|
|
||||||
|
|
||||||
// The mime types from the functions bellow are considered only in regard to
|
|
||||||
// their glob patterns and rule-based magic matchers.
|
|
||||||
static void syncUserModifiedMimeTypes();
|
|
||||||
static QList<MimeType> readUserModifiedMimeTypes();
|
|
||||||
static void writeUserModifiedMimeTypes(const QList<MimeType> &mimeTypes);
|
|
||||||
static void clearUserModifiedMimeTypes();
|
|
||||||
|
|
||||||
static QList<MimeGlobPattern> toGlobPatterns(const QStringList &patterns,
|
|
||||||
int weight = MimeGlobPattern::MaxWeight);
|
|
||||||
static QStringList fromGlobPatterns(const QList<MimeGlobPattern> &globPatterns);
|
|
||||||
|
|
||||||
private:
|
|
||||||
MimeDatabase();
|
|
||||||
~MimeDatabase();
|
|
||||||
|
|
||||||
static MimeType findByFileUnlocked(const QFileInfo &f);
|
|
||||||
|
|
||||||
friend class Core::Internal::MainWindow;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Core
|
|
||||||
|
|
||||||
#endif // MIMEDATABASE_H
|
|
@@ -29,7 +29,6 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "mimetypemagicdialog.h"
|
#include "mimetypemagicdialog.h"
|
||||||
#include "mimedatabase.h"
|
|
||||||
|
|
||||||
#include <utils/headerviewstretcher.h>
|
#include <utils/headerviewstretcher.h>
|
||||||
|
|
||||||
@@ -59,37 +58,37 @@ void MimeTypeMagicDialog::applyRecommended(bool checked)
|
|||||||
|
|
||||||
void MimeTypeMagicDialog::validateAccept()
|
void MimeTypeMagicDialog::validateAccept()
|
||||||
{
|
{
|
||||||
if (ui.valueLineEdit->text().isEmpty()
|
// if (ui.valueLineEdit->text().isEmpty()
|
||||||
|| (ui.byteRadioButton->isChecked()
|
// || (ui.byteRadioButton->isChecked()
|
||||||
&& !MagicByteRule::validateByteSequence(ui.valueLineEdit->text()))) {
|
// && !MagicByteRule::validateByteSequence(ui.valueLineEdit->text()))) {
|
||||||
QMessageBox::critical(0, tr("Error"), tr("Not a valid byte pattern."));
|
// QMessageBox::critical(0, tr("Error"), tr("Not a valid byte pattern."));
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MimeTypeMagicDialog::setMagicData(const MagicData &data)
|
void MimeTypeMagicDialog::setMagicData(const MagicData &data)
|
||||||
{
|
{
|
||||||
ui.valueLineEdit->setText(data.m_value);
|
// ui.valueLineEdit->setText(data.m_value);
|
||||||
if (data.m_type == MagicStringRule::kMatchType)
|
// if (data.m_type == MagicStringRule::kMatchType)
|
||||||
ui.stringRadioButton->setChecked(true);
|
// ui.stringRadioButton->setChecked(true);
|
||||||
else
|
// else
|
||||||
ui.byteRadioButton->setChecked(true);
|
// ui.byteRadioButton->setChecked(true);
|
||||||
ui.startRangeSpinBox->setValue(data.m_start);
|
// ui.startRangeSpinBox->setValue(data.m_start);
|
||||||
ui.endRangeSpinBox->setValue(data.m_end);
|
// ui.endRangeSpinBox->setValue(data.m_end);
|
||||||
ui.prioritySpinBox->setValue(data.m_priority);
|
// ui.prioritySpinBox->setValue(data.m_priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
MagicData MimeTypeMagicDialog::magicData() const
|
MagicData MimeTypeMagicDialog::magicData() const
|
||||||
{
|
{
|
||||||
MagicData data;
|
MagicData data;
|
||||||
data.m_value = ui.valueLineEdit->text();
|
// data.m_value = ui.valueLineEdit->text();
|
||||||
if (ui.stringRadioButton->isChecked())
|
// if (ui.stringRadioButton->isChecked())
|
||||||
data.m_type = MagicStringRule::kMatchType;
|
// data.m_type = MagicStringRule::kMatchType;
|
||||||
else
|
// else
|
||||||
data.m_type = MagicByteRule::kMatchType;
|
// data.m_type = MagicByteRule::kMatchType;
|
||||||
data.m_start = ui.startRangeSpinBox->value();
|
// data.m_start = ui.startRangeSpinBox->value();
|
||||||
data.m_end = ui.endRangeSpinBox->value();
|
// data.m_end = ui.endRangeSpinBox->value();
|
||||||
data.m_priority = ui.prioritySpinBox->value();
|
// data.m_priority = ui.prioritySpinBox->value();
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
#include "coreconstants.h"
|
#include "coreconstants.h"
|
||||||
#include "icore.h"
|
#include "icore.h"
|
||||||
#include "mimedatabase.h"
|
|
||||||
#include "mimetypemagicdialog.h"
|
#include "mimetypemagicdialog.h"
|
||||||
#include "mimetypesettings.h"
|
#include "mimetypesettings.h"
|
||||||
#include "ui_mimetypesettingspage.h"
|
#include "ui_mimetypesettingspage.h"
|
||||||
@@ -39,6 +38,7 @@
|
|||||||
#include <coreplugin/editormanager/iexternaleditor.h>
|
#include <coreplugin/editormanager/iexternaleditor.h>
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/headerviewstretcher.h>
|
#include <utils/headerviewstretcher.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@@ -70,10 +70,10 @@ public:
|
|||||||
virtual QVariant data(const QModelIndex &modelIndex, int role = Qt::DisplayRole) const;
|
virtual QVariant data(const QModelIndex &modelIndex, int role = Qt::DisplayRole) const;
|
||||||
|
|
||||||
void load();
|
void load();
|
||||||
void validatePatterns(QStringList *candidates, const MimeType &mimeType) const;
|
void validatePatterns(QStringList *candidates) const;
|
||||||
void updateKnownPatterns(const QStringList &oldPatterns, const QStringList &newPatterns);
|
void updateKnownPatterns(const QStringList &oldPatterns, const QStringList &newPatterns);
|
||||||
|
|
||||||
QList<MimeType> m_mimeTypes;
|
QList<Utils::MimeType> m_mimeTypes;
|
||||||
QSet<QString> m_knownPatterns;
|
QSet<QString> m_knownPatterns;
|
||||||
QHash<QString, QString> m_handlersByMimeType;
|
QHash<QString, QString> m_handlersByMimeType;
|
||||||
};
|
};
|
||||||
@@ -106,7 +106,7 @@ QVariant MimeTypeSettingsModel::data(const QModelIndex &modelIndex, int role) co
|
|||||||
|
|
||||||
const int column = modelIndex.column();
|
const int column = modelIndex.column();
|
||||||
if (role == Qt::DisplayRole) {
|
if (role == Qt::DisplayRole) {
|
||||||
const QString &type = m_mimeTypes.at(modelIndex.row()).type();
|
const QString &type = m_mimeTypes.at(modelIndex.row()).name();
|
||||||
if (column == 0)
|
if (column == 0)
|
||||||
return type;
|
return type;
|
||||||
else
|
else
|
||||||
@@ -117,14 +117,14 @@ QVariant MimeTypeSettingsModel::data(const QModelIndex &modelIndex, int role) co
|
|||||||
|
|
||||||
void MimeTypeSettingsModel::load()
|
void MimeTypeSettingsModel::load()
|
||||||
{
|
{
|
||||||
m_mimeTypes = MimeDatabase::mimeTypes();
|
Utils::MimeDatabase mdb;
|
||||||
Utils::sort(m_mimeTypes, [](const MimeType &a, const MimeType &b) {
|
m_mimeTypes = mdb.allMimeTypes();
|
||||||
return a.type().compare(b.type(), Qt::CaseInsensitive) < 0;
|
Utils::sort(m_mimeTypes, [](const Utils::MimeType &a, const Utils::MimeType &b) {
|
||||||
|
return a.name().compare(b.name(), Qt::CaseInsensitive) < 0;
|
||||||
});
|
});
|
||||||
m_knownPatterns = QSet<QString>::fromList(
|
m_knownPatterns = QSet<QString>::fromList(Utils::MimeDatabase::allGlobPatterns());
|
||||||
MimeDatabase::fromGlobPatterns(MimeDatabase::globPatterns()));
|
|
||||||
|
|
||||||
foreach (const MimeType &mimeType, m_mimeTypes) {
|
foreach (const Utils::MimeType &mimeType, m_mimeTypes) {
|
||||||
QString value;
|
QString value;
|
||||||
const QList<IEditorFactory *> factories =
|
const QList<IEditorFactory *> factories =
|
||||||
EditorManager::editorFactories(mimeType);
|
EditorManager::editorFactories(mimeType);
|
||||||
@@ -138,15 +138,14 @@ void MimeTypeSettingsModel::load()
|
|||||||
else
|
else
|
||||||
value = tr("Undefined");
|
value = tr("Undefined");
|
||||||
}
|
}
|
||||||
m_handlersByMimeType.insert(mimeType.type(), value);
|
m_handlersByMimeType.insert(mimeType.name(), value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MimeTypeSettingsModel::validatePatterns(QStringList *candidates,
|
void MimeTypeSettingsModel::validatePatterns(QStringList *candidates) const
|
||||||
const MimeType &mimeType) const
|
|
||||||
{
|
{
|
||||||
QSet<QString> oldPatterns =
|
QSet<QString> oldPatterns =
|
||||||
QSet<QString>::fromList(MimeDatabase::fromGlobPatterns(mimeType.globPatterns()));
|
QSet<QString>::fromList(Utils::MimeDatabase::allGlobPatterns());
|
||||||
|
|
||||||
QStringList duplicates;
|
QStringList duplicates;
|
||||||
QStringList::iterator it = candidates->begin();
|
QStringList::iterator it = candidates->begin();
|
||||||
@@ -209,9 +208,10 @@ public:
|
|||||||
void clearSyncData();
|
void clearSyncData();
|
||||||
void markAsModified(int index);
|
void markAsModified(int index);
|
||||||
|
|
||||||
void addMagicHeaderRow(const MagicData &data);
|
// TODO
|
||||||
MagicData getMagicHeaderRowData(const int row) const;
|
// void addMagicHeaderRow(const MagicData &data);
|
||||||
void editMagicHeaderRowData(const int row, const MagicData &data);
|
// MagicData getMagicHeaderRowData(const int row) const;
|
||||||
|
// void editMagicHeaderRowData(const int row, const MagicData &data);
|
||||||
|
|
||||||
void updateMimeDatabase();
|
void updateMimeDatabase();
|
||||||
void resetState();
|
void resetState();
|
||||||
@@ -219,9 +219,10 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
void syncData(const QModelIndex ¤t, const QModelIndex &previous);
|
void syncData(const QModelIndex ¤t, const QModelIndex &previous);
|
||||||
void handlePatternEdited();
|
void handlePatternEdited();
|
||||||
void addMagicHeader();
|
// TODO
|
||||||
void removeMagicHeader();
|
// void addMagicHeader();
|
||||||
void editMagicHeader();
|
// void removeMagicHeader();
|
||||||
|
// void editMagicHeader();
|
||||||
void resetMimeTypes();
|
void resetMimeTypes();
|
||||||
void updateMagicHeaderButtons();
|
void updateMagicHeaderButtons();
|
||||||
|
|
||||||
@@ -278,9 +279,10 @@ void MimeTypeSettingsPrivate::configureUi(QWidget *w)
|
|||||||
SLOT(syncData(QModelIndex,QModelIndex)));
|
SLOT(syncData(QModelIndex,QModelIndex)));
|
||||||
connect(m_ui.patternsLineEdit, SIGNAL(textEdited(QString)),
|
connect(m_ui.patternsLineEdit, SIGNAL(textEdited(QString)),
|
||||||
this, SLOT(handlePatternEdited()));
|
this, SLOT(handlePatternEdited()));
|
||||||
connect(m_ui.addMagicButton, SIGNAL(clicked()), this, SLOT(addMagicHeader()));
|
// TODO
|
||||||
connect(m_ui.removeMagicButton, SIGNAL(clicked()), this, SLOT(removeMagicHeader()));
|
// connect(m_ui.addMagicButton, SIGNAL(clicked()), this, SLOT(addMagicHeader()));
|
||||||
connect(m_ui.editMagicButton, SIGNAL(clicked()), this, SLOT(editMagicHeader()));
|
// connect(m_ui.removeMagicButton, SIGNAL(clicked()), this, SLOT(removeMagicHeader()));
|
||||||
|
// connect(m_ui.editMagicButton, SIGNAL(clicked()), this, SLOT(editMagicHeader()));
|
||||||
connect(m_ui.resetButton, SIGNAL(clicked()), this, SLOT(resetMimeTypes()));
|
connect(m_ui.resetButton, SIGNAL(clicked()), this, SLOT(resetMimeTypes()));
|
||||||
connect(m_ui.magicHeadersTreeWidget,
|
connect(m_ui.magicHeadersTreeWidget,
|
||||||
SIGNAL(itemSelectionChanged()),
|
SIGNAL(itemSelectionChanged()),
|
||||||
@@ -332,35 +334,37 @@ void MimeTypeSettingsPrivate::markAsModified(int index)
|
|||||||
|
|
||||||
void MimeTypeSettingsPrivate::syncMimePattern()
|
void MimeTypeSettingsPrivate::syncMimePattern()
|
||||||
{
|
{
|
||||||
MimeType &mimeType = m_model->m_mimeTypes[m_mimeForPatternSync];
|
// TODO
|
||||||
QStringList patterns = m_ui.patternsLineEdit->text().split(kSemiColon);
|
// MimeType &mimeType = m_model->m_mimeTypes[m_mimeForPatternSync];
|
||||||
patterns.removeDuplicates();
|
// QStringList patterns = m_ui.patternsLineEdit->text().split(kSemiColon);
|
||||||
m_model->validatePatterns(&patterns, mimeType);
|
// patterns.removeDuplicates();
|
||||||
m_model->updateKnownPatterns(MimeDatabase::fromGlobPatterns(mimeType.globPatterns()), patterns);
|
// m_model->validatePatterns(&patterns);
|
||||||
mimeType.setGlobPatterns(MimeDatabase::toGlobPatterns(patterns));
|
// m_model->updateKnownPatterns(MimeDatabase::fromGlobPatterns(mimeType.globPatterns()), patterns);
|
||||||
|
// mimeType.setGlobPatterns(MimeDatabase::toGlobPatterns(patterns));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MimeTypeSettingsPrivate::syncMimeMagic()
|
void MimeTypeSettingsPrivate::syncMimeMagic()
|
||||||
{
|
{
|
||||||
typedef MagicRuleMatcher::MagicRuleList MagicRuleList;
|
// TODO
|
||||||
typedef MagicRuleMatcher::MagicRuleSharedPointer MagicRuleSharedPointer;
|
// typedef MagicRuleMatcher::MagicRuleList MagicRuleList;
|
||||||
|
// typedef MagicRuleMatcher::MagicRuleSharedPointer MagicRuleSharedPointer;
|
||||||
|
|
||||||
// Gather the magic rules.
|
// // Gather the magic rules.
|
||||||
QHash<int, MagicRuleList> rulesByPriority;
|
// QHash<int, MagicRuleList> rulesByPriority;
|
||||||
for (int row = 0; row < m_ui.magicHeadersTreeWidget->topLevelItemCount(); ++row) {
|
// for (int row = 0; row < m_ui.magicHeadersTreeWidget->topLevelItemCount(); ++row) {
|
||||||
const MagicData &data = getMagicHeaderRowData(row);
|
// const MagicData &data = getMagicHeaderRowData(row);
|
||||||
// @TODO: Validate magic rule?
|
// // @TODO: Validate magic rule?
|
||||||
MagicRule *magicRule;
|
// MagicRule *magicRule;
|
||||||
if (data.m_type == MagicStringRule::kMatchType)
|
// if (data.m_type == MagicStringRule::kMatchType)
|
||||||
magicRule = new MagicStringRule(data.m_value, data.m_start, data.m_end);
|
// magicRule = new MagicStringRule(data.m_value, data.m_start, data.m_end);
|
||||||
else
|
// else
|
||||||
magicRule = new MagicByteRule(data.m_value, data.m_start, data.m_end);
|
// magicRule = new MagicByteRule(data.m_value, data.m_start, data.m_end);
|
||||||
rulesByPriority[data.m_priority].append(MagicRuleSharedPointer(magicRule));
|
// rulesByPriority[data.m_priority].append(MagicRuleSharedPointer(magicRule));
|
||||||
}
|
// }
|
||||||
|
|
||||||
const QList<QSharedPointer<IMagicMatcher> > &matchers =
|
// const QList<QSharedPointer<IMagicMatcher> > &matchers =
|
||||||
MagicRuleMatcher::createMatchers(rulesByPriority);
|
// MagicRuleMatcher::createMatchers(rulesByPriority);
|
||||||
m_model->m_mimeTypes[m_mimeForMagicSync].setMagicRuleMatchers(matchers);
|
// m_model->m_mimeTypes[m_mimeForMagicSync].setMagicRuleMatchers(matchers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MimeTypeSettingsPrivate::clearSyncData()
|
void MimeTypeSettingsPrivate::clearSyncData()
|
||||||
@@ -384,27 +388,25 @@ void MimeTypeSettingsPrivate::syncData(const QModelIndex ¤t,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (current.isValid()) {
|
if (current.isValid()) {
|
||||||
const MimeType ¤tMimeType =
|
const Utils::MimeType ¤tMimeType =
|
||||||
m_model->m_mimeTypes.at(m_filterModel->mapToSource(current).row());
|
m_model->m_mimeTypes.at(m_filterModel->mapToSource(current).row());
|
||||||
|
|
||||||
QStringList formatedPatterns;
|
m_ui.patternsLineEdit->setText(currentMimeType.globPatterns().join(kSemiColon));
|
||||||
foreach (const MimeGlobPattern &pattern, currentMimeType.globPatterns())
|
|
||||||
formatedPatterns.append(pattern.pattern());
|
|
||||||
m_ui.patternsLineEdit->setText(formatedPatterns.join(kSemiColon));
|
|
||||||
|
|
||||||
// Consider only rule-based matchers.
|
// TODO
|
||||||
const QList<QSharedPointer<IMagicMatcher> > &matchers = currentMimeType.magicRuleMatchers();
|
// // Consider only rule-based matchers.
|
||||||
foreach (const QSharedPointer<IMagicMatcher> &matcher, matchers) {
|
// const QList<QSharedPointer<IMagicMatcher> > &matchers = currentMimeType.magicRuleMatchers();
|
||||||
MagicRuleMatcher *ruleMatcher = static_cast<MagicRuleMatcher *>(matcher.data());
|
// foreach (const QSharedPointer<IMagicMatcher> &matcher, matchers) {
|
||||||
const int priority = ruleMatcher->priority();
|
// MagicRuleMatcher *ruleMatcher = static_cast<MagicRuleMatcher *>(matcher.data());
|
||||||
const MagicRuleMatcher::MagicRuleList &rules = ruleMatcher->magicRules();
|
// const int priority = ruleMatcher->priority();
|
||||||
foreach (const MagicRuleMatcher::MagicRuleSharedPointer &rule, rules)
|
// const MagicRuleMatcher::MagicRuleList &rules = ruleMatcher->magicRules();
|
||||||
addMagicHeaderRow(MagicData(rule->matchValue(),
|
// foreach (const MagicRuleMatcher::MagicRuleSharedPointer &rule, rules)
|
||||||
rule->matchType(),
|
// addMagicHeaderRow(MagicData(rule->matchValue(),
|
||||||
rule->startPos(),
|
// rule->matchType(),
|
||||||
rule->endPos(),
|
// rule->startPos(),
|
||||||
priority));
|
// rule->endPos(),
|
||||||
}
|
// priority));
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,94 +419,96 @@ void MimeTypeSettingsPrivate::handlePatternEdited()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MimeTypeSettingsPrivate::addMagicHeaderRow(const MagicData &data)
|
// TODO
|
||||||
{
|
//void MimeTypeSettingsPrivate::addMagicHeaderRow(const MagicData &data)
|
||||||
const int row = m_ui.magicHeadersTreeWidget->topLevelItemCount();
|
//{
|
||||||
editMagicHeaderRowData(row, data);
|
// const int row = m_ui.magicHeadersTreeWidget->topLevelItemCount();
|
||||||
}
|
// editMagicHeaderRowData(row, data);
|
||||||
|
//}
|
||||||
|
|
||||||
MagicData MimeTypeSettingsPrivate::getMagicHeaderRowData(const int row) const
|
//MagicData MimeTypeSettingsPrivate::getMagicHeaderRowData(const int row) const
|
||||||
{
|
//{
|
||||||
MagicData data;
|
// MagicData data;
|
||||||
data.m_value = m_ui.magicHeadersTreeWidget->topLevelItem(row)->text(0);
|
// data.m_value = m_ui.magicHeadersTreeWidget->topLevelItem(row)->text(0);
|
||||||
data.m_type = m_ui.magicHeadersTreeWidget->topLevelItem(row)->text(1);
|
// data.m_type = m_ui.magicHeadersTreeWidget->topLevelItem(row)->text(1);
|
||||||
QPair<int, int> startEnd =
|
// QPair<int, int> startEnd =
|
||||||
MagicRule::fromOffset(m_ui.magicHeadersTreeWidget->topLevelItem(row)->text(2));
|
// MagicRule::fromOffset(m_ui.magicHeadersTreeWidget->topLevelItem(row)->text(2));
|
||||||
data.m_start = startEnd.first;
|
// data.m_start = startEnd.first;
|
||||||
data.m_end = startEnd.second;
|
// data.m_end = startEnd.second;
|
||||||
data.m_priority = m_ui.magicHeadersTreeWidget->topLevelItem(row)->text(3).toInt();
|
// data.m_priority = m_ui.magicHeadersTreeWidget->topLevelItem(row)->text(3).toInt();
|
||||||
|
|
||||||
return data;
|
// return data;
|
||||||
}
|
//}
|
||||||
|
|
||||||
void MimeTypeSettingsPrivate::editMagicHeaderRowData(const int row, const MagicData &data)
|
//void MimeTypeSettingsPrivate::editMagicHeaderRowData(const int row, const MagicData &data)
|
||||||
{
|
//{
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem;
|
// QTreeWidgetItem *item = new QTreeWidgetItem;
|
||||||
item->setText(0, data.m_value);
|
// item->setText(0, data.m_value);
|
||||||
item->setText(1, data.m_type);
|
// item->setText(1, data.m_type);
|
||||||
item->setText(2, MagicRule::toOffset(qMakePair(data.m_start, data.m_end)));
|
// item->setText(2, MagicRule::toOffset(qMakePair(data.m_start, data.m_end)));
|
||||||
item->setText(3, QString::number(data.m_priority));
|
// item->setText(3, QString::number(data.m_priority));
|
||||||
m_ui.magicHeadersTreeWidget->takeTopLevelItem(row);
|
// m_ui.magicHeadersTreeWidget->takeTopLevelItem(row);
|
||||||
m_ui.magicHeadersTreeWidget->insertTopLevelItem(row, item);
|
// m_ui.magicHeadersTreeWidget->insertTopLevelItem(row, item);
|
||||||
m_ui.magicHeadersTreeWidget->setCurrentItem(item);
|
// m_ui.magicHeadersTreeWidget->setCurrentItem(item);
|
||||||
}
|
//}
|
||||||
|
|
||||||
void MimeTypeSettingsPrivate::addMagicHeader()
|
//void MimeTypeSettingsPrivate::addMagicHeader()
|
||||||
{
|
//{
|
||||||
if (!checkSelectedMimeType())
|
// if (!checkSelectedMimeType())
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
MimeTypeMagicDialog dlg;
|
// MimeTypeMagicDialog dlg;
|
||||||
if (dlg.exec()) {
|
// if (dlg.exec()) {
|
||||||
addMagicHeaderRow(dlg.magicData());
|
// addMagicHeaderRow(dlg.magicData());
|
||||||
markMimeForMagicSync(m_filterModel->mapToSource(
|
// markMimeForMagicSync(m_filterModel->mapToSource(
|
||||||
m_ui.mimeTypesTreeView->currentIndex()).row());
|
// m_ui.mimeTypesTreeView->currentIndex()).row());
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
void MimeTypeSettingsPrivate::removeMagicHeader()
|
//void MimeTypeSettingsPrivate::removeMagicHeader()
|
||||||
{
|
//{
|
||||||
if (!checkSelectedMagicHeader())
|
// if (!checkSelectedMagicHeader())
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
m_ui.magicHeadersTreeWidget->takeTopLevelItem(m_ui.magicHeadersTreeWidget->indexOfTopLevelItem(m_ui.magicHeadersTreeWidget->currentItem()));
|
// m_ui.magicHeadersTreeWidget->takeTopLevelItem(m_ui.magicHeadersTreeWidget->indexOfTopLevelItem(m_ui.magicHeadersTreeWidget->currentItem()));
|
||||||
markMimeForMagicSync(m_filterModel->mapToSource(
|
// markMimeForMagicSync(m_filterModel->mapToSource(
|
||||||
m_ui.mimeTypesTreeView->currentIndex()).row());
|
// m_ui.mimeTypesTreeView->currentIndex()).row());
|
||||||
}
|
//}
|
||||||
|
|
||||||
void MimeTypeSettingsPrivate::editMagicHeader()
|
//void MimeTypeSettingsPrivate::editMagicHeader()
|
||||||
{
|
//{
|
||||||
if (!checkSelectedMagicHeader())
|
// if (!checkSelectedMagicHeader())
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
MimeTypeMagicDialog dlg;
|
// MimeTypeMagicDialog dlg;
|
||||||
dlg.setMagicData(getMagicHeaderRowData(m_ui.magicHeadersTreeWidget->indexOfTopLevelItem(m_ui.magicHeadersTreeWidget->currentItem())));
|
// dlg.setMagicData(getMagicHeaderRowData(m_ui.magicHeadersTreeWidget->indexOfTopLevelItem(m_ui.magicHeadersTreeWidget->currentItem())));
|
||||||
if (dlg.exec()) {
|
// if (dlg.exec()) {
|
||||||
editMagicHeaderRowData(m_ui.magicHeadersTreeWidget->indexOfTopLevelItem(m_ui.magicHeadersTreeWidget->currentItem()), dlg.magicData());
|
// editMagicHeaderRowData(m_ui.magicHeadersTreeWidget->indexOfTopLevelItem(m_ui.magicHeadersTreeWidget->currentItem()), dlg.magicData());
|
||||||
markMimeForMagicSync(m_filterModel->mapToSource(
|
// markMimeForMagicSync(m_filterModel->mapToSource(
|
||||||
m_ui.mimeTypesTreeView->currentIndex()).row());
|
// m_ui.mimeTypesTreeView->currentIndex()).row());
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
void MimeTypeSettingsPrivate::updateMimeDatabase()
|
void MimeTypeSettingsPrivate::updateMimeDatabase()
|
||||||
{
|
{
|
||||||
if (m_modifiedMimeTypes.isEmpty())
|
// TODO
|
||||||
return;
|
// if (m_modifiedMimeTypes.isEmpty())
|
||||||
|
// return;
|
||||||
|
|
||||||
// For this case it is a better approach to simply use a list and to remove duplicates
|
// // For this case it is a better approach to simply use a list and to remove duplicates
|
||||||
// afterwards than to keep a more complex data structure like a hash table.
|
// // afterwards than to keep a more complex data structure like a hash table.
|
||||||
Utils::sort(m_modifiedMimeTypes);
|
// Utils::sort(m_modifiedMimeTypes);
|
||||||
m_modifiedMimeTypes.erase(std::unique(m_modifiedMimeTypes.begin(), m_modifiedMimeTypes.end()),
|
// m_modifiedMimeTypes.erase(std::unique(m_modifiedMimeTypes.begin(), m_modifiedMimeTypes.end()),
|
||||||
m_modifiedMimeTypes.end());
|
// m_modifiedMimeTypes.end());
|
||||||
|
|
||||||
QList<MimeType> allModified;
|
// QList<MimeType> allModified;
|
||||||
foreach (int index, m_modifiedMimeTypes) {
|
// foreach (int index, m_modifiedMimeTypes) {
|
||||||
const MimeType &mimeType = m_model->m_mimeTypes.at(index);
|
// const MimeType &mimeType = m_model->m_mimeTypes.at(index);
|
||||||
MimeDatabase::setGlobPatterns(mimeType.type(), mimeType.globPatterns());
|
// MimeDatabase::setGlobPatterns(mimeType.type(), mimeType.globPatterns());
|
||||||
MimeDatabase::setMagicMatchers(mimeType.type(), mimeType.magicMatchers());
|
// MimeDatabase::setMagicMatchers(mimeType.type(), mimeType.magicMatchers());
|
||||||
allModified.append(mimeType);
|
// allModified.append(mimeType);
|
||||||
}
|
// }
|
||||||
MimeDatabase::writeUserModifiedMimeTypes(allModified);
|
// MimeDatabase::writeUserModifiedMimeTypes(allModified);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MimeTypeSettingsPrivate::resetState()
|
void MimeTypeSettingsPrivate::resetState()
|
||||||
@@ -561,6 +565,11 @@ QWidget *MimeTypeSettings::widget()
|
|||||||
if (!d->m_widget) {
|
if (!d->m_widget) {
|
||||||
d->m_widget = new QWidget;
|
d->m_widget = new QWidget;
|
||||||
d->configureUi(d->m_widget);
|
d->configureUi(d->m_widget);
|
||||||
|
// TODO temporarily disabled
|
||||||
|
d->m_ui.addMagicButton->setEnabled(false);
|
||||||
|
d->m_ui.editMagicButton->setEnabled(false);
|
||||||
|
d->m_ui.removeMagicButton->setEnabled(false);
|
||||||
|
d->m_ui.patternsLineEdit->setEnabled(false);
|
||||||
}
|
}
|
||||||
return d->m_widget;
|
return d->m_widget;
|
||||||
}
|
}
|
||||||
@@ -585,12 +594,13 @@ void MimeTypeSettings::apply()
|
|||||||
|
|
||||||
void MimeTypeSettings::finish()
|
void MimeTypeSettings::finish()
|
||||||
{
|
{
|
||||||
if (d->m_persist) {
|
// TODO
|
||||||
if (d->m_reset)
|
// if (d->m_persist) {
|
||||||
MimeDatabase::clearUserModifiedMimeTypes();
|
// if (d->m_reset)
|
||||||
else
|
// MimeDatabase::clearUserModifiedMimeTypes();
|
||||||
d->updateMimeDatabase();
|
// else
|
||||||
}
|
// d->updateMimeDatabase();
|
||||||
|
// }
|
||||||
d->resetState();
|
d->resetState();
|
||||||
delete d->m_widget;
|
delete d->m_widget;
|
||||||
}
|
}
|
||||||
|
@@ -46,11 +46,11 @@
|
|||||||
#include <coreplugin/id.h>
|
#include <coreplugin/id.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
#include <texteditor/texteditor.h>
|
#include <texteditor/texteditor.h>
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
@@ -377,7 +377,9 @@ void CodepasterPlugin::finishFetch(const QString &titleDescription,
|
|||||||
// Default to "txt".
|
// Default to "txt".
|
||||||
QByteArray byteContent = content.toUtf8();
|
QByteArray byteContent = content.toUtf8();
|
||||||
QString suffix;
|
QString suffix;
|
||||||
if (const MimeType mimeType = MimeDatabase::findByData(byteContent))
|
Utils::MimeDatabase mdb;
|
||||||
|
const Utils::MimeType mimeType = mdb.mimeTypeForData(byteContent);
|
||||||
|
if (mimeType.isValid())
|
||||||
suffix = mimeType.preferredSuffix();
|
suffix = mimeType.preferredSuffix();
|
||||||
if (suffix.isEmpty())
|
if (suffix.isEmpty())
|
||||||
suffix = QLatin1String("txt");
|
suffix = QLatin1String("txt");
|
||||||
|
@@ -1,33 +1,24 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
||||||
<mime-type type="text/x-csrc">
|
<mime-type type="text/vnd.nvidia.cuda.csrc">
|
||||||
<sub-class-of type="text/plain"/>
|
|
||||||
<comment>C Source file</comment>
|
|
||||||
<glob pattern="*.c"/>
|
|
||||||
<!-- NVIDIA CUDA files are like C -->
|
|
||||||
<glob pattern="*.cu"/>
|
|
||||||
</mime-type>
|
|
||||||
|
|
||||||
<!-- A C Header file is virtually undistinguishable from the C++ header -->
|
|
||||||
<mime-type type="text/x-chdr">
|
|
||||||
<sub-class-of type="text/x-csrc"/>
|
<sub-class-of type="text/x-csrc"/>
|
||||||
<comment>C Header file</comment>
|
<comment>NVIDIA CUDA C source code</comment>
|
||||||
<glob pattern="*.h"/>
|
<glob pattern="*.cu"/>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
|
|
||||||
<!-- Those are used to find matching headers by the CppTools plugin,
|
<!-- Those are used to find matching headers by the CppTools plugin,
|
||||||
so, they should match -->
|
so, they should match -->
|
||||||
<mime-type type="text/x-c++hdr">
|
<mime-type type="text/x-c++hdr">
|
||||||
<sub-class-of type="text/x-chdr"/>
|
<sub-class-of type="text/x-chdr"/>
|
||||||
<comment>C++ Header file</comment>
|
|
||||||
<comment>C++ header</comment>
|
<comment>C++ header</comment>
|
||||||
<glob pattern="*.h"/>
|
|
||||||
<glob pattern="*.hh"/>
|
<glob pattern="*.hh"/>
|
||||||
<glob pattern="*.hxx"/>
|
<glob pattern="*.hxx"/>
|
||||||
<glob pattern="*.h++"/>
|
<glob pattern="*.h++"/>
|
||||||
<glob pattern="*.H"/>
|
|
||||||
<glob pattern="*.hpp"/>
|
<glob pattern="*.hpp"/>
|
||||||
<glob pattern="*.hp"/>
|
<glob pattern="*.hp"/>
|
||||||
|
<!-- Additions to freedesktop: -->
|
||||||
|
<glob pattern="*.h"/>
|
||||||
|
<glob pattern="*.H"/>
|
||||||
<!-- Find include guards of header files without extension, for
|
<!-- Find include guards of header files without extension, for
|
||||||
example, STL ones like <string>. Those can have a big initial
|
example, STL ones like <string>. Those can have a big initial
|
||||||
comment exceeding 1000 chars, though. -->
|
comment exceeding 1000 chars, though. -->
|
||||||
@@ -39,17 +30,17 @@
|
|||||||
</mime-type>
|
</mime-type>
|
||||||
|
|
||||||
<mime-type type="text/x-c++src">
|
<mime-type type="text/x-c++src">
|
||||||
<comment>C++ Source file</comment>
|
<comment>C++ source code</comment>
|
||||||
<sub-class-of type="text/x-csrc"/>
|
<sub-class-of type="text/x-csrc"/>
|
||||||
<comment>C++ source code</comment>
|
<comment>C++ source code</comment>
|
||||||
<glob pattern="*.cpp"/>
|
<glob pattern="*.cpp"/>
|
||||||
<glob pattern="*.cp"/>
|
|
||||||
<glob pattern="*.cc"/>
|
|
||||||
<glob pattern="*.cxx"/>
|
<glob pattern="*.cxx"/>
|
||||||
|
<glob pattern="*.cc"/>
|
||||||
|
<glob pattern="*.C" case-sensitive="true"/>
|
||||||
<glob pattern="*.c++"/>
|
<glob pattern="*.c++"/>
|
||||||
<glob pattern="*.C"/>
|
<!-- Additions to freedesktop: -->
|
||||||
|
<glob pattern="*.cp"/>
|
||||||
<glob pattern="*.inl"/>
|
<glob pattern="*.inl"/>
|
||||||
<glob pattern="*.moc"/>
|
|
||||||
<glob pattern="*.qdoc"/>
|
<glob pattern="*.qdoc"/>
|
||||||
<glob pattern="*.tcc"/>
|
<glob pattern="*.tcc"/>
|
||||||
<glob pattern="*.tpp"/>
|
<glob pattern="*.tpp"/>
|
||||||
@@ -60,11 +51,14 @@
|
|||||||
</magic>
|
</magic>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
|
|
||||||
<mime-type type="text/x-objcsrc">
|
<mime-type type="text/x-moc">
|
||||||
<comment>Objective-C source code</comment>
|
<comment>Qt MOC file</comment>
|
||||||
<sub-class-of type="text/x-csrc"/>
|
<acronym>Qt MOC</acronym>
|
||||||
<glob pattern="*.m"/>
|
<expanded-acronym>Qt Meta Object Compiler</expanded-acronym>
|
||||||
</mime-type>
|
<!-- Fix to freedesktop: moc is C++ source -->
|
||||||
|
<sub-class-of type="text/x-c++src"/>
|
||||||
|
<glob pattern="*.moc"/>
|
||||||
|
</mime-type>
|
||||||
|
|
||||||
<mime-type type="text/x-objc++src">
|
<mime-type type="text/x-objc++src">
|
||||||
<comment>Objective-C++ source code</comment>
|
<comment>Objective-C++ source code</comment>
|
||||||
|
@@ -44,6 +44,7 @@
|
|||||||
|
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
|
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/runextensions.h>
|
#include <utils/runextensions.h>
|
||||||
|
|
||||||
@@ -202,7 +203,8 @@ void CppEditorDocument::onFilePathChanged(const Utils::FileName &oldPath,
|
|||||||
Q_UNUSED(oldPath);
|
Q_UNUSED(oldPath);
|
||||||
|
|
||||||
if (!newPath.isEmpty()) {
|
if (!newPath.isEmpty()) {
|
||||||
setMimeType(Core::MimeDatabase::findByFile(newPath.toFileInfo()).type());
|
Utils::MimeDatabase mdb;
|
||||||
|
setMimeType(mdb.mimeTypeForFile(newPath.toFileInfo()).name());
|
||||||
|
|
||||||
disconnect(this, SIGNAL(contentsChanged()), this, SLOT(scheduleProcessDocument()));
|
disconnect(this, SIGNAL(contentsChanged()), this, SLOT(scheduleProcessDocument()));
|
||||||
connect(this, SIGNAL(contentsChanged()), this, SLOT(scheduleProcessDocument()));
|
connect(this, SIGNAL(contentsChanged()), this, SLOT(scheduleProcessDocument()));
|
||||||
|
@@ -60,7 +60,7 @@
|
|||||||
#include <texteditor/texteditorconstants.h>
|
#include <texteditor/texteditorconstants.h>
|
||||||
|
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/theme/theme.h>
|
#include <utils/theme/theme.h>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@@ -153,8 +153,8 @@ CppQuickFixAssistProvider *CppEditorPlugin::quickFixProvider() const
|
|||||||
|
|
||||||
bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
|
bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
|
||||||
{
|
{
|
||||||
if (!MimeDatabase::addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"), errorMessage))
|
Q_UNUSED(errorMessage)
|
||||||
return false;
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"));
|
||||||
|
|
||||||
addAutoReleasedObject(new CppEditorFactory);
|
addAutoReleasedObject(new CppEditorFactory);
|
||||||
addAutoReleasedObject(new CppOutlineWidgetFactory);
|
addAutoReleasedObject(new CppOutlineWidgetFactory);
|
||||||
|
@@ -49,6 +49,7 @@
|
|||||||
#include <texteditor/texteditorsettings.h>
|
#include <texteditor/texteditorsettings.h>
|
||||||
#include <texteditor/completionsettings.h>
|
#include <texteditor/completionsettings.h>
|
||||||
|
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <cplusplus/BackwardsScanner.h>
|
#include <cplusplus/BackwardsScanner.h>
|
||||||
@@ -1120,9 +1121,8 @@ bool InternalCppCompletionAssistProcessor::completeInclude(const QTextCursor &cu
|
|||||||
if (!headerPaths.contains(currentFilePath))
|
if (!headerPaths.contains(currentFilePath))
|
||||||
headerPaths.append(currentFilePath);
|
headerPaths.append(currentFilePath);
|
||||||
|
|
||||||
const Core::MimeType mimeType =
|
Utils::MimeDatabase mdb;
|
||||||
Core::MimeDatabase::findByType(QLatin1String("text/x-c++hdr"));
|
const QStringList suffixes = mdb.mimeTypeForName(QLatin1String("text/x-c++hdr")).suffixes();
|
||||||
const QStringList suffixes = mimeType.suffixes();
|
|
||||||
|
|
||||||
foreach (const ProjectPart::HeaderPath &headerPath, headerPaths) {
|
foreach (const ProjectPart::HeaderPath &headerPath, headerPaths) {
|
||||||
QString realPath = headerPath.path;
|
QString realPath = headerPath.path;
|
||||||
@@ -1171,9 +1171,10 @@ bool InternalCppCompletionAssistProcessor::objcKeywordsWanted() const
|
|||||||
|
|
||||||
const QString fileName = m_interface->fileName();
|
const QString fileName = m_interface->fileName();
|
||||||
|
|
||||||
const QString mt = Core::MimeDatabase::findByFile(fileName).type();
|
Utils::MimeDatabase mdb;
|
||||||
return mt == QLatin1String(CppTools::Constants::OBJECTIVE_C_SOURCE_MIMETYPE)
|
const Utils::MimeType mt = mdb.mimeTypeForFile(fileName);
|
||||||
|| mt == QLatin1String(CppTools::Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE);
|
return mt.matchesName(QLatin1String(CppTools::Constants::OBJECTIVE_C_SOURCE_MIMETYPE))
|
||||||
|
|| mt.matchesName(QLatin1String(CppTools::Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE));
|
||||||
}
|
}
|
||||||
|
|
||||||
int InternalCppCompletionAssistProcessor::startCompletionInternal(const QString &fileName,
|
int InternalCppCompletionAssistProcessor::startCompletionInternal(const QString &fileName,
|
||||||
|
@@ -36,11 +36,11 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <cppeditor/cppeditorconstants.h>
|
#include <cppeditor/cppeditorconstants.h>
|
||||||
|
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -118,8 +118,17 @@ void CppFileSettings::fromSettings(QSettings *s)
|
|||||||
|
|
||||||
bool CppFileSettings::applySuffixesToMimeDB()
|
bool CppFileSettings::applySuffixesToMimeDB()
|
||||||
{
|
{
|
||||||
return Core::MimeDatabase::setPreferredSuffix(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE), sourceSuffix)
|
Utils::MimeDatabase mdb;
|
||||||
&& Core::MimeDatabase::setPreferredSuffix(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE), headerSuffix);
|
Utils::MimeType mt;
|
||||||
|
mt = mdb.mimeTypeForName(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE));
|
||||||
|
if (!mt.isValid())
|
||||||
|
return false;
|
||||||
|
mt.setPreferredSuffix(sourceSuffix);
|
||||||
|
mt = mdb.mimeTypeForName(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE));
|
||||||
|
if (!mt.isValid())
|
||||||
|
return false;
|
||||||
|
mt.setPreferredSuffix(headerSuffix);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CppFileSettings::equals(const CppFileSettings &rhs) const
|
bool CppFileSettings::equals(const CppFileSettings &rhs) const
|
||||||
@@ -255,13 +264,18 @@ CppFileSettingsWidget::CppFileSettingsWidget(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
// populate suffix combos
|
// populate suffix combos
|
||||||
if (const Core::MimeType sourceMt = Core::MimeDatabase::findByType(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE)))
|
Utils::MimeDatabase mdb;
|
||||||
|
const Utils::MimeType sourceMt = mdb.mimeTypeForName(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE));
|
||||||
|
if (sourceMt.isValid()) {
|
||||||
foreach (const QString &suffix, sourceMt.suffixes())
|
foreach (const QString &suffix, sourceMt.suffixes())
|
||||||
m_ui->sourceSuffixComboBox->addItem(suffix);
|
m_ui->sourceSuffixComboBox->addItem(suffix);
|
||||||
|
}
|
||||||
|
|
||||||
if (const Core::MimeType headerMt = Core::MimeDatabase::findByType(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE)))
|
const Utils::MimeType headerMt = mdb.mimeTypeForName(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE));
|
||||||
|
if (headerMt.isValid()) {
|
||||||
foreach (const QString &suffix, headerMt.suffixes())
|
foreach (const QString &suffix, headerMt.suffixes())
|
||||||
m_ui->headerSuffixComboBox->addItem(suffix);
|
m_ui->headerSuffixComboBox->addItem(suffix);
|
||||||
|
}
|
||||||
m_ui->licenseTemplatePathChooser->setExpectedKind(Utils::PathChooser::File);
|
m_ui->licenseTemplatePathChooser->setExpectedKind(Utils::PathChooser::File);
|
||||||
m_ui->licenseTemplatePathChooser->setHistoryCompleter(QLatin1String("Cpp.LicenseTemplate.History"));
|
m_ui->licenseTemplatePathChooser->setHistoryCompleter(QLatin1String("Cpp.LicenseTemplate.History"));
|
||||||
m_ui->licenseTemplatePathChooser->addButton(tr("Edit..."), this, SLOT(slotEdit()));
|
m_ui->licenseTemplatePathChooser->addButton(tr("Edit..."), this, SLOT(slotEdit()));
|
||||||
|
@@ -33,7 +33,8 @@
|
|||||||
#include "cpptoolsconstants.h"
|
#include "cpptoolsconstants.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
#
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
@@ -51,11 +52,11 @@ ProjectFile::ProjectFile(const QString &file, Kind kind)
|
|||||||
|
|
||||||
ProjectFile::Kind ProjectFile::classify(const QString &file)
|
ProjectFile::Kind ProjectFile::classify(const QString &file)
|
||||||
{
|
{
|
||||||
const QFileInfo fi(file);
|
Utils::MimeDatabase mdb;
|
||||||
const Core::MimeType mimeType = Core::MimeDatabase::findByFile(fi);
|
const Utils::MimeType mimeType = mdb.mimeTypeForFile(file);
|
||||||
if (!mimeType)
|
if (!mimeType.isValid())
|
||||||
return Unclassified;
|
return Unclassified;
|
||||||
const QString mt = mimeType.type();
|
const QString mt = mimeType.name();
|
||||||
if (mt == QLatin1String(CppTools::Constants::C_SOURCE_MIMETYPE))
|
if (mt == QLatin1String(CppTools::Constants::C_SOURCE_MIMETYPE))
|
||||||
return CSource;
|
return CSource;
|
||||||
if (mt == QLatin1String(CppTools::Constants::C_HEADER_MIMETYPE))
|
if (mt == QLatin1String(CppTools::Constants::C_HEADER_MIMETYPE))
|
||||||
@@ -141,20 +142,22 @@ ProjectFileAdder::~ProjectFileAdder()
|
|||||||
|
|
||||||
bool ProjectFileAdder::maybeAdd(const QString &path)
|
bool ProjectFileAdder::maybeAdd(const QString &path)
|
||||||
{
|
{
|
||||||
m_fileInfo.setFile(path);
|
const Utils::MimeType mt = Utils::MimeDatabase::bestMatch(path, m_mimeTypes);
|
||||||
foreach (const Pair &pair, m_mapping)
|
if (mt.isValid()) {
|
||||||
if (pair.first.matchesFile(path)) {
|
m_files << ProjectFile(path, m_mimeNameMapping.value(mt.name()));
|
||||||
m_files << ProjectFile(path, pair.second);
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFileAdder::addMapping(const char *mimeName, ProjectFile::Kind kind)
|
void ProjectFileAdder::addMapping(const char *mimeName, ProjectFile::Kind kind)
|
||||||
{
|
{
|
||||||
Core::MimeType mimeType = Core::MimeDatabase::findByType(QLatin1String(mimeName));
|
Utils::MimeDatabase mdb;
|
||||||
if (!mimeType.isNull())
|
Utils::MimeType mimeType = mdb.mimeTypeForName(QLatin1String(mimeName));
|
||||||
m_mapping.append(Pair(mimeType, kind));
|
if (mimeType.isValid()) {
|
||||||
|
m_mimeNameMapping.insert(mimeType.name(), kind);
|
||||||
|
m_mimeTypes.append(mimeType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -33,8 +33,10 @@
|
|||||||
|
|
||||||
#include "cpptools_global.h"
|
#include "cpptools_global.h"
|
||||||
|
|
||||||
#include <coreplugin/mimedatabase.h>
|
#include <utils/mimetypes/mimetype.h>
|
||||||
|
|
||||||
|
#include <QHash>
|
||||||
|
#include <QList>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
@@ -81,13 +83,12 @@ public:
|
|||||||
bool maybeAdd(const QString &path);
|
bool maybeAdd(const QString &path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef QPair<Core::MimeType, ProjectFile::Kind> Pair;
|
|
||||||
|
|
||||||
void addMapping(const char *mimeName, ProjectFile::Kind kind);
|
void addMapping(const char *mimeName, ProjectFile::Kind kind);
|
||||||
|
|
||||||
QList<ProjectFile> &m_files;
|
QList<ProjectFile> &m_files;
|
||||||
QList<Pair> m_mapping;
|
QHash<QString, ProjectFile::Kind> m_mimeNameMapping;
|
||||||
QFileInfo m_fileInfo;
|
QList<Utils::MimeType> m_mimeTypes;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -59,6 +59,7 @@
|
|||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/macroexpander.h>
|
#include <utils/macroexpander.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
@@ -270,24 +271,25 @@ static QStringList findFilesInProject(const QString &name,
|
|||||||
// source belonging to a header and vice versa
|
// source belonging to a header and vice versa
|
||||||
static QStringList matchingCandidateSuffixes(ProjectFile::Kind kind)
|
static QStringList matchingCandidateSuffixes(ProjectFile::Kind kind)
|
||||||
{
|
{
|
||||||
|
Utils::MimeDatabase mdb;
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
// Note that C/C++ headers are undistinguishable
|
// Note that C/C++ headers are undistinguishable
|
||||||
case ProjectFile::CHeader:
|
case ProjectFile::CHeader:
|
||||||
case ProjectFile::CXXHeader:
|
case ProjectFile::CXXHeader:
|
||||||
case ProjectFile::ObjCHeader:
|
case ProjectFile::ObjCHeader:
|
||||||
case ProjectFile::ObjCXXHeader:
|
case ProjectFile::ObjCXXHeader:
|
||||||
return MimeDatabase::findByType(QLatin1String(Constants::C_SOURCE_MIMETYPE)).suffixes()
|
return mdb.mimeTypeForName(QLatin1String(Constants::C_SOURCE_MIMETYPE)).suffixes()
|
||||||
+ MimeDatabase::findByType(QLatin1String(Constants::CPP_SOURCE_MIMETYPE)).suffixes()
|
+ mdb.mimeTypeForName(QLatin1String(Constants::CPP_SOURCE_MIMETYPE)).suffixes()
|
||||||
+ MimeDatabase::findByType(QLatin1String(Constants::OBJECTIVE_C_SOURCE_MIMETYPE)).suffixes()
|
+ mdb.mimeTypeForName(QLatin1String(Constants::OBJECTIVE_C_SOURCE_MIMETYPE)).suffixes()
|
||||||
+ MimeDatabase::findByType(QLatin1String(Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE)).suffixes();
|
+ mdb.mimeTypeForName(QLatin1String(Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE)).suffixes();
|
||||||
case ProjectFile::CSource:
|
case ProjectFile::CSource:
|
||||||
case ProjectFile::ObjCSource:
|
case ProjectFile::ObjCSource:
|
||||||
return MimeDatabase::findByType(QLatin1String(Constants::C_HEADER_MIMETYPE)).suffixes();
|
return mdb.mimeTypeForName(QLatin1String(Constants::C_HEADER_MIMETYPE)).suffixes();
|
||||||
case ProjectFile::CXXSource:
|
case ProjectFile::CXXSource:
|
||||||
case ProjectFile::ObjCXXSource:
|
case ProjectFile::ObjCXXSource:
|
||||||
case ProjectFile::CudaSource:
|
case ProjectFile::CudaSource:
|
||||||
case ProjectFile::OpenCLSource:
|
case ProjectFile::OpenCLSource:
|
||||||
return MimeDatabase::findByType(QLatin1String(Constants::CPP_HEADER_MIMETYPE)).suffixes();
|
return mdb.mimeTypeForName(QLatin1String(Constants::CPP_HEADER_MIMETYPE)).suffixes();
|
||||||
default:
|
default:
|
||||||
return QStringList();
|
return QStringList();
|
||||||
}
|
}
|
||||||
|
@@ -52,7 +52,6 @@
|
|||||||
#include <coreplugin/documentmanager.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
#include <coreplugin/messagebox.h>
|
#include <coreplugin/messagebox.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
#include <coreplugin/actionmanager/command.h>
|
#include <coreplugin/actionmanager/command.h>
|
||||||
@@ -60,8 +59,9 @@
|
|||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/locator/commandlocator.h>
|
#include <coreplugin/locator/commandlocator.h>
|
||||||
#include <coreplugin/vcsmanager.h>
|
#include <coreplugin/vcsmanager.h>
|
||||||
#include <utils/stringutils.h>
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
#include <utils/stringutils.h>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
@@ -230,7 +230,8 @@ static const VcsBaseSubmitEditorParameters submitParameters = {
|
|||||||
|
|
||||||
bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||||
{
|
{
|
||||||
Q_UNUSED(arguments);
|
Q_UNUSED(arguments)
|
||||||
|
Q_UNUSED(errorMessage)
|
||||||
using namespace Constants;
|
using namespace Constants;
|
||||||
using namespace Core::Constants;
|
using namespace Core::Constants;
|
||||||
|
|
||||||
@@ -240,8 +241,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
|||||||
|
|
||||||
m_cvsPluginInstance = this;
|
m_cvsPluginInstance = this;
|
||||||
|
|
||||||
if (!MimeDatabase::addMimeTypes(QLatin1String(":/trolltech.cvs/CVS.mimetypes.xml"), errorMessage))
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":/trolltech.cvs/CVS.mimetypes.xml"));
|
||||||
return false;
|
|
||||||
|
|
||||||
m_settings.readSettings(ICore::settings());
|
m_settings.readSettings(ICore::settings());
|
||||||
m_client = new CvsClient(&m_settings);
|
m_client = new CvsClient(&m_settings);
|
||||||
|
14
src/plugins/debugger/Debugger.mimetypes.xml
Normal file
14
src/plugins/debugger/Debugger.mimetypes.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
||||||
|
<mime-type type="text/x-asm">
|
||||||
|
<sub-class-of type="text/plain"/>
|
||||||
|
<comment>Assembler</comment>
|
||||||
|
<glob pattern="*.asm"/>
|
||||||
|
</mime-type>
|
||||||
|
<!-- Catch-all for assemblers -->
|
||||||
|
<mime-type type="text/x-qtcreator-generic-asm">
|
||||||
|
<sub-class-of type="text/x-asm"/>
|
||||||
|
<comment>Qt Creator Generic Assembler</comment>
|
||||||
|
<glob pattern="*.asm"/>
|
||||||
|
</mime-type>
|
||||||
|
</mime-info>
|
@@ -38,5 +38,6 @@
|
|||||||
<file>images/qml/apply-on-save.png</file>
|
<file>images/qml/apply-on-save.png</file>
|
||||||
<file>images/debugger_restart.png</file>
|
<file>images/debugger_restart.png</file>
|
||||||
<file>images/debugger_restart_small.png</file>
|
<file>images/debugger_restart_small.png</file>
|
||||||
|
<file>Debugger.mimetypes.xml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@@ -106,6 +106,7 @@
|
|||||||
|
|
||||||
#include <utils/basetreeview.h>
|
#include <utils/basetreeview.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/proxyaction.h>
|
#include <utils/proxyaction.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/savedaction.h>
|
#include <utils/savedaction.h>
|
||||||
@@ -1269,6 +1270,8 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
|
|||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
Q_UNUSED(errorMessage);
|
Q_UNUSED(errorMessage);
|
||||||
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":/debugger/Debugger.mimetypes.xml"));
|
||||||
|
|
||||||
m_arguments = arguments;
|
m_arguments = arguments;
|
||||||
if (!m_arguments.isEmpty())
|
if (!m_arguments.isEmpty())
|
||||||
connect(KitManager::instance(), &KitManager::kitsLoaded,
|
connect(KitManager::instance(), &KitManager::kitsLoaded,
|
||||||
|
@@ -41,11 +41,11 @@
|
|||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
|
|
||||||
#include <texteditor/textdocument.h>
|
#include <texteditor/textdocument.h>
|
||||||
#include <texteditor/texteditor.h>
|
#include <texteditor/texteditor.h>
|
||||||
|
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QTextBlock>
|
#include <QTextBlock>
|
||||||
@@ -237,8 +237,9 @@ void DisassemblerAgentPrivate::configureMimeType()
|
|||||||
|
|
||||||
document->setMimeType(mimeType);
|
document->setMimeType(mimeType);
|
||||||
|
|
||||||
MimeType mtype = MimeDatabase::findByType(mimeType);
|
Utils::MimeDatabase mdb;
|
||||||
if (mtype) {
|
Utils::MimeType mtype = mdb.mimeTypeForName(mimeType);
|
||||||
|
if (mtype.isValid()) {
|
||||||
foreach (IEditor *editor, DocumentModel::editorsForDocument(document))
|
foreach (IEditor *editor, DocumentModel::editorsForDocument(document))
|
||||||
if (TextEditorWidget *widget = qobject_cast<TextEditorWidget *>(editor->widget()))
|
if (TextEditorWidget *widget = qobject_cast<TextEditorWidget *>(editor->widget()))
|
||||||
widget->configureGenericHighlighter();
|
widget->configureGenericHighlighter();
|
||||||
|
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
|
||||||
<mime-type type="application/x-designer">
|
|
||||||
<sub-class-of type="application/xml"/>
|
|
||||||
<comment>Qt Designer file</comment>
|
|
||||||
<glob pattern="*.ui"/>
|
|
||||||
</mime-type>
|
|
||||||
</mime-info>
|
|
@@ -35,9 +35,9 @@
|
|||||||
#include <utils/wizard.h>
|
#include <utils/wizard.h>
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <cpptools/cpptoolsconstants.h>
|
#include <cpptools/cpptoolsconstants.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
#
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
@@ -84,8 +84,13 @@ bool FormClassWizardPage::lowercaseHeaderFiles()
|
|||||||
// Set up new class widget from settings
|
// Set up new class widget from settings
|
||||||
void FormClassWizardPage::initFileGenerationSettings()
|
void FormClassWizardPage::initFileGenerationSettings()
|
||||||
{
|
{
|
||||||
m_ui->newClassWidget->setHeaderExtension(Core::MimeDatabase::preferredSuffixByType(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE)));
|
Utils::MimeDatabase mdb;
|
||||||
m_ui->newClassWidget->setSourceExtension(Core::MimeDatabase::preferredSuffixByType(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE)));
|
m_ui->newClassWidget->setHeaderExtension(
|
||||||
|
mdb.mimeTypeForName(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE))
|
||||||
|
.preferredSuffix());
|
||||||
|
m_ui->newClassWidget->setSourceExtension(
|
||||||
|
mdb.mimeTypeForName(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE))
|
||||||
|
.preferredSuffix());
|
||||||
m_ui->newClassWidget->setLowerCaseFiles(lowercaseHeaderFiles());
|
m_ui->newClassWidget->setLowerCaseFiles(lowercaseHeaderFiles());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/formeditor" >
|
<qresource prefix="/formeditor">
|
||||||
<file>images/qt_ui.png</file>
|
<file>images/qt_ui.png</file>
|
||||||
<file>Designer.mimetypes.xml</file>
|
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@@ -45,14 +45,15 @@
|
|||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/designmode.h>
|
#include <coreplugin/designmode.h>
|
||||||
#include <cpptools/cpptoolsconstants.h>
|
#include <cpptools/cpptoolsconstants.h>
|
||||||
#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
|
#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
#
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QFileInfo>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
@@ -80,9 +81,6 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
{
|
{
|
||||||
Q_UNUSED(arguments)
|
Q_UNUSED(arguments)
|
||||||
|
|
||||||
if (!MimeDatabase::addMimeTypes(QLatin1String(":/formeditor/Designer.mimetypes.xml"), error))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
initializeTemplates();
|
initializeTemplates();
|
||||||
|
|
||||||
ProjectExplorer::JsonWizardFactory::registerPageFactory(new Internal::FormPageFactory);
|
ProjectExplorer::JsonWizardFactory::registerPageFactory(new Internal::FormPageFactory);
|
||||||
@@ -162,17 +160,19 @@ static QString otherFile()
|
|||||||
const QString current = currentFile();
|
const QString current = currentFile();
|
||||||
if (current.isEmpty())
|
if (current.isEmpty())
|
||||||
return QString();
|
return QString();
|
||||||
const MimeType currentMimeType = MimeDatabase::findByFile(current);
|
Utils::MimeDatabase mdb;
|
||||||
if (!currentMimeType)
|
const Utils::MimeType currentMimeType = mdb.mimeTypeForFile(current);
|
||||||
|
if (!currentMimeType.isValid())
|
||||||
return QString();
|
return QString();
|
||||||
// Determine potential suffixes of candidate files
|
// Determine potential suffixes of candidate files
|
||||||
// 'ui' -> 'cpp', 'cpp/h' -> 'ui'.
|
// 'ui' -> 'cpp', 'cpp/h' -> 'ui'.
|
||||||
QStringList candidateSuffixes;
|
QStringList candidateSuffixes;
|
||||||
if (currentMimeType.type() == QLatin1String(FORM_MIMETYPE)) {
|
if (currentMimeType.matchesName(QLatin1String(FORM_MIMETYPE))) {
|
||||||
candidateSuffixes += MimeDatabase::findByType(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE)).suffixes();
|
candidateSuffixes += mdb.mimeTypeForName(
|
||||||
} else if (currentMimeType.type() == QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE)
|
QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE)).suffixes();
|
||||||
|| currentMimeType.type() == QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE)) {
|
} else if (currentMimeType.matchesName(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE))
|
||||||
candidateSuffixes += MimeDatabase::findByType(QLatin1String(FORM_MIMETYPE)).suffixes();
|
|| currentMimeType.matchesName(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE))) {
|
||||||
|
candidateSuffixes += mdb.mimeTypeForName(QLatin1String(FORM_MIMETYPE)).suffixes();
|
||||||
} else {
|
} else {
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,6 @@
|
|||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
#include <coreplugin/modemanager.h>
|
#include <coreplugin/modemanager.h>
|
||||||
#include <coreplugin/minisplitter.h>
|
#include <coreplugin/minisplitter.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/outputpane.h>
|
#include <coreplugin/outputpane.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
@@ -45,6 +45,7 @@
|
|||||||
#include <texteditor/texteditor.h>
|
#include <texteditor/texteditor.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QDesignerFormWindowInterface>
|
#include <QDesignerFormWindowInterface>
|
||||||
@@ -641,6 +642,7 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
|
|||||||
void QtCreatorIntegration::slotSyncSettingsToDesigner()
|
void QtCreatorIntegration::slotSyncSettingsToDesigner()
|
||||||
{
|
{
|
||||||
// Set promotion-relevant parameters on integration.
|
// Set promotion-relevant parameters on integration.
|
||||||
setHeaderSuffix(Core::MimeDatabase::preferredSuffixByType(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE)));
|
Utils::MimeDatabase mdb;
|
||||||
|
setHeaderSuffix(mdb.mimeTypeForName(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE)).preferredSuffix());
|
||||||
setHeaderLowercase(FormClassWizardPage::lowercaseHeaderFiles());
|
setHeaderLowercase(FormClassWizardPage::lowercaseHeaderFiles());
|
||||||
}
|
}
|
||||||
|
@@ -56,7 +56,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/minisplitter.h>
|
#include <coreplugin/minisplitter.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/patchtool.h>
|
#include <coreplugin/patchtool.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
@@ -55,7 +55,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/minisplitter.h>
|
#include <coreplugin/minisplitter.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/patchtool.h>
|
#include <coreplugin/patchtool.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
@@ -33,7 +33,6 @@
|
|||||||
#include "genericprojectwizard.h"
|
#include "genericprojectwizard.h"
|
||||||
#include "genericprojectconstants.h"
|
#include "genericprojectconstants.h"
|
||||||
|
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <projectexplorer/selectablefilesmodel.h>
|
#include <projectexplorer/selectablefilesmodel.h>
|
||||||
|
|
||||||
|
@@ -35,12 +35,12 @@
|
|||||||
#include "genericprojectconstants.h"
|
#include "genericprojectconstants.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <projectexplorer/buildinfo.h>
|
#include <projectexplorer/buildinfo.h>
|
||||||
#include <projectexplorer/buildsteplist.h>
|
#include <projectexplorer/buildsteplist.h>
|
||||||
#include <projectexplorer/kitinformation.h>
|
#include <projectexplorer/kitinformation.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/toolchain.h>
|
#include <projectexplorer/toolchain.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/pathchooser.h>
|
#include <utils/pathchooser.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -103,8 +103,10 @@ QList<BuildInfo *> GenericBuildConfigurationFactory::availableBuilds(const Targe
|
|||||||
|
|
||||||
int GenericBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
|
int GenericBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
|
||||||
{
|
{
|
||||||
return (k && Core::MimeDatabase::findByFile(QFileInfo(projectPath))
|
Utils::MimeDatabase mdb;
|
||||||
.matchesType(QLatin1String(Constants::GENERICMIMETYPE))) ? 0 : -1;
|
if (k && mdb.mimeTypeForFile(projectPath).matchesName(QLatin1String(Constants::GENERICMIMETYPE)))
|
||||||
|
return 0;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<BuildInfo *> GenericBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
QList<BuildInfo *> GenericBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
||||||
|
@@ -37,7 +37,6 @@
|
|||||||
#include <coreplugin/documentmanager.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
#include <coreplugin/icontext.h>
|
#include <coreplugin/icontext.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <cpptools/cpptoolsconstants.h>
|
#include <cpptools/cpptoolsconstants.h>
|
||||||
#include <cpptools/cppmodelmanager.h>
|
#include <cpptools/cppmodelmanager.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
@@ -39,7 +39,6 @@
|
|||||||
#include "genericproject.h"
|
#include "genericproject.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
|
|
||||||
@@ -47,6 +46,8 @@
|
|||||||
#include <projectexplorer/projecttree.h>
|
#include <projectexplorer/projecttree.h>
|
||||||
#include <projectexplorer/selectablefilesmodel.h>
|
#include <projectexplorer/selectablefilesmodel.h>
|
||||||
|
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
@@ -62,10 +63,8 @@ GenericProjectPlugin::GenericProjectPlugin()
|
|||||||
|
|
||||||
bool GenericProjectPlugin::initialize(const QStringList &, QString *errorMessage)
|
bool GenericProjectPlugin::initialize(const QStringList &, QString *errorMessage)
|
||||||
{
|
{
|
||||||
const QLatin1String mimetypesXml(":genericproject/GenericProjectManager.mimetypes.xml");
|
Q_UNUSED(errorMessage)
|
||||||
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":genericproject/GenericProjectManager.mimetypes.xml"));
|
||||||
if (!MimeDatabase::addMimeTypes(mimetypesXml, errorMessage))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
addAutoReleasedObject(new Manager);
|
addAutoReleasedObject(new Manager);
|
||||||
addAutoReleasedObject(new ProjectFilesFactory);
|
addAutoReleasedObject(new ProjectFilesFactory);
|
||||||
|
@@ -32,11 +32,11 @@
|
|||||||
#include "filesselectionwizardpage.h"
|
#include "filesselectionwizardpage.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/customwizard/customwizard.h>
|
#include <projectexplorer/customwizard/customwizard.h>
|
||||||
|
|
||||||
#include <utils/filewizardpage.h>
|
#include <utils/filewizardpage.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -156,11 +156,10 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
|
|||||||
const QString configFileName = QFileInfo(dir, projectName + QLatin1String(".config")).absoluteFilePath();
|
const QString configFileName = QFileInfo(dir, projectName + QLatin1String(".config")).absoluteFilePath();
|
||||||
const QStringList paths = wizard->selectedPaths();
|
const QStringList paths = wizard->selectedPaths();
|
||||||
|
|
||||||
Core::MimeType headerTy = Core::MimeDatabase::findByType(QLatin1String("text/x-chdr"));
|
Utils::MimeDatabase mdb;
|
||||||
|
Utils::MimeType headerTy = mdb.mimeTypeForName(QLatin1String("text/x-chdr"));
|
||||||
|
|
||||||
QStringList nameFilters;
|
QStringList nameFilters = headerTy.globPatterns();
|
||||||
foreach (const Core::MimeGlobPattern &gp, headerTy.globPatterns())
|
|
||||||
nameFilters.append(gp.pattern());
|
|
||||||
|
|
||||||
QStringList includePaths;
|
QStringList includePaths;
|
||||||
foreach (const QString &path, paths) {
|
foreach (const QString &path, paths) {
|
||||||
|
@@ -59,11 +59,11 @@
|
|||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
#include <coreplugin/locator/commandlocator.h>
|
#include <coreplugin/locator/commandlocator.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/vcsmanager.h>
|
#include <coreplugin/vcsmanager.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
|
|
||||||
#include <coreplugin/messagebox.h>
|
#include <coreplugin/messagebox.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/parameteraction.h>
|
#include <utils/parameteraction.h>
|
||||||
|
|
||||||
@@ -269,6 +269,7 @@ QAction *GitPlugin::createRepositoryAction(ActionContainer *ac,
|
|||||||
bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||||
{
|
{
|
||||||
Q_UNUSED(arguments)
|
Q_UNUSED(arguments)
|
||||||
|
Q_UNUSED(errorMessage)
|
||||||
|
|
||||||
Context context(Constants::GIT_CONTEXT);
|
Context context(Constants::GIT_CONTEXT);
|
||||||
|
|
||||||
@@ -655,8 +656,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
|||||||
connect(VcsManager::instance(), SIGNAL(repositoryChanged(QString)),
|
connect(VcsManager::instance(), SIGNAL(repositoryChanged(QString)),
|
||||||
this, SLOT(updateBranches(QString)), Qt::QueuedConnection);
|
this, SLOT(updateBranches(QString)), Qt::QueuedConnection);
|
||||||
|
|
||||||
if (!MimeDatabase::addMimeTypes(QLatin1String(RC_GIT_MIME_XML), errorMessage))
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(RC_GIT_MIME_XML));
|
||||||
return false;
|
|
||||||
|
|
||||||
/* "Gerrit" */
|
/* "Gerrit" */
|
||||||
m_gerritPlugin = new Gerrit::Internal::GerritPlugin(this);
|
m_gerritPlugin = new Gerrit::Internal::GerritPlugin(this);
|
||||||
|
@@ -46,12 +46,12 @@
|
|||||||
#include <coreplugin/fileiconprovider.h>
|
#include <coreplugin/fileiconprovider.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/id.h>
|
#include <coreplugin/id.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
#include <texteditor/texteditorconstants.h>
|
#include <texteditor/texteditorconstants.h>
|
||||||
|
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
@@ -122,8 +122,7 @@ GlslEditorPlugin::~GlslEditorPlugin()
|
|||||||
|
|
||||||
bool GlslEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
|
bool GlslEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
|
||||||
{
|
{
|
||||||
if (!MimeDatabase::addMimeTypes(QLatin1String(":/glsleditor/GLSLEditor.mimetypes.xml"), errorMessage))
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":/glsleditor/GLSLEditor.mimetypes.xml"));
|
||||||
return false;
|
|
||||||
|
|
||||||
addAutoReleasedObject(new GlslEditorFactory);
|
addAutoReleasedObject(new GlslEditorFactory);
|
||||||
addAutoReleasedObject(new GlslCompletionAssistProvider);
|
addAutoReleasedObject(new GlslCompletionAssistProvider);
|
||||||
|
@@ -1,70 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
|
||||||
<mime-type type="image/bmp">
|
|
||||||
<sub-class-of type="application/octet-stream"/>
|
|
||||||
<comment>BMP image</comment>
|
|
||||||
<glob pattern="*.bmp"/>
|
|
||||||
</mime-type>
|
|
||||||
<mime-type type="image/gif">
|
|
||||||
<sub-class-of type="application/octet-stream"/>
|
|
||||||
<comment>GIF image</comment>
|
|
||||||
<glob pattern="*.gif"/>
|
|
||||||
</mime-type>
|
|
||||||
<mime-type type="image/x-icon">
|
|
||||||
<sub-class-of type="application/octet-stream"/>
|
|
||||||
<comment>ICO image</comment>
|
|
||||||
<glob pattern="*.ico"/>
|
|
||||||
</mime-type>
|
|
||||||
<mime-type type="image/jpeg">
|
|
||||||
<sub-class-of type="application/octet-stream"/>
|
|
||||||
<comment>JPEG image</comment>
|
|
||||||
<glob pattern="*.jpg"/>
|
|
||||||
<glob pattern="*.jpeg"/>
|
|
||||||
</mime-type>
|
|
||||||
<mime-type type="video/x-mng">
|
|
||||||
<sub-class-of type="application/octet-stream"/>
|
|
||||||
<comment>MNG video</comment>
|
|
||||||
<glob pattern="*.mng"/>
|
|
||||||
</mime-type>
|
|
||||||
<mime-type type="image/x-portable-bitmap">
|
|
||||||
<sub-class-of type="application/octet-stream"/>
|
|
||||||
<comment>PBM image</comment>
|
|
||||||
<glob pattern="*.pbm"/>
|
|
||||||
</mime-type>
|
|
||||||
<mime-type type="image/x-portable-graymap">
|
|
||||||
<sub-class-of type="application/octet-stream"/>
|
|
||||||
<comment>PGM image</comment>
|
|
||||||
<glob pattern="*.pgm"/>
|
|
||||||
</mime-type>
|
|
||||||
<mime-type type="image/png">
|
|
||||||
<sub-class-of type="application/octet-stream"/>
|
|
||||||
<comment>PNG image</comment>
|
|
||||||
<glob pattern="*.png"/>
|
|
||||||
</mime-type>
|
|
||||||
<mime-type type="image/x-portable-pixmap">
|
|
||||||
<sub-class-of type="application/octet-stream"/>
|
|
||||||
<comment>PPM image</comment>
|
|
||||||
<glob pattern="*.ppm"/>
|
|
||||||
</mime-type>
|
|
||||||
<mime-type type="image/svg+xml">
|
|
||||||
<sub-class-of type="application/octet-stream"/>
|
|
||||||
<comment>SVG image</comment>
|
|
||||||
<glob pattern="*.svg"/>
|
|
||||||
</mime-type>
|
|
||||||
<mime-type type="image/tiff">
|
|
||||||
<sub-class-of type="application/octet-stream"/>
|
|
||||||
<comment>TIFF image</comment>
|
|
||||||
<glob pattern="*.tif"/>
|
|
||||||
<glob pattern="*.tiff"/>
|
|
||||||
</mime-type>
|
|
||||||
<mime-type type="image/xbm">
|
|
||||||
<sub-class-of type="application/octet-stream"/>
|
|
||||||
<comment>XBM image</comment>
|
|
||||||
<glob pattern="*.xbm"/>
|
|
||||||
</mime-type>
|
|
||||||
<mime-type type="image/xpm">
|
|
||||||
<sub-class-of type="application/octet-stream"/>
|
|
||||||
<comment>XPM image</comment>
|
|
||||||
<glob pattern="*.xpm"/>
|
|
||||||
</mime-type>
|
|
||||||
</mime-info>
|
|
@@ -1,6 +1,5 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/imageviewer">
|
<qresource prefix="/imageviewer">
|
||||||
<file>ImageViewer.mimetypes.xml</file>
|
|
||||||
<file>images/outline.png</file>
|
<file>images/outline.png</file>
|
||||||
<file>images/zoomin.png</file>
|
<file>images/zoomin.png</file>
|
||||||
<file>images/zoomout.png</file>
|
<file>images/zoomout.png</file>
|
||||||
|
@@ -36,7 +36,6 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/id.h>
|
#include <coreplugin/id.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
@@ -48,9 +47,7 @@ namespace Internal {
|
|||||||
bool ImageViewerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
bool ImageViewerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||||
{
|
{
|
||||||
Q_UNUSED(arguments)
|
Q_UNUSED(arguments)
|
||||||
|
Q_UNUSED(errorMessage)
|
||||||
if (!Core::MimeDatabase::addMimeTypes(QLatin1String(":/imageviewer/ImageViewer.mimetypes.xml"), errorMessage))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
m_factory = new ImageViewerFactory(this);
|
m_factory = new ImageViewerFactory(this);
|
||||||
addAutoReleasedObject(m_factory);
|
addAutoReleasedObject(m_factory);
|
||||||
|
@@ -48,12 +48,12 @@
|
|||||||
#include <coreplugin/documentmanager.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/locator/commandlocator.h>
|
#include <coreplugin/locator/commandlocator.h>
|
||||||
|
#include <utils/fileutils.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
#include <utils/parameteraction.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/synchronousprocess.h>
|
#include <utils/synchronousprocess.h>
|
||||||
#include <utils/parameteraction.h>
|
|
||||||
#include <utils/fileutils.h>
|
|
||||||
#include <vcsbase/basevcseditorfactory.h>
|
#include <vcsbase/basevcseditorfactory.h>
|
||||||
#include <vcsbase/basevcssubmiteditorfactory.h>
|
#include <vcsbase/basevcssubmiteditorfactory.h>
|
||||||
#include <vcsbase/vcsbaseeditor.h>
|
#include <vcsbase/vcsbaseeditor.h>
|
||||||
@@ -221,12 +221,13 @@ static const VcsBaseSubmitEditorParameters submitParameters = {
|
|||||||
|
|
||||||
bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *errorMessage)
|
bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *errorMessage)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(errorMessage)
|
||||||
Context context(PERFORCE_CONTEXT);
|
Context context(PERFORCE_CONTEXT);
|
||||||
|
|
||||||
initializeVcs(new PerforceVersionControl(this), context);
|
initializeVcs(new PerforceVersionControl(this), context);
|
||||||
|
|
||||||
if (!MimeDatabase::addMimeTypes(QLatin1String(":/trolltech.perforce/Perforce.mimetypes.xml"), errorMessage))
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":/trolltech.perforce/Perforce.mimetypes.xml"));
|
||||||
return false;
|
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
|
|
||||||
m_settings.fromSettings(ICore::settings());
|
m_settings.fromSettings(ICore::settings());
|
||||||
|
@@ -32,10 +32,10 @@
|
|||||||
#include "customwizardpreprocessor.h"
|
#include "customwizardpreprocessor.h"
|
||||||
#include "customwizardscriptgenerator.h"
|
#include "customwizardscriptgenerator.h"
|
||||||
|
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <cpptools/cpptoolsconstants.h>
|
#include <cpptools/cpptoolsconstants.h>
|
||||||
|
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@@ -917,10 +917,13 @@ void CustomWizardContext::reset()
|
|||||||
const QDate currentDate = QDate::currentDate();
|
const QDate currentDate = QDate::currentDate();
|
||||||
const QTime currentTime = QTime::currentTime();
|
const QTime currentTime = QTime::currentTime();
|
||||||
baseReplacements.clear();
|
baseReplacements.clear();
|
||||||
|
Utils::MimeDatabase mdb;
|
||||||
baseReplacements.insert(QLatin1String("CppSourceSuffix"),
|
baseReplacements.insert(QLatin1String("CppSourceSuffix"),
|
||||||
MimeDatabase::preferredSuffixByType(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE)));
|
mdb.mimeTypeForName(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE))
|
||||||
|
.preferredSuffix());
|
||||||
baseReplacements.insert(QLatin1String("CppHeaderSuffix"),
|
baseReplacements.insert(QLatin1String("CppHeaderSuffix"),
|
||||||
MimeDatabase::preferredSuffixByType(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE)));
|
mdb.mimeTypeForName(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE))
|
||||||
|
.preferredSuffix());
|
||||||
baseReplacements.insert(QLatin1String("CurrentDate"),
|
baseReplacements.insert(QLatin1String("CurrentDate"),
|
||||||
currentDate.toString(Qt::ISODate));
|
currentDate.toString(Qt::ISODate));
|
||||||
baseReplacements.insert(QLatin1String("CurrentTime"),
|
baseReplacements.insert(QLatin1String("CurrentTime"),
|
||||||
|
@@ -37,12 +37,12 @@
|
|||||||
#include "../projectexplorer.h"
|
#include "../projectexplorer.h"
|
||||||
|
|
||||||
#include <coreplugin/featureprovider.h>
|
#include <coreplugin/featureprovider.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/macroexpander.h>
|
#include <utils/macroexpander.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
@@ -102,11 +102,12 @@ void JsonKitsPage::setupProjectFiles(const JsonWizard::GeneratorFiles &files)
|
|||||||
if (fi.exists())
|
if (fi.exists())
|
||||||
path = fi.canonicalFilePath();
|
path = fi.canonicalFilePath();
|
||||||
|
|
||||||
Core::MimeType mt = Core::MimeDatabase::findByFile(fi);
|
Utils::MimeDatabase mdb;
|
||||||
if (mt.isNull())
|
Utils::MimeType mt = mdb.mimeTypeForFile(fi);
|
||||||
|
if (!mt.isValid())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto manager = Utils::findOrDefault(managerList, Utils::equal(&IProjectManager::mimeType, mt.type()));
|
auto manager = Utils::findOrDefault(managerList, Utils::equal(&IProjectManager::mimeType, mt.name()));
|
||||||
project = manager ? manager->openProject(path, &errorMessage) : 0;
|
project = manager ? manager->openProject(path, &errorMessage) : 0;
|
||||||
if (project) {
|
if (project) {
|
||||||
if (setupProject(project))
|
if (setupProject(project))
|
||||||
|
@@ -38,7 +38,6 @@
|
|||||||
#include "../projectexplorerconstants.h"
|
#include "../projectexplorerconstants.h"
|
||||||
|
|
||||||
#include <coreplugin/dialogs/promptoverwritedialog.h>
|
#include <coreplugin/dialogs/promptoverwritedialog.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <texteditor/icodestylepreferences.h>
|
#include <texteditor/icodestylepreferences.h>
|
||||||
#include <texteditor/icodestylepreferencesfactory.h>
|
#include <texteditor/icodestylepreferencesfactory.h>
|
||||||
#include <texteditor/indenter.h>
|
#include <texteditor/indenter.h>
|
||||||
@@ -48,6 +47,7 @@
|
|||||||
#include <texteditor/texteditorsettings.h>
|
#include <texteditor/texteditorsettings.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -90,8 +90,8 @@ bool JsonWizardGenerator::formatFile(const JsonWizard *wizard, GeneratedFile *fi
|
|||||||
if (file->isBinary() || file->contents().isEmpty())
|
if (file->isBinary() || file->contents().isEmpty())
|
||||||
return true; // nothing to do
|
return true; // nothing to do
|
||||||
|
|
||||||
MimeType mt = MimeDatabase::findByFile(QFileInfo(file->path()));
|
Utils::MimeDatabase mdb;
|
||||||
Id languageId = TextEditorSettings::languageId(mt.type());
|
Id languageId = TextEditorSettings::languageId(mdb.mimeTypeForFile(file->path()).name());
|
||||||
|
|
||||||
if (!languageId.isValid())
|
if (!languageId.isValid())
|
||||||
return true; // don't modify files like *.ui, *.pro
|
return true; // don't modify files like *.ui, *.pro
|
||||||
|
@@ -111,7 +111,6 @@
|
|||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/documentmanager.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
#include <coreplugin/imode.h>
|
#include <coreplugin/imode.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/modemanager.h>
|
#include <coreplugin/modemanager.h>
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
@@ -128,6 +127,7 @@
|
|||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/macroexpander.h>
|
#include <utils/macroexpander.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/parameteraction.h>
|
#include <utils/parameteraction.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
@@ -1337,7 +1337,7 @@ void ProjectExplorerPlugin::extensionsInitialized()
|
|||||||
QList<IProjectManager*> projectManagers =
|
QList<IProjectManager*> projectManagers =
|
||||||
ExtensionSystem::PluginManager::getObjects<IProjectManager>();
|
ExtensionSystem::PluginManager::getObjects<IProjectManager>();
|
||||||
|
|
||||||
QList<MimeGlobPattern> allGlobPatterns;
|
QStringList allGlobPatterns;
|
||||||
|
|
||||||
const QString filterSeparator = QLatin1String(";;");
|
const QString filterSeparator = QLatin1String(";;");
|
||||||
QStringList filterStrings;
|
QStringList filterStrings;
|
||||||
@@ -1352,10 +1352,11 @@ void ProjectExplorerPlugin::extensionsInitialized()
|
|||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Utils::MimeDatabase mdb;
|
||||||
foreach (IProjectManager *manager, projectManagers) {
|
foreach (IProjectManager *manager, projectManagers) {
|
||||||
const QString mimeType = manager->mimeType();
|
const QString mimeType = manager->mimeType();
|
||||||
factory->addMimeType(mimeType);
|
factory->addMimeType(mimeType);
|
||||||
MimeType mime = MimeDatabase::findByType(mimeType);
|
Utils::MimeType mime = mdb.mimeTypeForName(mimeType);
|
||||||
allGlobPatterns.append(mime.globPatterns());
|
allGlobPatterns.append(mime.globPatterns());
|
||||||
filterStrings.append(mime.filterString());
|
filterStrings.append(mime.filterString());
|
||||||
|
|
||||||
@@ -1364,8 +1365,10 @@ void ProjectExplorerPlugin::extensionsInitialized()
|
|||||||
|
|
||||||
addAutoReleasedObject(factory);
|
addAutoReleasedObject(factory);
|
||||||
|
|
||||||
filterStrings.prepend(MimeType::formatFilterString(
|
QString allProjectsFilter = tr("All Projects");
|
||||||
tr("All Projects"), allGlobPatterns));
|
allProjectsFilter += QLatin1String(" (") + allGlobPatterns.join(QLatin1Char(' '))
|
||||||
|
+ QLatin1Char(')');
|
||||||
|
filterStrings.prepend(allProjectsFilter);
|
||||||
dd->m_projectFilterString = filterStrings.join(filterSeparator);
|
dd->m_projectFilterString = filterStrings.join(filterSeparator);
|
||||||
|
|
||||||
BuildManager::extensionsInitialized();
|
BuildManager::extensionsInitialized();
|
||||||
@@ -1573,10 +1576,12 @@ QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileName
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const MimeType mt = MimeDatabase::findByFile(QFileInfo(fileName))) {
|
Utils::MimeDatabase mdb;
|
||||||
|
Utils::MimeType mt = mdb.mimeTypeForFile(fileName);
|
||||||
|
if (mt.isValid()) {
|
||||||
bool foundProjectManager = false;
|
bool foundProjectManager = false;
|
||||||
foreach (IProjectManager *manager, projectManagers) {
|
foreach (IProjectManager *manager, projectManagers) {
|
||||||
if (manager->mimeType() == mt.type()) {
|
if (mt.matchesName(manager->mimeType())) {
|
||||||
foundProjectManager = true;
|
foundProjectManager = true;
|
||||||
QString tmp;
|
QString tmp;
|
||||||
if (Project *pro = manager->openProject(filePath, &tmp)) {
|
if (Project *pro = manager->openProject(filePath, &tmp)) {
|
||||||
@@ -1598,7 +1603,7 @@ QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileName
|
|||||||
if (!foundProjectManager) {
|
if (!foundProjectManager) {
|
||||||
appendError(errorString, tr("Failed opening project \"%1\": No plugin can open project type \"%2\".")
|
appendError(errorString, tr("Failed opening project \"%1\": No plugin can open project type \"%2\".")
|
||||||
.arg(QDir::toNativeSeparators(fileName))
|
.arg(QDir::toNativeSeparators(fileName))
|
||||||
.arg((mt.type())));
|
.arg(mt.name()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
appendError(errorString, tr("Failed opening project \"%1\": Unknown project type.")
|
appendError(errorString, tr("Failed opening project \"%1\": Unknown project type.")
|
||||||
@@ -1666,11 +1671,13 @@ void ProjectExplorerPlugin::determineSessionToRestoreAtStartup()
|
|||||||
QStringList ProjectExplorerPlugin::projectFileGlobs()
|
QStringList ProjectExplorerPlugin::projectFileGlobs()
|
||||||
{
|
{
|
||||||
QStringList result;
|
QStringList result;
|
||||||
|
Utils::MimeDatabase mdb;
|
||||||
foreach (const IProjectManager *ipm, ExtensionSystem::PluginManager::getObjects<IProjectManager>()) {
|
foreach (const IProjectManager *ipm, ExtensionSystem::PluginManager::getObjects<IProjectManager>()) {
|
||||||
if (const MimeType mimeType = MimeDatabase::findByType(ipm->mimeType())) {
|
Utils::MimeType mimeType = mdb.mimeTypeForName(ipm->mimeType());
|
||||||
const QList<MimeGlobPattern> patterns = mimeType.globPatterns();
|
if (mimeType.isValid()) {
|
||||||
|
const QStringList patterns = mimeType.globPatterns();
|
||||||
if (!patterns.isEmpty())
|
if (!patterns.isEmpty())
|
||||||
result.push_back(patterns.front().pattern());
|
result.append(patterns.front());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -3122,10 +3129,12 @@ ProjectExplorerSettings ProjectExplorerPlugin::projectExplorerSettings()
|
|||||||
QStringList ProjectExplorerPlugin::projectFilePatterns()
|
QStringList ProjectExplorerPlugin::projectFilePatterns()
|
||||||
{
|
{
|
||||||
QStringList patterns;
|
QStringList patterns;
|
||||||
foreach (const IProjectManager *pm, allProjectManagers())
|
Utils::MimeDatabase mdb;
|
||||||
if (const MimeType mt = MimeDatabase::findByType(pm->mimeType()))
|
foreach (const IProjectManager *pm, allProjectManagers()) {
|
||||||
foreach (const MimeGlobPattern &gp, mt.globPatterns())
|
Utils::MimeType mt = mdb.mimeTypeForName(pm->mimeType());
|
||||||
patterns.append(gp.pattern());
|
if (mt.isValid())
|
||||||
|
patterns.append(mt.globPatterns());
|
||||||
|
}
|
||||||
return patterns;
|
return patterns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -171,7 +171,7 @@ const char C_SOURCE_MIMETYPE[] = "text/x-csrc";
|
|||||||
const char C_HEADER_MIMETYPE[] = "text/x-chdr";
|
const char C_HEADER_MIMETYPE[] = "text/x-chdr";
|
||||||
const char CPP_SOURCE_MIMETYPE[] = "text/x-c++src";
|
const char CPP_SOURCE_MIMETYPE[] = "text/x-c++src";
|
||||||
const char CPP_HEADER_MIMETYPE[] = "text/x-c++hdr";
|
const char CPP_HEADER_MIMETYPE[] = "text/x-c++hdr";
|
||||||
const char LINGUIST_MIMETYPE[] = "application/x-linguist";
|
const char LINGUIST_MIMETYPE[] = "text/vnd.trolltech.linguist";
|
||||||
const char FORM_MIMETYPE[] = "application/x-designer";
|
const char FORM_MIMETYPE[] = "application/x-designer";
|
||||||
const char QML_MIMETYPE[] = "application/x-qml"; // separate def also in qmljstoolsconstants.h
|
const char QML_MIMETYPE[] = "application/x-qml"; // separate def also in qmljstoolsconstants.h
|
||||||
const char RESOURCE_MIMETYPE[] = "application/vnd.qt.xml.resource";
|
const char RESOURCE_MIMETYPE[] = "application/vnd.qt.xml.resource";
|
||||||
|
@@ -39,7 +39,6 @@
|
|||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <texteditor/texteditorsettings.h>
|
#include <texteditor/texteditorsettings.h>
|
||||||
#include <texteditor/icodestylepreferences.h>
|
#include <texteditor/icodestylepreferences.h>
|
||||||
#include <texteditor/icodestylepreferencesfactory.h>
|
#include <texteditor/icodestylepreferencesfactory.h>
|
||||||
@@ -48,7 +47,8 @@
|
|||||||
#include <texteditor/storagesettings.h>
|
#include <texteditor/storagesettings.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/editorconfiguration.h>
|
#include <projectexplorer/editorconfiguration.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
#
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
@@ -230,8 +230,8 @@ void ProjectFileWizardExtension::applyCodeStyle(GeneratedFile *file) const
|
|||||||
if (file->isBinary() || file->contents().isEmpty())
|
if (file->isBinary() || file->contents().isEmpty())
|
||||||
return; // nothing to do
|
return; // nothing to do
|
||||||
|
|
||||||
MimeType mt = MimeDatabase::findByFile(QFileInfo(file->path()));
|
Utils::MimeDatabase mdb;
|
||||||
Id languageId = TextEditorSettings::languageId(mt.type());
|
Id languageId = TextEditorSettings::languageId(mdb.mimeTypeForFile(file->path()).name());
|
||||||
|
|
||||||
if (!languageId.isValid())
|
if (!languageId.isValid())
|
||||||
return; // don't modify files like *.ui *.pro
|
return; // don't modify files like *.ui *.pro
|
||||||
|
@@ -34,7 +34,6 @@
|
|||||||
#include "projectexplorerconstants.h"
|
#include "projectexplorerconstants.h"
|
||||||
#include "projecttree.h"
|
#include "projecttree.h"
|
||||||
|
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/fileiconprovider.h>
|
#include <coreplugin/fileiconprovider.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/iversioncontrol.h>
|
#include <coreplugin/iversioncontrol.h>
|
||||||
|
@@ -45,8 +45,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
class QFileInfo;
|
class QFileInfo;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Core { class MimeDatabase; }
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class RunConfiguration;
|
class RunConfiguration;
|
||||||
|
|
||||||
|
@@ -1,10 +1,8 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
||||||
<mime-type type="text/x-python">
|
<mime-type type="text/x-python-gui">
|
||||||
<sub-class-of type="text/plain"/>
|
<sub-class-of type="text/x-python"/>
|
||||||
<comment>Python Source File</comment>
|
<comment>Python source file without console</comment>
|
||||||
<glob pattern="*.py"/>
|
|
||||||
<glob pattern="*.pyw"/>
|
<glob pattern="*.pyw"/>
|
||||||
<glob pattern="*.wsgi"/>
|
|
||||||
</mime-type>
|
</mime-type>
|
||||||
</mime-info>
|
</mime-info>
|
||||||
|
@@ -44,7 +44,6 @@ const char C_EDITOR_DISPLAY_NAME[] =
|
|||||||
* MIME type
|
* MIME type
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
const char C_PY_MIMETYPE[] = "text/x-python";
|
const char C_PY_MIMETYPE[] = "text/x-python";
|
||||||
const char RC_PY_MIME_XML[] = ":/pythoneditor/PythonEditor.mimetypes.xml";
|
|
||||||
const char C_PY_MIME_ICON[] = "text-x-python";
|
const char C_PY_MIME_ICON[] = "text-x-python";
|
||||||
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
|
@@ -35,12 +35,12 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/fileiconprovider.h>
|
#include <coreplugin/fileiconprovider.h>
|
||||||
#include <coreplugin/id.h>
|
#include <coreplugin/id.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <texteditor/texteditorconstants.h>
|
#include <texteditor/texteditorconstants.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@@ -209,9 +209,9 @@ PythonEditorPlugin::~PythonEditorPlugin()
|
|||||||
bool PythonEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
bool PythonEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||||
{
|
{
|
||||||
Q_UNUSED(arguments)
|
Q_UNUSED(arguments)
|
||||||
|
Q_UNUSED(errorMessage)
|
||||||
|
|
||||||
if (!Core::MimeDatabase::addMimeTypes(QLatin1String(RC_PY_MIME_XML), errorMessage))
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":/pythoneditor/PythonEditor.mimetypes.xml"));
|
||||||
return false;
|
|
||||||
|
|
||||||
addAutoReleasedObject(new PythonEditorFactory);
|
addAutoReleasedObject(new PythonEditorFactory);
|
||||||
|
|
||||||
|
@@ -40,7 +40,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/documentmanager.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <projectexplorer/buildsteplist.h>
|
#include <projectexplorer/buildsteplist.h>
|
||||||
#include <projectexplorer/kit.h>
|
#include <projectexplorer/kit.h>
|
||||||
@@ -49,6 +48,7 @@
|
|||||||
#include <projectexplorer/projectmacroexpander.h>
|
#include <projectexplorer/projectmacroexpander.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
#include <projectexplorer/toolchain.h>
|
#include <projectexplorer/toolchain.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@@ -397,8 +397,10 @@ QList<BuildInfo *> QbsBuildConfigurationFactory::availableBuilds(const Target *p
|
|||||||
|
|
||||||
int QbsBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
|
int QbsBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
|
||||||
{
|
{
|
||||||
return (k && Core::MimeDatabase::findByFile(QFileInfo(projectPath))
|
Utils::MimeDatabase mdb;
|
||||||
.matchesType(QLatin1String(Constants::MIME_TYPE))) ? 0 : -1;
|
if (k && mdb.mimeTypeForFile(projectPath).matchesName(QLatin1String(Constants::MIME_TYPE)))
|
||||||
|
return 0;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Utils::FileName defaultBuildDirectory(const QString &projectFilePath, const Kit *k,
|
static Utils::FileName defaultBuildDirectory(const QString &projectFilePath, const Kit *k,
|
||||||
|
@@ -46,7 +46,6 @@
|
|||||||
#include <coreplugin/vcsmanager.h>
|
#include <coreplugin/vcsmanager.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
#include <coreplugin/progressmanager/progressmanager.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <cpptools/cppmodelmanager.h>
|
#include <cpptools/cppmodelmanager.h>
|
||||||
#include <projectexplorer/buildenvironmentwidget.h>
|
#include <projectexplorer/buildenvironmentwidget.h>
|
||||||
#include <projectexplorer/buildmanager.h>
|
#include <projectexplorer/buildmanager.h>
|
||||||
|
@@ -41,7 +41,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/documentmanager.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
|
|
||||||
#include <projectexplorer/buildsteplist.h>
|
#include <projectexplorer/buildsteplist.h>
|
||||||
#include <projectexplorer/kit.h>
|
#include <projectexplorer/kit.h>
|
||||||
@@ -52,6 +51,7 @@
|
|||||||
#include <projectexplorer/toolchainmanager.h>
|
#include <projectexplorer/toolchainmanager.h>
|
||||||
#include <qtsupport/qtkitinformation.h>
|
#include <qtsupport/qtkitinformation.h>
|
||||||
#include <qtsupport/qtversionmanager.h>
|
#include <qtsupport/qtversionmanager.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -687,8 +687,10 @@ QList<BuildInfo *> QmakeBuildConfigurationFactory::availableBuilds(const Target
|
|||||||
|
|
||||||
int QmakeBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
|
int QmakeBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
|
||||||
{
|
{
|
||||||
return (k && Core::MimeDatabase::findByFile(QFileInfo(projectPath))
|
Utils::MimeDatabase mdb;
|
||||||
.matchesType(QLatin1String(Constants::PROFILE_MIMETYPE))) ? 0 : -1;
|
if (k && mdb.mimeTypeForFile(projectPath).matchesName(QLatin1String(Constants::PROFILE_MIMETYPE)))
|
||||||
|
return 0;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<BuildInfo *> QmakeBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
QList<BuildInfo *> QmakeBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
||||||
|
@@ -63,6 +63,7 @@
|
|||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
#include <utils/theme/theme.h>
|
#include <utils/theme/theme.h>
|
||||||
#include <proparser/prowriter.h>
|
#include <proparser/prowriter.h>
|
||||||
@@ -1033,9 +1034,10 @@ bool QmakePriFileNode::addFiles(const QStringList &filePaths, QStringList *notAd
|
|||||||
typedef QMap<QString, QStringList> TypeFileMap;
|
typedef QMap<QString, QStringList> TypeFileMap;
|
||||||
// Split into lists by file type and bulk-add them.
|
// Split into lists by file type and bulk-add them.
|
||||||
TypeFileMap typeFileMap;
|
TypeFileMap typeFileMap;
|
||||||
|
Utils::MimeDatabase mdb;
|
||||||
foreach (const QString &file, filePaths) {
|
foreach (const QString &file, filePaths) {
|
||||||
const Core::MimeType mt = Core::MimeDatabase::findByFile(file);
|
const Utils::MimeType mt = mdb.mimeTypeForFile(file);
|
||||||
typeFileMap[mt.type()] << file;
|
typeFileMap[mt.name()] << file;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList failedFiles;
|
QStringList failedFiles;
|
||||||
@@ -1080,9 +1082,10 @@ bool QmakePriFileNode::removeFiles(const QStringList &filePaths,
|
|||||||
typedef QMap<QString, QStringList> TypeFileMap;
|
typedef QMap<QString, QStringList> TypeFileMap;
|
||||||
// Split into lists by file type and bulk-add them.
|
// Split into lists by file type and bulk-add them.
|
||||||
TypeFileMap typeFileMap;
|
TypeFileMap typeFileMap;
|
||||||
|
Utils::MimeDatabase mdb;
|
||||||
foreach (const QString &file, filePaths) {
|
foreach (const QString &file, filePaths) {
|
||||||
const Core::MimeType mt = Core::MimeDatabase::findByFile(file);
|
const Utils::MimeType mt = mdb.mimeTypeForFile(file);
|
||||||
typeFileMap[mt.type()] << file;
|
typeFileMap[mt.name()] << file;
|
||||||
}
|
}
|
||||||
foreach (const QString &type, typeFileMap.keys()) {
|
foreach (const QString &type, typeFileMap.keys()) {
|
||||||
const QStringList typeFiles = typeFileMap.value(type);
|
const QStringList typeFiles = typeFileMap.value(type);
|
||||||
@@ -1105,13 +1108,14 @@ bool QmakePriFileNode::renameFile(const QString &filePath, const QString &newFil
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool changeProFileOptional = deploysFolder(QFileInfo(filePath).absolutePath());
|
bool changeProFileOptional = deploysFolder(QFileInfo(filePath).absolutePath());
|
||||||
const Core::MimeType mt = Core::MimeDatabase::findByFile(newFilePath);
|
Utils::MimeDatabase mdb;
|
||||||
|
const Utils::MimeType mt = mdb.mimeTypeForFile(newFilePath);
|
||||||
QStringList dummy;
|
QStringList dummy;
|
||||||
|
|
||||||
changeFiles(mt.type(), QStringList() << filePath, &dummy, RemoveFromProFile);
|
changeFiles(mt.name(), QStringList() << filePath, &dummy, RemoveFromProFile);
|
||||||
if (!dummy.isEmpty() && !changeProFileOptional)
|
if (!dummy.isEmpty() && !changeProFileOptional)
|
||||||
return false;
|
return false;
|
||||||
changeFiles(mt.type(), QStringList() << newFilePath, &dummy, AddToProFile);
|
changeFiles(mt.name(), QStringList() << newFilePath, &dummy, AddToProFile);
|
||||||
if (!dummy.isEmpty() && !changeProFileOptional)
|
if (!dummy.isEmpty() && !changeProFileOptional)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
@@ -55,7 +55,6 @@
|
|||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
#include <projectexplorer/projecttree.h>
|
#include <projectexplorer/projecttree.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
@@ -64,6 +63,7 @@
|
|||||||
#include <texteditor/texteditoractionhandler.h>
|
#include <texteditor/texteditoractionhandler.h>
|
||||||
#include <texteditor/texteditorconstants.h>
|
#include <texteditor/texteditorconstants.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/parameteraction.h>
|
#include <utils/parameteraction.h>
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
@@ -94,11 +94,11 @@ QmakeProjectManagerPlugin::~QmakeProjectManagerPlugin()
|
|||||||
bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||||
{
|
{
|
||||||
Q_UNUSED(arguments)
|
Q_UNUSED(arguments)
|
||||||
|
Q_UNUSED(errorMessage)
|
||||||
const Core::Context projectContext(QmakeProjectManager::Constants::PROJECT_ID);
|
const Core::Context projectContext(QmakeProjectManager::Constants::PROJECT_ID);
|
||||||
Core::Context projecTreeContext(ProjectExplorer::Constants::C_PROJECT_TREE);
|
Core::Context projecTreeContext(ProjectExplorer::Constants::C_PROJECT_TREE);
|
||||||
|
|
||||||
if (!Core::MimeDatabase::addMimeTypes(QLatin1String(":qmakeprojectmanager/QmakeProjectManager.mimetypes.xml"), errorMessage))
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":qmakeprojectmanager/QmakeProjectManager.mimetypes.xml"));
|
||||||
return false;
|
|
||||||
|
|
||||||
//create and register objects
|
//create and register objects
|
||||||
m_qmakeProjectManager = new QmakeManager;
|
m_qmakeProjectManager = new QmakeManager;
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
<alias type="text/x-qml"/>
|
<alias type="text/x-qml"/>
|
||||||
<sub-class-of type="text/plain"/>
|
<sub-class-of type="text/plain"/>
|
||||||
<comment>QML file</comment>
|
<comment>QML file</comment>
|
||||||
<glob weight="50" pattern="*.qml"/>
|
<glob pattern="*.qml"/>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
<mime-type type="application/x-qt.qbs+qml">
|
<mime-type type="application/x-qt.qbs+qml">
|
||||||
<alias type="text/x-qt.qbs+qml"/>
|
<alias type="text/x-qt.qbs+qml"/>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
<alias type="text/x-qt.ui+qml"/>
|
<alias type="text/x-qt.ui+qml"/>
|
||||||
<sub-class-of type="application/x-qml"/>
|
<sub-class-of type="application/x-qml"/>
|
||||||
<comment>QtQuick Designer ui file</comment>
|
<comment>QtQuick Designer ui file</comment>
|
||||||
<glob weight="100" pattern="*.ui.qml"/>
|
<glob pattern="*.ui.qml"/>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
<mime-type type="application/x-qmlproject">
|
<mime-type type="application/x-qmlproject">
|
||||||
<alias type="text/x-qmlproject"/>
|
<alias type="text/x-qmlproject"/>
|
||||||
@@ -30,16 +30,6 @@
|
|||||||
<comment>QML file</comment>
|
<comment>QML file</comment>
|
||||||
<glob pattern="*.qmltypes"/>
|
<glob pattern="*.qmltypes"/>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
<mime-type type="application/javascript">
|
|
||||||
<alias type="application/x-javascript"/>
|
|
||||||
<alias type="text/javascript"/>
|
|
||||||
<alias type="text/x-javascript"/>
|
|
||||||
<sub-class-of type="text/plain"/>
|
|
||||||
<comment>Qt Script file</comment>
|
|
||||||
<glob pattern="*.js"/>
|
|
||||||
<glob pattern="*.qs"/>
|
|
||||||
<glob pattern="*.qtt"/>
|
|
||||||
</mime-type>
|
|
||||||
<mime-type type="application/json">
|
<mime-type type="application/json">
|
||||||
<sub-class-of type="text/plain"/>
|
<sub-class-of type="text/plain"/>
|
||||||
<comment>JSON file</comment>
|
<comment>JSON file</comment>
|
||||||
|
@@ -52,6 +52,7 @@
|
|||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
#include <texteditor/textdocument.h>
|
#include <texteditor/textdocument.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
@@ -76,22 +77,18 @@ ModelManagerInterface::ProjectInfo QmlJSTools::Internal::ModelManager::defaultPr
|
|||||||
ModelManagerInterface::ProjectInfo projectInfo(project);
|
ModelManagerInterface::ProjectInfo projectInfo(project);
|
||||||
ProjectExplorer::Target *activeTarget = 0;
|
ProjectExplorer::Target *activeTarget = 0;
|
||||||
if (project) {
|
if (project) {
|
||||||
QList<MimeGlobPattern> globs;
|
Utils::MimeDatabase mdb;
|
||||||
foreach (const MimeType &mimeType, MimeDatabase::mimeTypes())
|
QList<Utils::MimeType> qmlTypes;
|
||||||
if (mimeType.type() == QLatin1String(Constants::QML_MIMETYPE)
|
foreach (const Utils::MimeType &mimeType, mdb.allMimeTypes()) {
|
||||||
|| mimeType.subClassesOf().contains(QLatin1String(Constants::QML_MIMETYPE)))
|
if (mimeType.matchesName(QLatin1String(Constants::QML_MIMETYPE))
|
||||||
globs << mimeType.globPatterns();
|
|| mimeType.allAncestors().contains(QLatin1String(Constants::QML_MIMETYPE)))
|
||||||
if (globs.isEmpty()) {
|
qmlTypes.append(mimeType);
|
||||||
globs.append(MimeGlobPattern(QLatin1String("*.qbs")));
|
|
||||||
globs.append(MimeGlobPattern(QLatin1String("*.qml")));
|
|
||||||
globs.append(MimeGlobPattern(QLatin1String("*.qmltypes")));
|
|
||||||
globs.append(MimeGlobPattern(QLatin1String("*.qmlproject")));
|
|
||||||
}
|
}
|
||||||
foreach (const QString &filePath,
|
foreach (const QString &filePath,
|
||||||
project->files(ProjectExplorer::Project::ExcludeGeneratedFiles))
|
project->files(ProjectExplorer::Project::ExcludeGeneratedFiles)) {
|
||||||
foreach (const MimeGlobPattern &glob, globs)
|
if (mdb.bestMatch(filePath, qmlTypes).isValid())
|
||||||
if (glob.matches(filePath))
|
projectInfo.sourceFiles << filePath;
|
||||||
projectInfo.sourceFiles << filePath;
|
}
|
||||||
activeTarget = project->activeTarget();
|
activeTarget = project->activeTarget();
|
||||||
}
|
}
|
||||||
ProjectExplorer::Kit *activeKit = activeTarget ? activeTarget->kit() :
|
ProjectExplorer::Kit *activeKit = activeTarget ? activeTarget->kit() :
|
||||||
@@ -179,22 +176,23 @@ QHash<QString,QmlJS::Dialect> ModelManager::languageForSuffix() const
|
|||||||
QHash<QString,QmlJS::Dialect> res = ModelManagerInterface::languageForSuffix();
|
QHash<QString,QmlJS::Dialect> res = ModelManagerInterface::languageForSuffix();
|
||||||
|
|
||||||
if (ICore::instance()) {
|
if (ICore::instance()) {
|
||||||
MimeType jsSourceTy = MimeDatabase::findByType(QLatin1String(Constants::JS_MIMETYPE));
|
Utils::MimeDatabase mdb;
|
||||||
|
Utils::MimeType jsSourceTy = mdb.mimeTypeForName(QLatin1String(Constants::JS_MIMETYPE));
|
||||||
foreach (const QString &suffix, jsSourceTy.suffixes())
|
foreach (const QString &suffix, jsSourceTy.suffixes())
|
||||||
res[suffix] = Dialect::JavaScript;
|
res[suffix] = Dialect::JavaScript;
|
||||||
MimeType qmlSourceTy = MimeDatabase::findByType(QLatin1String(Constants::QML_MIMETYPE));
|
Utils::MimeType qmlSourceTy = mdb.mimeTypeForName(QLatin1String(Constants::QML_MIMETYPE));
|
||||||
foreach (const QString &suffix, qmlSourceTy.suffixes())
|
foreach (const QString &suffix, qmlSourceTy.suffixes())
|
||||||
res[suffix] = Dialect::Qml;
|
res[suffix] = Dialect::Qml;
|
||||||
MimeType qbsSourceTy = MimeDatabase::findByType(QLatin1String(Constants::QBS_MIMETYPE));
|
Utils::MimeType qbsSourceTy = mdb.mimeTypeForName(QLatin1String(Constants::QBS_MIMETYPE));
|
||||||
foreach (const QString &suffix, qbsSourceTy.suffixes())
|
foreach (const QString &suffix, qbsSourceTy.suffixes())
|
||||||
res[suffix] = Dialect::QmlQbs;
|
res[suffix] = Dialect::QmlQbs;
|
||||||
MimeType qmlProjectSourceTy = MimeDatabase::findByType(QLatin1String(Constants::QMLPROJECT_MIMETYPE));
|
Utils::MimeType qmlProjectSourceTy = mdb.mimeTypeForName(QLatin1String(Constants::QMLPROJECT_MIMETYPE));
|
||||||
foreach (const QString &suffix, qmlProjectSourceTy.suffixes())
|
foreach (const QString &suffix, qmlProjectSourceTy.suffixes())
|
||||||
res[suffix] = Dialect::QmlProject;
|
res[suffix] = Dialect::QmlProject;
|
||||||
MimeType qmlUiSourceTy = MimeDatabase::findByType(QLatin1String(Constants::QMLUI_MIMETYPE));
|
Utils::MimeType qmlUiSourceTy = mdb.mimeTypeForName(QLatin1String(Constants::QMLUI_MIMETYPE));
|
||||||
foreach (const QString &suffix, qmlUiSourceTy.suffixes())
|
foreach (const QString &suffix, qmlUiSourceTy.suffixes())
|
||||||
res[suffix] = Dialect::QmlQtQuick2Ui;
|
res[suffix] = Dialect::QmlQtQuick2Ui;
|
||||||
MimeType jsonSourceTy = MimeDatabase::findByType(QLatin1String(Constants::JSON_MIMETYPE));
|
Utils::MimeType jsonSourceTy = mdb.mimeTypeForName(QLatin1String(Constants::JSON_MIMETYPE));
|
||||||
foreach (const QString &suffix, jsonSourceTy.suffixes())
|
foreach (const QString &suffix, jsonSourceTy.suffixes())
|
||||||
res[suffix] = Dialect::Json;
|
res[suffix] = Dialect::Json;
|
||||||
}
|
}
|
||||||
@@ -269,23 +267,6 @@ void ModelManager::updateDefaultProjectInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check whether fileMimeType is the same or extends knownMimeType
|
|
||||||
bool ModelManager::matchesMimeType(const MimeType &fileMimeType, const MimeType &knownMimeType)
|
|
||||||
{
|
|
||||||
const QStringList knownTypeNames = QStringList(knownMimeType.type()) + knownMimeType.aliases();
|
|
||||||
|
|
||||||
foreach (const QString &knownTypeName, knownTypeNames)
|
|
||||||
if (fileMimeType.matchesType(knownTypeName))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// recursion to parent types of fileMimeType
|
|
||||||
foreach (const QString &parentMimeType, fileMimeType.subClassesOf())
|
|
||||||
if (matchesMimeType(MimeDatabase::findByType(parentMimeType), knownMimeType))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModelManager::addTaskInternal(QFuture<void> result, const QString &msg, const char *taskId) const
|
void ModelManager::addTaskInternal(QFuture<void> result, const QString &msg, const char *taskId) const
|
||||||
{
|
{
|
||||||
ProgressManager::addTask(result, msg, taskId);
|
ProgressManager::addTask(result, msg, taskId);
|
||||||
|
@@ -46,7 +46,7 @@
|
|||||||
QT_FORWARD_DECLARE_CLASS(QTimer)
|
QT_FORWARD_DECLARE_CLASS(QTimer)
|
||||||
QT_FORWARD_DECLARE_CLASS(QLocale)
|
QT_FORWARD_DECLARE_CLASS(QLocale)
|
||||||
|
|
||||||
namespace Core { class MimeType; }
|
namespace Utils { class MimeType; }
|
||||||
|
|
||||||
namespace QmlJSTools {
|
namespace QmlJSTools {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -70,7 +70,6 @@ private slots:
|
|||||||
void updateDefaultProjectInfo();
|
void updateDefaultProjectInfo();
|
||||||
private:
|
private:
|
||||||
void loadDefaultQmlTypeDescriptions();
|
void loadDefaultQmlTypeDescriptions();
|
||||||
static bool matchesMimeType(const Core::MimeType &fileMimeType, const Core::MimeType &knownMimeType);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -42,8 +42,8 @@
|
|||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
#include <coreplugin/progressmanager/progressmanager.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
@@ -72,9 +72,9 @@ QmlJSToolsPlugin::~QmlJSToolsPlugin()
|
|||||||
bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
|
bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
|
||||||
{
|
{
|
||||||
Q_UNUSED(arguments)
|
Q_UNUSED(arguments)
|
||||||
|
Q_UNUSED(error)
|
||||||
|
|
||||||
if (!MimeDatabase::addMimeTypes(QLatin1String(":/qmljstools/QmlJSTools.mimetypes.xml"), error))
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":/qmljstools/QmlJSTools.mimetypes.xml"));
|
||||||
return false;
|
|
||||||
|
|
||||||
m_settings = new QmlJSToolsSettings(this); // force registration of qmljstools settings
|
m_settings = new QmlJSToolsSettings(this); // force registration of qmljstools settings
|
||||||
|
|
||||||
|
@@ -37,10 +37,11 @@
|
|||||||
|
|
||||||
#include <coreplugin/fileiconprovider.h>
|
#include <coreplugin/fileiconprovider.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
|
|
||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
|
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@@ -58,18 +59,14 @@ QmlProjectPlugin::~QmlProjectPlugin()
|
|||||||
|
|
||||||
bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage)
|
bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage)
|
||||||
{
|
{
|
||||||
using namespace Core;
|
Q_UNUSED(errorMessage)
|
||||||
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":/qmlproject/QmlProjectManager.mimetypes.xml"));
|
||||||
const QLatin1String mimetypesXml(":/qmlproject/QmlProjectManager.mimetypes.xml");
|
|
||||||
|
|
||||||
if (!MimeDatabase::addMimeTypes(mimetypesXml, errorMessage))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
addAutoReleasedObject(new Internal::Manager);
|
addAutoReleasedObject(new Internal::Manager);
|
||||||
addAutoReleasedObject(new Internal::QmlProjectRunConfigurationFactory);
|
addAutoReleasedObject(new Internal::QmlProjectRunConfigurationFactory);
|
||||||
addAutoReleasedObject(new Internal::QmlApplicationWizard);
|
addAutoReleasedObject(new Internal::QmlApplicationWizard);
|
||||||
|
|
||||||
FileIconProvider::registerIconOverlayForSuffix(":/qmlproject/images/qmlproject.png", "qmlproject");
|
Core::FileIconProvider::registerIconOverlayForSuffix(":/qmlproject/images/qmlproject.png", "qmlproject");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,7 +33,6 @@
|
|||||||
#include "qmlprojectmanagerconstants.h"
|
#include "qmlprojectmanagerconstants.h"
|
||||||
#include "qmlprojectrunconfigurationwidget.h"
|
#include "qmlprojectrunconfigurationwidget.h"
|
||||||
#include "qmlprojectenvironmentaspect.h"
|
#include "qmlprojectenvironmentaspect.h"
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
@@ -43,6 +42,7 @@
|
|||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
#include <utils/winutils.h>
|
#include <utils/winutils.h>
|
||||||
|
|
||||||
@@ -264,22 +264,23 @@ void QmlProjectRunConfiguration::changeCurrentFile(IEditor *editor)
|
|||||||
void QmlProjectRunConfiguration::updateEnabled()
|
void QmlProjectRunConfiguration::updateEnabled()
|
||||||
{
|
{
|
||||||
bool qmlFileFound = false;
|
bool qmlFileFound = false;
|
||||||
|
Utils::MimeDatabase mdb;
|
||||||
if (mainScriptSource() == FileInEditor) {
|
if (mainScriptSource() == FileInEditor) {
|
||||||
IDocument *document = EditorManager::currentDocument();
|
IDocument *document = EditorManager::currentDocument();
|
||||||
if (document) {
|
if (document) {
|
||||||
m_currentFileFilename = document->filePath().toString();
|
m_currentFileFilename = document->filePath().toString();
|
||||||
if (MimeDatabase::findByFile(mainScript()).type() == QLatin1String("application/x-qml"))
|
if (mdb.mimeTypeForFile(mainScript()).matchesName(QLatin1String("application/x-qml")))
|
||||||
qmlFileFound = true;
|
qmlFileFound = true;
|
||||||
}
|
}
|
||||||
if (!document
|
if (!document
|
||||||
|| MimeDatabase::findByFile(mainScript()).type() == QLatin1String("application/x-qmlproject")) {
|
|| mdb.mimeTypeForFile(mainScript()).matchesName(QLatin1String("application/x-qmlproject"))) {
|
||||||
// find a qml file with lowercase filename. This is slow, but only done
|
// find a qml file with lowercase filename. This is slow, but only done
|
||||||
// in initialization/other border cases.
|
// in initialization/other border cases.
|
||||||
foreach (const QString &filename, target()->project()->files(Project::AllFiles)) {
|
foreach (const QString &filename, target()->project()->files(Project::AllFiles)) {
|
||||||
const QFileInfo fi(filename);
|
const QFileInfo fi(filename);
|
||||||
|
|
||||||
if (!filename.isEmpty() && fi.baseName()[0].isLower()
|
if (!filename.isEmpty() && fi.baseName()[0].isLower()
|
||||||
&& MimeDatabase::findByFile(fi).type() == QLatin1String("application/x-qml"))
|
&& mdb.mimeTypeForFile(fi).matchesName(QLatin1String("application/x-qml")))
|
||||||
{
|
{
|
||||||
m_currentFileFilename = filename;
|
m_currentFileFilename = filename;
|
||||||
qmlFileFound = true;
|
qmlFileFound = true;
|
||||||
|
11
src/plugins/qnx/Qnx.mimetypes.xml
Normal file
11
src/plugins/qnx/Qnx.mimetypes.xml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
||||||
|
<mime-type type="application/vnd.rim.qnx.bar_descriptor">
|
||||||
|
<comment>BAR descriptor file (BlackBerry)</comment>
|
||||||
|
<sub-class-of type="application/xml"/>
|
||||||
|
<glob pattern="*.xml"/>
|
||||||
|
<magic>
|
||||||
|
<match value="<qnx>" type="string" offset="0:1000"/>
|
||||||
|
</magic>
|
||||||
|
</mime-type>
|
||||||
|
</mime-info>
|
@@ -1,56 +0,0 @@
|
|||||||
/**************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
|
||||||
**
|
|
||||||
** Contact: BlackBerry (qt@blackberry.com)
|
|
||||||
** Contact: KDAB (info@kdab.com)
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms and
|
|
||||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
|
||||||
** use the contact form at http://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 or version 3 as published by the Free
|
|
||||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
||||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
||||||
** following information to ensure the GNU Lesser General Public License
|
|
||||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
||||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
||||||
** rights. These rights are described in The Qt Company LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "bardescriptormagicmatcher.h"
|
|
||||||
|
|
||||||
#include <QXmlStreamReader>
|
|
||||||
|
|
||||||
using namespace Qnx;
|
|
||||||
using namespace Qnx::Internal;
|
|
||||||
|
|
||||||
BarDescriptorMagicMatcher::BarDescriptorMagicMatcher()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarDescriptorMagicMatcher::matches(const QByteArray &data) const
|
|
||||||
{
|
|
||||||
QXmlStreamReader reader(data);
|
|
||||||
if (reader.readNextStartElement())
|
|
||||||
return reader.name() == QLatin1String("qnx");
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int BarDescriptorMagicMatcher::priority() const
|
|
||||||
{
|
|
||||||
return Core::MimeGlobPattern::MaxWeight;
|
|
||||||
}
|
|
@@ -1,53 +0,0 @@
|
|||||||
/**************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2015 BlackBerry Limited. All rights reserved.
|
|
||||||
**
|
|
||||||
** Contact: BlackBerry (qt@blackberry.com)
|
|
||||||
** Contact: KDAB (info@kdab.com)
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms and
|
|
||||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
|
||||||
** use the contact form at http://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 or version 3 as published by the Free
|
|
||||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
||||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
||||||
** following information to ensure the GNU Lesser General Public License
|
|
||||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
||||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
||||||
** rights. These rights are described in The Qt Company LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef QNX_INTERNAL_BARDESCRIPTORMAGICMATCHER_H
|
|
||||||
#define QNX_INTERNAL_BARDESCRIPTORMAGICMATCHER_H
|
|
||||||
|
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
|
|
||||||
namespace Qnx {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class BarDescriptorMagicMatcher : public Core::IMagicMatcher
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BarDescriptorMagicMatcher();
|
|
||||||
|
|
||||||
bool matches(const QByteArray &data) const;
|
|
||||||
int priority() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Qnx
|
|
||||||
|
|
||||||
#endif // QNX_INTERNAL_BARDESCRIPTORMAGICMATCHER_H
|
|
@@ -50,7 +50,6 @@ SOURCES += qnxplugin.cpp \
|
|||||||
blackberryabstractdeploystep.cpp \
|
blackberryabstractdeploystep.cpp \
|
||||||
blackberryndksettingswidget.cpp \
|
blackberryndksettingswidget.cpp \
|
||||||
blackberryndksettingspage.cpp \
|
blackberryndksettingspage.cpp \
|
||||||
bardescriptormagicmatcher.cpp \
|
|
||||||
bardescriptoreditorfactory.cpp \
|
bardescriptoreditorfactory.cpp \
|
||||||
bardescriptoreditor.cpp \
|
bardescriptoreditor.cpp \
|
||||||
bardescriptoreditorwidget.cpp \
|
bardescriptoreditorwidget.cpp \
|
||||||
@@ -161,7 +160,6 @@ HEADERS += qnxplugin.h\
|
|||||||
blackberryabstractdeploystep.h \
|
blackberryabstractdeploystep.h \
|
||||||
blackberryndksettingswidget.h \
|
blackberryndksettingswidget.h \
|
||||||
blackberryndksettingspage.h \
|
blackberryndksettingspage.h \
|
||||||
bardescriptormagicmatcher.h \
|
|
||||||
bardescriptoreditorfactory.h \
|
bardescriptoreditorfactory.h \
|
||||||
bardescriptoreditor.h \
|
bardescriptoreditor.h \
|
||||||
bardescriptoreditorwidget.h \
|
bardescriptoreditorwidget.h \
|
||||||
|
@@ -4,6 +4,6 @@
|
|||||||
<file>images/target.png</file>
|
<file>images/target.png</file>
|
||||||
<file>images/ok.png</file>
|
<file>images/ok.png</file>
|
||||||
<file>images/qnx-target.png</file>
|
<file>images/qnx-target.png</file>
|
||||||
|
<file>Qnx.mimetypes.xml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/"/>
|
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@@ -51,7 +51,6 @@
|
|||||||
#include "blackberryndksettingspage.h"
|
#include "blackberryndksettingspage.h"
|
||||||
#include "qnxsettingspage.h"
|
#include "qnxsettingspage.h"
|
||||||
#include "bardescriptoreditorfactory.h"
|
#include "bardescriptoreditorfactory.h"
|
||||||
#include "bardescriptormagicmatcher.h"
|
|
||||||
#include "blackberrykeyspage.h"
|
#include "blackberrykeyspage.h"
|
||||||
#include "blackberrycheckdevicestatusstepfactory.h"
|
#include "blackberrycheckdevicestatusstepfactory.h"
|
||||||
#include "blackberrydeviceconnectionmanager.h"
|
#include "blackberrydeviceconnectionmanager.h"
|
||||||
@@ -68,12 +67,12 @@
|
|||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <projectexplorer/kitinformation.h>
|
#include <projectexplorer/kitinformation.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/taskhub.h>
|
#include <projectexplorer/taskhub.h>
|
||||||
#include <projectexplorer/kitmanager.h>
|
#include <projectexplorer/kitmanager.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
@@ -128,19 +127,8 @@ bool QnxPlugin::initialize(const QStringList &arguments, QString *errorString)
|
|||||||
// Handle Qcc Compiler
|
// Handle Qcc Compiler
|
||||||
addAutoReleasedObject(new QnxToolChainFactory);
|
addAutoReleasedObject(new QnxToolChainFactory);
|
||||||
|
|
||||||
// bar-descriptor.xml editor
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":qnx/Qnx.mimetypes.xml"));
|
||||||
Core::MimeGlobPattern barDescriptorGlobPattern(QLatin1String("*.xml"), Core::MimeGlobPattern::MinWeight + 1);
|
|
||||||
Core::MimeType barDescriptorMimeType;
|
|
||||||
barDescriptorMimeType.setType(QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE));
|
|
||||||
barDescriptorMimeType.setComment(tr("BAR descriptor file (BlackBerry)"));
|
|
||||||
barDescriptorMimeType.setGlobPatterns(QList<Core::MimeGlobPattern>() << barDescriptorGlobPattern);
|
|
||||||
barDescriptorMimeType.addMagicMatcher(QSharedPointer<Core::IMagicMatcher>(new BarDescriptorMagicMatcher));
|
|
||||||
barDescriptorMimeType.setSubClassesOf(QStringList() << QLatin1String("application/xml"));
|
|
||||||
|
|
||||||
if (!Core::MimeDatabase::addMimeType(barDescriptorMimeType)) {
|
|
||||||
*errorString = tr("Could not add MIME type for bar-descriptor.xml editor.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
addAutoReleasedObject(new BarDescriptorEditorFactory);
|
addAutoReleasedObject(new BarDescriptorEditorFactory);
|
||||||
|
|
||||||
connect(KitManager::instance(), SIGNAL(kitsLoaded()),
|
connect(KitManager::instance(), SIGNAL(kitsLoaded()),
|
||||||
|
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
|
||||||
<mime-type type="application/x-linguist">
|
|
||||||
<sub-class-of type="application/xml"/>
|
|
||||||
<comment>message catalog</comment>
|
|
||||||
<glob pattern="*.ts"/>
|
|
||||||
</mime-type>
|
|
||||||
</mime-info>
|
|
@@ -8,6 +8,5 @@
|
|||||||
<file>images/dark_qml.png</file>
|
<file>images/dark_qml.png</file>
|
||||||
<file>images/dark_qt_project.png</file>
|
<file>images/dark_qt_project.png</file>
|
||||||
<file>images/dark_qt_qrc.png</file>
|
<file>images/dark_qt_qrc.png</file>
|
||||||
<file>QtSupport.mimetypes.xml</file>
|
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@@ -45,7 +45,6 @@
|
|||||||
#include "profilereader.h"
|
#include "profilereader.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/jsexpander.h>
|
#include <coreplugin/jsexpander.h>
|
||||||
|
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
@@ -70,9 +69,6 @@ bool QtSupportPlugin::initialize(const QStringList &arguments, QString *errorMes
|
|||||||
ProFileEvaluator::initialize();
|
ProFileEvaluator::initialize();
|
||||||
new ProFileCacheManager(this);
|
new ProFileCacheManager(this);
|
||||||
|
|
||||||
if (!MimeDatabase::addMimeTypes(QLatin1String(":qtsupport/QtSupport.mimetypes.xml"), errorMessage))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
JsExpander::registerQObjectForJs(QLatin1String("QtSupport"), new CodeGenerator);
|
JsExpander::registerQObjectForJs(QLatin1String("QtSupport"), new CodeGenerator);
|
||||||
|
|
||||||
addAutoReleasedObject(new QtVersionManager);
|
addAutoReleasedObject(new QtVersionManager);
|
||||||
|
@@ -36,7 +36,6 @@
|
|||||||
#include "resourcenode.h"
|
#include "resourcenode.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/documentmanager.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
#include <coreplugin/id.h>
|
#include <coreplugin/id.h>
|
||||||
@@ -50,6 +49,7 @@
|
|||||||
#include <projectexplorer/projectnodes.h>
|
#include <projectexplorer/projectnodes.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/parameteraction.h>
|
#include <utils/parameteraction.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -124,14 +124,12 @@ ResourceEditorPlugin::ResourceEditorPlugin() :
|
|||||||
bool ResourceEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
bool ResourceEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||||
{
|
{
|
||||||
Q_UNUSED(arguments)
|
Q_UNUSED(arguments)
|
||||||
if (!Core::MimeDatabase::addMimeTypes(QLatin1String(":/resourceeditor/ResourceEditor.mimetypes.xml"), errorMessage))
|
Q_UNUSED(errorMessage)
|
||||||
return false;
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":/resourceeditor/ResourceEditor.mimetypes.xml"));
|
||||||
|
|
||||||
ResourceEditorFactory *editor = new ResourceEditorFactory(this);
|
ResourceEditorFactory *editor = new ResourceEditorFactory(this);
|
||||||
addAutoReleasedObject(editor);
|
addAutoReleasedObject(editor);
|
||||||
|
|
||||||
errorMessage->clear();
|
|
||||||
|
|
||||||
// Register undo and redo
|
// Register undo and redo
|
||||||
const Core::Context context(Constants::C_RESOURCEEDITOR);
|
const Core::Context context(Constants::C_RESOURCEEDITOR);
|
||||||
m_undoAction = new QAction(tr("&Undo"), this);
|
m_undoAction = new QAction(tr("&Undo"), this);
|
||||||
|
@@ -36,10 +36,11 @@
|
|||||||
|
|
||||||
#include <coreplugin/documentmanager.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
#include <coreplugin/fileiconprovider.h>
|
#include <coreplugin/fileiconprovider.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
|
|
||||||
#include <qmljstools/qmljstoolsconstants.h>
|
#include <qmljstools/qmljstoolsconstants.h>
|
||||||
|
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -51,8 +52,8 @@ static bool priority(const QStringList &files)
|
|||||||
{
|
{
|
||||||
if (files.isEmpty())
|
if (files.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
Core::MimeType mt = Core::MimeDatabase::findByFile(files.at(0));
|
Utils::MimeDatabase mdb;
|
||||||
QString type = mt.type();
|
QString type = mdb.mimeTypeForFile(files.at(0)).name();
|
||||||
if (type.startsWith(QLatin1String("image/"))
|
if (type.startsWith(QLatin1String("image/"))
|
||||||
|| type == QLatin1String(QmlJSTools::Constants::QML_MIMETYPE)
|
|| type == QLatin1String(QmlJSTools::Constants::QML_MIMETYPE)
|
||||||
|| type == QLatin1String(QmlJSTools::Constants::JS_MIMETYPE))
|
|| type == QLatin1String(QmlJSTools::Constants::JS_MIMETYPE))
|
||||||
|
@@ -57,10 +57,10 @@
|
|||||||
#include <coreplugin/id.h>
|
#include <coreplugin/id.h>
|
||||||
#include <coreplugin/locator/commandlocator.h>
|
#include <coreplugin/locator/commandlocator.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/parameteraction.h>
|
#include <utils/parameteraction.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/synchronousprocess.h>
|
#include <utils/synchronousprocess.h>
|
||||||
@@ -233,6 +233,7 @@ const VcsBaseSubmitEditorParameters submitParameters = {
|
|||||||
|
|
||||||
bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *errorMessage)
|
bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *errorMessage)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(errorMessage)
|
||||||
using namespace Constants;
|
using namespace Constants;
|
||||||
using namespace Core::Constants;
|
using namespace Core::Constants;
|
||||||
|
|
||||||
@@ -242,8 +243,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
|
|||||||
|
|
||||||
m_subversionPluginInstance = this;
|
m_subversionPluginInstance = this;
|
||||||
|
|
||||||
if (!MimeDatabase::addMimeTypes(QLatin1String(":/trolltech.subversion/Subversion.mimetypes.xml"), errorMessage))
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":/trolltech.subversion/Subversion.mimetypes.xml"));
|
||||||
return false;
|
|
||||||
|
|
||||||
m_settings.readSettings(ICore::settings());
|
m_settings.readSettings(ICore::settings());
|
||||||
m_client = new SubversionClient(&m_settings);
|
m_client = new SubversionClient(&m_settings);
|
||||||
|
@@ -37,12 +37,12 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/idocumentfactory.h>
|
#include <coreplugin/idocumentfactory.h>
|
||||||
#include <coreplugin/documentmanager.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
|
||||||
#include <projectexplorer/projecttree.h>
|
#include <projectexplorer/projecttree.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
#include <projectexplorer/task.h>
|
#include <projectexplorer/task.h>
|
||||||
#include <projectexplorer/taskhub.h>
|
#include <projectexplorer/taskhub.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
@@ -199,12 +199,12 @@ TaskListPlugin::TaskListPlugin()
|
|||||||
bool TaskListPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
bool TaskListPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||||
{
|
{
|
||||||
Q_UNUSED(arguments)
|
Q_UNUSED(arguments)
|
||||||
|
Q_UNUSED(errorMessage)
|
||||||
|
|
||||||
//: Category under which tasklist tasks are listed in Issues view
|
//: Category under which tasklist tasks are listed in Issues view
|
||||||
TaskHub::addCategory(Constants::TASKLISTTASK_ID, tr("My Tasks"));
|
TaskHub::addCategory(Constants::TASKLISTTASK_ID, tr("My Tasks"));
|
||||||
|
|
||||||
if (!MimeDatabase::addMimeTypes(QLatin1String(":tasklist/TaskList.mimetypes.xml"), errorMessage))
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":tasklist/TaskList.mimetypes.xml"));
|
||||||
return false;
|
|
||||||
|
|
||||||
m_fileFactory = new IDocumentFactory;
|
m_fileFactory = new IDocumentFactory;
|
||||||
m_fileFactory->addMimeType(QLatin1String("text/x-tasklist"));
|
m_fileFactory->addMimeType(QLatin1String("text/x-tasklist"));
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user