diff options
author | hjk <hjk@qt.io> | 2017-12-20 11:13:26 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2017-12-20 12:35:14 +0000 |
commit | b2a16190e8e53815ef81c248b96dbe55434d7fb5 (patch) | |
tree | a8a30382c74b81367639e387850e7106d94b8310 | |
parent | bc4efa662c75ad862065058d25a34379330f2ac3 (diff) | |
download | qt-creator-b2a16190e8e53815ef81c248b96dbe55434d7fb5.tar.gz |
Use project id uniformly as project context
The possibly intented flexibility e.g. to have different project types
share the same idea of a common context was never used, in all cases
we had a 1:1 relation ship between project ids and ids that were used
as context. This led to oversights like the one fixed in 60fb35a2.
This patch here uses the project id unconditionally as context and
drops all context ids. If we'll ever have the situation where the
original flexibility was needed, Project::projectContext() could be
made virtual and overridden were needed.
Also, the context was never modified for any given project, so the
updating machinery is not needed.
Change-Id: I3f7fac0ed5e4704e126558987c48577f26082dfd
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
20 files changed, 6 insertions, 36 deletions
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp index 01105d8497..4f80186c33 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp @@ -73,7 +73,6 @@ AutotoolsProject::AutotoolsProject(const Utils::FileName &fileName) : m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this)) { setId(Constants::AUTOTOOLS_PROJECT_ID); - setProjectContext(Core::Context(Constants::PROJECT_CONTEXT)); setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID)); setDisplayName(projectDirectory().fileName()); } diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectconstants.h b/src/plugins/autotoolsprojectmanager/autotoolsprojectconstants.h index d14a9177a0..df084d6b48 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsprojectconstants.h +++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectconstants.h @@ -39,6 +39,5 @@ namespace Constants { //Project const char AUTOTOOLS_PROJECT_ID[] = "AutotoolsProjectManager.AutotoolsProject"; - const char PROJECT_CONTEXT[] = "AutotoolsProject.ProjectContext"; } // namespace Constants } // namespace AutotoolsProjectManager diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index a13c046961..64cf50b6e4 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -84,8 +84,6 @@ CMakeProject::CMakeProject(const FileName &fileName) : Project(Constants::CMAKEM m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this)) { setId(CMakeProjectManager::Constants::CMAKEPROJECT_ID); - - setProjectContext(Core::Context(CMakeProjectManager::Constants::PROJECTCONTEXT)); setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID)); setDisplayName(projectDirectory().fileName()); diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h index 2727612002..bd9be308c3 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h +++ b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h @@ -30,7 +30,6 @@ namespace CMakeProjectManager { 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"; diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index c4db94a689..33255e0c2b 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -62,7 +62,7 @@ CMakeManager::CMakeManager() : Core::ActionContainer *msubproject = Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_SUBPROJECTCONTEXT); - const Core::Context projectContext(CMakeProjectManager::Constants::PROJECTCONTEXT); + const Core::Context projectContext(CMakeProjectManager::Constants::CMAKEPROJECT_ID); const Core::Context globalContext(Core::Constants::C_GLOBAL); Core::Command *command = Core::ActionManager::registerAction(m_runCMakeAction, diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp index 4a13231632..f2e307373a 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp @@ -58,7 +58,7 @@ using namespace ProjectExplorer; bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) { Q_UNUSED(errorMessage) - const Context projectContext(Constants::PROJECTCONTEXT); + const Context projectContext(CMakeProjectManager::Constants::CMAKEPROJECT_ID); Core::FileIconProvider::registerIconOverlayForSuffix(Constants::FILEOVERLAY_CMAKE, "cmake"); Core::FileIconProvider::registerIconOverlayForFilename(Constants::FILEOVERLAY_CMAKE, "CMakeLists.txt"); diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp index b711c7488a..f6b925a3f6 100644 --- a/src/plugins/genericprojectmanager/genericproject.cpp +++ b/src/plugins/genericprojectmanager/genericproject.cpp @@ -166,7 +166,6 @@ GenericProject::GenericProject(const Utils::FileName &fileName) : m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this)) { setId(Constants::GENERICPROJECT_ID); - setProjectContext(Context(GenericProjectManager::Constants::PROJECTCONTEXT)); setProjectLanguages(Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID)); setDisplayName(fileName.toFileInfo().completeBaseName()); diff --git a/src/plugins/genericprojectmanager/genericprojectconstants.h b/src/plugins/genericprojectmanager/genericprojectconstants.h index 84425652ab..be4a1a0fa8 100644 --- a/src/plugins/genericprojectmanager/genericprojectconstants.h +++ b/src/plugins/genericprojectmanager/genericprojectconstants.h @@ -28,7 +28,6 @@ namespace GenericProjectManager { namespace Constants { -const char PROJECTCONTEXT[] = "GenericProject.ProjectContext"; const char GENERICMIMETYPE[] = "text/x-generic-project"; // ### FIXME // Contexts diff --git a/src/plugins/genericprojectmanager/genericprojectplugin.cpp b/src/plugins/genericprojectmanager/genericprojectplugin.cpp index 8cb6c96666..952b3e289a 100644 --- a/src/plugins/genericprojectmanager/genericprojectplugin.cpp +++ b/src/plugins/genericprojectmanager/genericprojectplugin.cpp @@ -73,7 +73,7 @@ bool GenericProjectPlugin::initialize(const QStringList &, QString *errorMessage auto editFilesAction = new QAction(tr("Edit Files..."), this); Command *command = ActionManager::registerAction(editFilesAction, - "GenericProjectManager.EditFiles", Context(Constants::PROJECTCONTEXT)); + "GenericProjectManager.EditFiles", Context(Constants::GENERICPROJECT_ID)); command->setAttribute(Command::CA_Hide); mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_FILES); diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index 913c9d673d..93893fc04f 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -167,7 +167,6 @@ public: QList<Target *> m_targets; Target *m_activeTarget = nullptr; EditorConfiguration m_editorConfiguration; - Core::Context m_projectContext; Core::Context m_projectLanguages; QVariantMap m_pluginSettings; std::unique_ptr<Internal::UserFileAccessor> m_accessor; @@ -743,14 +742,6 @@ bool Project::isKnownFile(const Utils::FileName &filename) const return (it == end) ? false : (*it)->filePath() != filename; } -void Project::setProjectContext(Core::Context context) -{ - if (d->m_projectContext == context) - return; - d->m_projectContext = context; - emit projectContextUpdated(); -} - void Project::setProjectLanguages(Core::Context language) { if (d->m_projectLanguages == language) @@ -791,7 +782,7 @@ void Project::projectLoaded() Core::Context Project::projectContext() const { - return d->m_projectContext; + return Core::Context(d->m_id); } Core::Context Project::projectLanguages() const diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h index c50841648b..4c44aacaaf 100644 --- a/src/plugins/projectexplorer/project.h +++ b/src/plugins/projectexplorer/project.h @@ -210,7 +210,6 @@ signals: void settingsLoaded(); void aboutToSaveSettings(); - void projectContextUpdated(); void projectLanguagesUpdated(); void parsingStarted(); @@ -233,7 +232,6 @@ protected: void setId(Core::Id id); void setRootProjectNode(ProjectNode *root); // takes ownership! - void setProjectContext(Core::Context context); void setProjectLanguages(Core::Context language); void addProjectLanguage(Core::Id id); void removeProjectLanguage(Core::Id id); diff --git a/src/plugins/projectexplorer/projecttree.cpp b/src/plugins/projectexplorer/projecttree.cpp index 16639b9423..cf08af7ca2 100644 --- a/src/plugins/projectexplorer/projecttree.cpp +++ b/src/plugins/projectexplorer/projecttree.cpp @@ -189,8 +189,6 @@ void ProjectTree::setCurrent(Node *node, Project *project) const bool changedProject = project != m_currentProject; if (changedProject) { if (m_currentProject) { - disconnect(m_currentProject, &Project::projectContextUpdated, - this, &ProjectTree::updateContext); disconnect(m_currentProject, &Project::projectLanguagesUpdated, this, &ProjectTree::updateContext); } @@ -198,8 +196,6 @@ void ProjectTree::setCurrent(Node *node, Project *project) m_currentProject = project; if (m_currentProject) { - connect(m_currentProject, &Project::projectContextUpdated, - this, &ProjectTree::updateContext); connect(m_currentProject, &Project::projectLanguagesUpdated, this, &ProjectTree::updateContext); } diff --git a/src/plugins/pythoneditor/pythoneditorplugin.cpp b/src/plugins/pythoneditor/pythoneditorplugin.cpp index 4114a550d2..2ec7f4078f 100644 --- a/src/plugins/pythoneditor/pythoneditorplugin.cpp +++ b/src/plugins/pythoneditor/pythoneditorplugin.cpp @@ -74,7 +74,6 @@ const char InterpreterKey[] = "PythonEditor.RunConfiguation.Interpreter"; const char MainScriptKey[] = "PythonEditor.RunConfiguation.MainScript"; const char PythonMimeType[] = "text/x-python-project"; // ### FIXME const char PythonProjectId[] = "PythonProject"; -const char PythonProjectContext[] = "PythonProjectContext"; class PythonRunConfiguration; class PythonProjectFile; @@ -287,7 +286,6 @@ PythonProject::PythonProject(const FileName &fileName) : Project(Constants::C_PY_MIMETYPE, fileName, [this]() { refresh(); }) { setId(PythonProjectId); - setProjectContext(Context(PythonProjectContext)); setProjectLanguages(Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID)); setDisplayName(fileName.toFileInfo().completeBaseName()); } diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index 7ce2bc145c..d62cbe4bcb 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -131,8 +131,6 @@ QbsProject::QbsProject(const FileName &fileName) : m_parsingDelay.setInterval(1000); // delay parsing by 1s. setId(Constants::PROJECT_ID); - - setProjectContext(Context(Constants::PROJECT_ID)); setProjectLanguages(Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID)); rebuildProjectTree(); diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index 1783e3ea17..aad98fa8ab 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -166,7 +166,6 @@ QmakeProject::QmakeProject(const FileName &fileName) : { s_projects.append(this); setId(Constants::QMAKEPROJECT_ID); - setProjectContext(Core::Context(QmakeProjectManager::Constants::PROJECT_ID)); setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID)); setRequiredKitPredicate(QtSupport::QtKitInformation::qtVersionPredicate()); setDisplayName(fileName.toFileInfo().completeBaseName()); diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerconstants.h b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerconstants.h index 03f3fd368e..71b2bd7a7a 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerconstants.h +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerconstants.h @@ -34,7 +34,6 @@ namespace Constants { const char M_CONTEXT[] = "ProFileEditor.ContextMenu"; // Kinds -const char PROJECT_ID[] = "Qt4.Qt4Project"; const char PROFILE_EDITOR_ID[] = "Qt4.proFileEditor"; const char PROFILE_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("OpenWith::Editors", ".pro File Editor"); const char PROFILE_MIMETYPE[] = "application/vnd.qt.qmakeprofile"; diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp index 8ae76b5390..231be8b971 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp @@ -79,7 +79,7 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString { Q_UNUSED(arguments) Q_UNUSED(errorMessage) - const Context projectContext(QmakeProjectManager::Constants::PROJECT_ID); + const Context projectContext(QmakeProjectManager::Constants::QMAKEPROJECT_ID); Context projecTreeContext(ProjectExplorer::Constants::C_PROJECT_TREE); //create and register objects diff --git a/src/plugins/qmakeprojectmanager/wizards/simpleprojectwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/simpleprojectwizard.cpp index d6bfb86551..a75ab97db0 100644 --- a/src/plugins/qmakeprojectmanager/wizards/simpleprojectwizard.cpp +++ b/src/plugins/qmakeprojectmanager/wizards/simpleprojectwizard.cpp @@ -131,7 +131,7 @@ void FilesSelectionWizardPage::initializePage() SimpleProjectWizard::SimpleProjectWizard() { - setSupportedProjectTypes({Constants::PROJECT_ID}); + setSupportedProjectTypes({Constants::QMAKEPROJECT_ID}); setIcon(QIcon(QLatin1String(":/qmakeprojectmanager/images/qmakeprojectmanager.png"))); setDisplayName(tr("Import as qmake Project (Limited Functionality)")); setId("Z.DummyProFile"); diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp index eb7c98bcaa..6623ab08e8 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.cpp +++ b/src/plugins/qmlprojectmanager/qmlproject.cpp @@ -59,7 +59,6 @@ QmlProject::QmlProject(const Utils::FileName &fileName) : [this]() { refreshProjectFile(); }) { setId(QmlProjectManager::Constants::QML_PROJECT_ID); - setProjectContext(Context(QmlProjectManager::Constants::PROJECTCONTEXT)); setProjectLanguages(Context(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID)); setDisplayName(fileName.toFileInfo().completeBaseName()); } diff --git a/src/plugins/qmlprojectmanager/qmlprojectconstants.h b/src/plugins/qmlprojectmanager/qmlprojectconstants.h index bc2d63cf64..ea6b6b4e79 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectconstants.h +++ b/src/plugins/qmlprojectmanager/qmlprojectconstants.h @@ -30,7 +30,6 @@ namespace QmlProjectManager { namespace Constants { -const char PROJECTCONTEXT[] = "QmlProject.ProjectContext"; const char * const QMLPROJECT_MIMETYPE = QmlJSTools::Constants::QMLPROJECT_MIMETYPE; } // namespace Constants |