Adapt to upstream Session/ProjectManager split

Change-Id: Ia41a0985f95d2274219ea24c518341ac4accc3e8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2023-03-01 17:54:39 +01:00
committed by Christian Kandeler
parent d208ef3e9a
commit 9e223c6bde

View File

@@ -15,14 +15,18 @@
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <projectexplorer/buildsystem.h> #include <projectexplorer/buildsystem.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectmanager.h>
#include <projectexplorer/projectpanelfactory.h> #include <projectexplorer/projectpanelfactory.h>
#include <projectexplorer/session.h>
#include <texteditor/textdocument.h> #include <texteditor/textdocument.h>
#include <texteditor/texteditor.h> #include <texteditor/texteditor.h>
#include <texteditor/textmark.h> #include <texteditor/textmark.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/utilsicons.h> #include <utils/utilsicons.h>
@@ -134,8 +138,8 @@ bool AxivionPlugin::initialize(const QStringList &arguments, QString *errorMessa
return new AxivionProjectSettingsWidget(project); return new AxivionProjectSettingsWidget(project);
}); });
ProjectExplorer::ProjectPanelFactory::registerFactory(panelFactory); ProjectExplorer::ProjectPanelFactory::registerFactory(panelFactory);
connect(ProjectExplorer::SessionManager::instance(), connect(ProjectExplorer::ProjectManager::instance(),
&ProjectExplorer::SessionManager::startupProjectChanged, &ProjectExplorer::ProjectManager::startupProjectChanged,
dd, &AxivionPluginPrivate::onStartupProjectChanged); dd, &AxivionPluginPrivate::onStartupProjectChanged);
connect(Core::EditorManager::instance(), &Core::EditorManager::documentOpened, connect(Core::EditorManager::instance(), &Core::EditorManager::documentOpened,
dd, &AxivionPluginPrivate::onDocumentOpened); dd, &AxivionPluginPrivate::onDocumentOpened);
@@ -198,7 +202,7 @@ AxivionProjectSettings *AxivionPluginPrivate::projectSettings(ProjectExplorer::P
void AxivionPluginPrivate::onStartupProjectChanged() void AxivionPluginPrivate::onStartupProjectChanged()
{ {
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject(); ProjectExplorer::Project *project = ProjectExplorer::ProjectManager::startupProject();
if (!project) { if (!project) {
clearAllMarks(); clearAllMarks();
m_currentProjectInfo = ProjectInfo(); m_currentProjectInfo = ProjectInfo();
@@ -255,14 +259,14 @@ void AxivionPluginPrivate::fetchRuleInfo(const QString &id)
void AxivionPluginPrivate::handleOpenedDocs(ProjectExplorer::Project *project) void AxivionPluginPrivate::handleOpenedDocs(ProjectExplorer::Project *project)
{ {
if (project && ProjectExplorer::SessionManager::startupProject() != project) if (project && ProjectExplorer::ProjectManager::startupProject() != project)
return; return;
const QList<Core::IDocument *> openDocuments = Core::DocumentModel::openedDocuments(); const QList<Core::IDocument *> openDocuments = Core::DocumentModel::openedDocuments();
for (Core::IDocument *doc : openDocuments) for (Core::IDocument *doc : openDocuments)
onDocumentOpened(doc); onDocumentOpened(doc);
if (project) if (project)
disconnect(ProjectExplorer::SessionManager::instance(), disconnect(ProjectExplorer::ProjectManager::instance(),
&ProjectExplorer::SessionManager::projectFinishedParsing, &ProjectExplorer::ProjectManager::projectFinishedParsing,
this, &AxivionPluginPrivate::handleOpenedDocs); this, &AxivionPluginPrivate::handleOpenedDocs);
} }
@@ -288,12 +292,12 @@ void AxivionPluginPrivate::handleProjectInfo(const ProjectInfo &info)
return; return;
// handle already opened documents // handle already opened documents
if (auto buildSystem = ProjectExplorer::SessionManager::startupBuildSystem(); if (auto buildSystem = ProjectExplorer::ProjectManager::startupBuildSystem();
!buildSystem || !buildSystem->isParsing()) { !buildSystem || !buildSystem->isParsing()) {
handleOpenedDocs(nullptr); handleOpenedDocs(nullptr);
} else { } else {
connect(ProjectExplorer::SessionManager::instance(), connect(ProjectExplorer::ProjectManager::instance(),
&ProjectExplorer::SessionManager::projectFinishedParsing, &ProjectExplorer::ProjectManager::projectFinishedParsing,
this, &AxivionPluginPrivate::handleOpenedDocs); this, &AxivionPluginPrivate::handleOpenedDocs);
} }
} }
@@ -303,7 +307,7 @@ void AxivionPluginPrivate::onDocumentOpened(Core::IDocument *doc)
if (m_currentProjectInfo.name.isEmpty()) // we do not have a project info (yet) if (m_currentProjectInfo.name.isEmpty()) // we do not have a project info (yet)
return; return;
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject(); ProjectExplorer::Project *project = ProjectExplorer::ProjectManager::startupProject();
if (!doc || !project->isKnownFile(doc->filePath())) if (!doc || !project->isKnownFile(doc->filePath()))
return; return;
@@ -337,7 +341,7 @@ void AxivionPluginPrivate::handleIssuesForFile(const IssuesList &issues)
if (issues.issues.isEmpty()) if (issues.issues.isEmpty())
return; return;
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject(); ProjectExplorer::Project *project = ProjectExplorer::ProjectManager::startupProject();
if (!project) if (!project)
return; return;