CMakeProject: Make CMakeLists.txt and *.cmake use different mime types

Since we want to treat them differently.

Task-number: QTCREATORBUG-12461
Change-Id: Ia72b8045390ceec693fa416f65010a4c4dbecce1
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Daniel Teske
2014-07-17 15:52:32 +02:00
parent 2de73ceb65
commit b0af82ebc9
7 changed files with 11 additions and 4 deletions

View File

@@ -3,7 +3,11 @@
<mime-type type="text/x-cmake"> <mime-type type="text/x-cmake">
<sub-class-of type="text/plain"/> <sub-class-of type="text/plain"/>
<comment>CMake Project file</comment> <comment>CMake Project file</comment>
<glob pattern="CMakeLists.txt"/>
<glob pattern="*.cmake"/> <glob pattern="*.cmake"/>
</mime-type> </mime-type>
<mime-type type="text/x-cmake-project">
<sub-class-of type="text/plain"/>
<comment>CMake Project file</comment>
<glob pattern="CMakeLists.txt"/>
</mime-type>
</mime-info> </mime-info>

View File

@@ -140,7 +140,7 @@ 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)) return (k && Core::MimeDatabase::findByFile(QFileInfo(projectPath))
.matchesType(QLatin1String(Constants::CMAKEMIMETYPE))) ? 0 : -1; .matchesType(QLatin1String(Constants::CMAKEPROJECTMIMETYPE))) ? 0 : -1;
} }
QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit *k, QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit *k,

View File

@@ -51,6 +51,7 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager)
setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID); setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID);
setDisplayName(tr(CMakeProjectManager::Constants::CMAKE_EDITOR_DISPLAY_NAME)); setDisplayName(tr(CMakeProjectManager::Constants::CMAKE_EDITOR_DISPLAY_NAME));
addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE); addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE);
addMimeType(CMakeProjectManager::Constants::CMAKEPROJECTMIMETYPE);
new TextEditorActionHandler(this, Constants::C_CMAKEEDITOR, new TextEditorActionHandler(this, Constants::C_CMAKEEDITOR,
TextEditorActionHandler::UnCommentSelection TextEditorActionHandler::UnCommentSelection

View File

@@ -775,7 +775,7 @@ CMakeFile::CMakeFile(CMakeProject *parent, QString fileName)
: Core::IDocument(parent), m_project(parent) : Core::IDocument(parent), m_project(parent)
{ {
setId("Cmake.ProjectFile"); setId("Cmake.ProjectFile");
setMimeType(QLatin1String(Constants::CMAKEMIMETYPE)); setMimeType(QLatin1String(Constants::CMAKEPROJECTMIMETYPE));
setFilePath(fileName); setFilePath(fileName);
} }

View File

@@ -35,6 +35,7 @@ namespace Constants {
const char PROJECTCONTEXT[] = "CMakeProject.ProjectContext"; const char PROJECTCONTEXT[] = "CMakeProject.ProjectContext";
const char CMAKEMIMETYPE[] = "text/x-cmake"; const char CMAKEMIMETYPE[] = "text/x-cmake";
const char CMAKEPROJECTMIMETYPE[] = "text/x-cmake-project";
const char CMAKE_EDITOR_ID[] = "CMakeProject.CMakeEditor"; const char CMAKE_EDITOR_ID[] = "CMakeProject.CMakeEditor";
const char CMAKE_EDITOR_DISPLAY_NAME[] = "CMake Editor"; const char CMAKE_EDITOR_DISPLAY_NAME[] = "CMake Editor";
const char C_CMAKEEDITOR[] = "CMakeProject.Context.CMakeEditor"; const char C_CMAKEEDITOR[] = "CMakeProject.Context.CMakeEditor";

View File

@@ -135,7 +135,7 @@ ProjectExplorer::Project *CMakeManager::openProject(const QString &fileName, QSt
QString CMakeManager::mimeType() const QString CMakeManager::mimeType() const
{ {
return QLatin1String(Constants::CMAKEMIMETYPE); return QLatin1String(Constants::CMAKEPROJECTMIMETYPE);
} }
QString CMakeManager::cmakeExecutable() const QString CMakeManager::cmakeExecutable() const

View File

@@ -88,6 +88,7 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
hf->setProductType<CMakeHighlighter>(); hf->setProductType<CMakeHighlighter>();
hf->setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID); hf->setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID);
hf->addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE); hf->addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE);
hf->addMimeType(CMakeProjectManager::Constants::CMAKEPROJECTMIMETYPE);
addAutoReleasedObject(hf); addAutoReleasedObject(hf);
return true; return true;