forked from qt-creator/qt-creator
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:
@@ -3,7 +3,11 @@
|
||||
<mime-type type="text/x-cmake">
|
||||
<sub-class-of type="text/plain"/>
|
||||
<comment>CMake Project file</comment>
|
||||
<glob pattern="CMakeLists.txt"/>
|
||||
<glob pattern="*.cmake"/>
|
||||
</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>
|
||||
|
@@ -140,7 +140,7 @@ QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableBui
|
||||
int CMakeBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const
|
||||
{
|
||||
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,
|
||||
|
@@ -51,6 +51,7 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager)
|
||||
setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID);
|
||||
setDisplayName(tr(CMakeProjectManager::Constants::CMAKE_EDITOR_DISPLAY_NAME));
|
||||
addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE);
|
||||
addMimeType(CMakeProjectManager::Constants::CMAKEPROJECTMIMETYPE);
|
||||
|
||||
new TextEditorActionHandler(this, Constants::C_CMAKEEDITOR,
|
||||
TextEditorActionHandler::UnCommentSelection
|
||||
|
@@ -775,7 +775,7 @@ CMakeFile::CMakeFile(CMakeProject *parent, QString fileName)
|
||||
: Core::IDocument(parent), m_project(parent)
|
||||
{
|
||||
setId("Cmake.ProjectFile");
|
||||
setMimeType(QLatin1String(Constants::CMAKEMIMETYPE));
|
||||
setMimeType(QLatin1String(Constants::CMAKEPROJECTMIMETYPE));
|
||||
setFilePath(fileName);
|
||||
}
|
||||
|
||||
|
@@ -35,6 +35,7 @@ namespace Constants {
|
||||
|
||||
const char PROJECTCONTEXT[] = "CMakeProject.ProjectContext";
|
||||
const char CMAKEMIMETYPE[] = "text/x-cmake";
|
||||
const char CMAKEPROJECTMIMETYPE[] = "text/x-cmake-project";
|
||||
const char CMAKE_EDITOR_ID[] = "CMakeProject.CMakeEditor";
|
||||
const char CMAKE_EDITOR_DISPLAY_NAME[] = "CMake Editor";
|
||||
const char C_CMAKEEDITOR[] = "CMakeProject.Context.CMakeEditor";
|
||||
|
@@ -135,7 +135,7 @@ ProjectExplorer::Project *CMakeManager::openProject(const QString &fileName, QSt
|
||||
|
||||
QString CMakeManager::mimeType() const
|
||||
{
|
||||
return QLatin1String(Constants::CMAKEMIMETYPE);
|
||||
return QLatin1String(Constants::CMAKEPROJECTMIMETYPE);
|
||||
}
|
||||
|
||||
QString CMakeManager::cmakeExecutable() const
|
||||
|
@@ -88,6 +88,7 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
|
||||
hf->setProductType<CMakeHighlighter>();
|
||||
hf->setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID);
|
||||
hf->addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE);
|
||||
hf->addMimeType(CMakeProjectManager::Constants::CMAKEPROJECTMIMETYPE);
|
||||
addAutoReleasedObject(hf);
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user