ProjectExplorer: Move some not-fully-session related bits

... out of SessionManager.

The idea is to later move SessionManager into the Core plugin,
which both is sensible conceptually and also prerequisite to
merge the Bookmark plugin into TextEditor plugin.

Currently, only the interface is split, as the load/save
implemetations are non-mechanical to disentangle.

Change-Id: I31631db3094ea192825a2ccaa6add6188662940b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2023-02-14 15:47:22 +01:00
parent 03e1c18f78
commit 3e7d93c788
170 changed files with 1176 additions and 1040 deletions

View File

@@ -5,15 +5,17 @@
#include "clangtool.h"
#include "clangtoolsdiagnostic.h"
#include "clangtoolsutils.h"
#include <coreplugin/icore.h>
#include <cppeditor/compileroptionsbuilder.h>
#include <cppeditor/projectinfo.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectmanager.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
@@ -55,8 +57,8 @@ public:
WaitForParsedProjects(const FilePaths &projects)
: m_projectsToWaitFor(projects)
{
connect(SessionManager::instance(),
&ProjectExplorer::SessionManager::projectFinishedParsing,
connect(ProjectManager::instance(),
&ProjectExplorer::ProjectManager::projectFinishedParsing,
this, &WaitForParsedProjects::onProjectFinishedParsing);
}
@@ -87,9 +89,9 @@ void PreconfiguredSessionTests::initTestCase()
QSKIP("Session must not be already active.");
// Load session
const FilePaths projects = SessionManager::projectsForSessionName(preconfiguredSessionName);
const FilePaths projects = ProjectManager::projectsForSessionName(preconfiguredSessionName);
WaitForParsedProjects waitForParsedProjects(projects);
QVERIFY(SessionManager::loadSession(preconfiguredSessionName));
QVERIFY(ProjectManager::loadSession(preconfiguredSessionName));
QVERIFY(waitForParsedProjects.wait());
}
@@ -175,7 +177,7 @@ void PreconfiguredSessionTests::testPreconfiguredSession_data()
bool hasAddedTestData = false;
for (Project *project : validProjects(SessionManager::projects())) {
for (Project *project : validProjects(ProjectManager::projects())) {
for (Target *target : validTargets(project)) {
hasAddedTestData = true;
QTest::newRow(dataTagName(project, target)) << project << target;
@@ -189,17 +191,17 @@ void PreconfiguredSessionTests::testPreconfiguredSession_data()
bool PreconfiguredSessionTests::switchToProjectAndTarget(Project *project,
Target *target)
{
Project * const activeProject = SessionManager::startupProject();
Project * const activeProject = ProjectManager::startupProject();
if (project == activeProject && target == activeProject->activeTarget())
return true; // OK, desired project/target already active.
if (project != activeProject)
SessionManager::setStartupProject(project);
ProjectManager::setStartupProject(project);
if (target != project->activeTarget()) {
QSignalSpy spyFinishedParsing(ProjectExplorer::SessionManager::instance(),
&ProjectExplorer::SessionManager::projectFinishedParsing);
SessionManager::setActiveTarget(project, target, ProjectExplorer::SetActive::NoCascade);
QSignalSpy spyFinishedParsing(ProjectExplorer::ProjectManager::instance(),
&ProjectExplorer::ProjectManager::projectFinishedParsing);
project->setActiveTarget(target, ProjectExplorer::SetActive::NoCascade);
QTC_ASSERT(spyFinishedParsing.wait(30000), return false);
const QVariant projectArgument = spyFinishedParsing.takeFirst().constFirst();