Commit c70b6895 authored by Ulf Hermann's avatar Ulf Hermann

Unify projectexplorer language IDs

We don't need two IDs for C++ and the QmlJS ID should look the same as
as the others.

Change-Id: Ib9747f6b36a90bb652951d85eec69666615670c4
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 1dd40773
......@@ -77,7 +77,7 @@ AutotoolsProject::AutotoolsProject(AutotoolsManager *manager, const QString &fil
setDocument(new AutotoolsProjectFile(fileName));
setRootProjectNode(new AutotoolsProjectNode(projectDirectory()));
setProjectContext(Core::Context(Constants::PROJECT_CONTEXT));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
const QFileInfo fileInfo = projectFilePath().toFileInfo();
m_projectName = fileInfo.absoluteDir().dirName();
......
......@@ -66,7 +66,7 @@ bool ClangStaticAnalyzerRunControlFactory::canRun(RunConfiguration *runConfigura
Project *project = runConfiguration->target()->project();
QTC_ASSERT(project, return false);
const Core::Context context = project->projectLanguages();
if (!context.contains(ProjectExplorer::Constants::LANG_CXX))
if (!context.contains(ProjectExplorer::Constants::CXX_LANGUAGE_ID))
return false;
Target *target = runConfiguration->target();
......
......@@ -82,7 +82,7 @@ CMakeProject::CMakeProject(CMakeManager *manager, const FileName &fileName)
setRootProjectNode(new CMakeListsNode(fileName));
setProjectContext(Core::Context(CMakeProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
rootProjectNode()->setDisplayName(fileName.parentDir().fileName());
......
......@@ -104,7 +104,7 @@ namespace Internal {
CppEditor::CppEditor()
{
addContext(ProjectExplorer::Constants::LANG_CXX);
addContext(ProjectExplorer::Constants::CXX_LANGUAGE_ID);
}
class CppEditorWidgetPrivate
......
......@@ -130,7 +130,7 @@ QList<Core::Id> BaseProjectPartBuilder::createProjectPartsForFiles(const QString
if (cat.hasParts()) {
// The ProjextExplorer does not distinguish between other versions than C++ and QML.
languages += ProjectExplorer::Constants::LANG_CXX;
languages += ProjectExplorer::Constants::CXX_LANGUAGE_ID;
if (cat.hasCxxSources()) {
createProjectPart(cat.cxxSources(),
......
......@@ -972,7 +972,7 @@ ProjectPart::Ptr CppModelManager::fallbackProjectPart()
bool CppModelManager::isCppEditor(Core::IEditor *editor)
{
return editor->context().contains(ProjectExplorer::Constants::LANG_CXX);
return editor->context().contains(ProjectExplorer::Constants::CXX_LANGUAGE_ID);
}
bool CppModelManager::isClangCodeModelActive() const
......
......@@ -234,7 +234,7 @@ bool DebuggerRunConfigurationAspect::useCppDebugger() const
{
if (d.useCppDebugger == AutoEnabledLanguage)
return runConfiguration()->target()->project()->projectLanguages().contains(
ProjectExplorer::Constants::LANG_CXX);
ProjectExplorer::Constants::CXX_LANGUAGE_ID);
return d.useCppDebugger == EnabledLanguage;
}
......@@ -242,7 +242,7 @@ bool DebuggerRunConfigurationAspect::useQmlDebugger() const
{
if (d.useQmlDebugger == AutoEnabledLanguage) {
const Core::Context languages = runConfiguration()->target()->project()->projectLanguages();
if (!languages.contains(ProjectExplorer::Constants::LANG_QMLJS))
if (!languages.contains(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID))
return false;
//
......@@ -259,7 +259,7 @@ bool DebuggerRunConfigurationAspect::useQmlDebugger() const
}
}
return !languages.contains(ProjectExplorer::Constants::LANG_CXX);
return !languages.contains(ProjectExplorer::Constants::CXX_LANGUAGE_ID);
}
return d.useQmlDebugger == EnabledLanguage;
}
......
......@@ -72,7 +72,7 @@ GenericProject::GenericProject(Manager *manager, const QString &fileName)
setDocument(new GenericProjectFile(this, fileName, GenericProject::Everything));
setRootProjectNode(new GenericProjectNode(this));
setProjectContext(Context(GenericProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguages(Context(ProjectExplorer::Constants::LANG_CXX));
setProjectLanguages(Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
const QFileInfo fileInfo = projectFilePath().toFileInfo();
const QDir dir = fileInfo.dir();
......
......@@ -95,10 +95,6 @@ const char C_PROJECT_TREE[] = "ProjectExplorer.ProjectTreeContext";
const char C_APP_OUTPUT[] = "ProjectExplorer.ApplicationOutput";
const char C_COMPILE_OUTPUT[] = "ProjectExplorer.CompileOutput";
// Languages
const char LANG_CXX[] = "CXX";
const char LANG_QMLJS[] = "QMLJS";
// Menus
const char M_RECENTPROJECTS[] = "ProjectExplorer.Menu.Recent";
const char M_UNLOADPROJECTS[] = "ProjectExplorer.Menu.Unload";
......@@ -214,6 +210,7 @@ const char DEFAULT_DEPLOYCONFIGURATION_ID[] = "ProjectExplorer.DefaultDeployConf
// Keep these short: These constants are exposed to the MacroExplorer!
const char C_LANGUAGE_ID[] = "C";
const char CXX_LANGUAGE_ID[] = "Cxx";
const char QMLJS_LANGUAGE_ID[] = "QMLJS";
// ToolChain TypeIds
const char CLANG_TOOLCHAIN_TYPEID[] = "ProjectExplorer.ToolChain.Clang";
......
......@@ -460,7 +460,7 @@ PythonProject::PythonProject(PythonProjectManager *manager, const QString &fileN
setRootProjectNode(new PythonProjectNode(this));
setProjectContext(Context(PythonProjectContext));
setProjectLanguages(Context(ProjectExplorer::Constants::LANG_CXX));
setProjectLanguages(Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
QFileInfo fileInfo = projectFilePath().toFileInfo();
......
......@@ -135,7 +135,7 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) :
setRootProjectNode(new QbsRootProjectNode(this));
setProjectContext(Context(Constants::PROJECT_ID));
setProjectLanguages(Context(ProjectExplorer::Constants::LANG_CXX));
setProjectLanguages(Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
connect(this, &Project::activeTargetChanged, this, &QbsProject::changeActiveTarget);
connect(this, &Project::addedTarget, this, &QbsProject::targetWasAdded);
......@@ -1137,7 +1137,8 @@ void QbsProject::updateQmlJsCodeModel()
}
}
setProjectLanguage(ProjectExplorer::Constants::LANG_QMLJS, !projectInfo.sourceFiles.isEmpty());
setProjectLanguage(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID,
!projectInfo.sourceFiles.isEmpty());
modelManager->updateProjectInfo(projectInfo, this);
}
......
......@@ -261,7 +261,7 @@ QmakeProject::QmakeProject(QmakeManager *manager, const QString &fileName) :
setProjectManager(manager);
setDocument(new QmakeProjectFile(fileName));
setProjectContext(Core::Context(QmakeProjectManager::Constants::PROJECT_ID));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
setRequiredKitPredicate(QtSupport::QtKitInformation::qtVersionPredicate());
const QTextCodec *codec = Core::EditorManager::defaultTextCodec();
......@@ -478,7 +478,7 @@ void QmakeProject::updateQmlJSCodeModel()
// This assumption fails when there are no QDeclarativeEngine/QDeclarativeView (QtQuick 1)
// or QQmlEngine/QQuickView (QtQuick 2) instances.
if (hasQmlLib)
addProjectLanguage(ProjectExplorer::Constants::LANG_QMLJS);
addProjectLanguage(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID);
projectInfo.activeResourceFiles.removeDuplicates();
projectInfo.allResourceFiles.removeDuplicates();
......
......@@ -541,7 +541,8 @@ bool QMakeStep::fromMap(const QVariantMap &map)
// change the qml_debug CONFIG flag based no the qmake build configuration.
if (map.value(QLatin1String(QMAKE_QMLDEBUGLIBAUTO_KEY), false).toBool()) {
m_linkQmlDebuggingLibrary =
project()->projectLanguages().contains(ProjectExplorer::Constants::LANG_QMLJS) &&
project()->projectLanguages().contains(
ProjectExplorer::Constants::QMLJS_LANGUAGE_ID) &&
(qmakeBuildConfiguration()->qmakeBuildConfiguration() & BaseQtVersion::DebugBuild);
} else {
m_linkQmlDebuggingLibrary = map.value(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), false).toBool();
......
......@@ -246,7 +246,7 @@ void QmlDesignerPlugin::integrateIntoQtCreator(QWidget *modeWidget)
d->context->context().add(qmlDesignerMainContext);
d->context->context().add(qmlDesignerFormEditorContext);
d->context->context().add(qmlDesignerNavigatorContext);
d->context->context().add(ProjectExplorer::Constants::LANG_QMLJS);
d->context->context().add(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID);
d->shortCutManager.registerActions(qmlDesignerMainContext, qmlDesignerFormEditorContext, qmlDesignerNavigatorContext);
......
......@@ -1017,7 +1017,7 @@ QString QmlJSEditorWidget::foldReplacementText(const QTextBlock &block) const
QmlJSEditor::QmlJSEditor()
{
addContext(ProjectExplorer::Constants::LANG_QMLJS);
addContext(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID);
}
bool QmlJSEditor::isDesignModePreferred() const
......
......@@ -257,8 +257,11 @@ ModelManagerInterface::WorkingCopy ModelManager::workingCopyInternal() const
const QString key = document->filePath().toString();
if (TextEditor::TextDocument *textDocument = qobject_cast<TextEditor::TextDocument *>(document)) {
// TODO the language should be a property on the document, not the editor
if (DocumentModel::editorsForDocument(document).first()->context().contains(ProjectExplorer::Constants::LANG_QMLJS))
workingCopy.insert(key, textDocument->plainText(), textDocument->document()->revision());
if (DocumentModel::editorsForDocument(document).first()
->context().contains(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID)) {
workingCopy.insert(key, textDocument->plainText(),
textDocument->document()->revision());
}
}
}
......
......@@ -63,7 +63,7 @@ QmlProject::QmlProject(Internal::Manager *manager, const Utils::FileName &fileNa
setRootProjectNode(new Internal::QmlProjectNode(this));
setProjectContext(Context(QmlProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguages(Context(ProjectExplorer::Constants::LANG_QMLJS));
setProjectLanguages(Context(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID));
m_projectName = projectFilePath().toFileInfo().completeBaseName();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment