Commit 4d617c81 authored by Tobias Hunger's avatar Tobias Hunger

Session: Remove addProjects(...) method

It is unused. Also remove singleProjectAdded signal, and replace
the only use with the projectAdded signal.

The singleProjectAdded signal was emitted for each project that was
ever added, simply because nobody ever used addProjects(...) with
more than one project.

Change-Id: I5aee315c64a2cfb721471d580989a6a02d44fefc
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent a5a6206e
......@@ -210,7 +210,7 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent) : QWidget(parent)
this, &ProjectTreeWidget::showContextMenu);
SessionManager *sessionManager = SessionManager::instance();
connect(sessionManager, &SessionManager::singleProjectAdded,
connect(sessionManager, &SessionManager::projectAdded,
this, &ProjectTreeWidget::handleProjectAdded);
connect(sessionManager, &SessionManager::startupProjectChanged,
this, &ProjectTreeWidget::startupProjectChanged);
......
......@@ -373,42 +373,25 @@ Project *SessionManager::startupProject()
return d->m_startupProject;
}
void SessionManager::addProject(Project *project)
void SessionManager::addProject(Project *pro)
{
QTC_ASSERT(project, return);
addProjects(QList<Project*>() << project);
}
QTC_ASSERT(pro, return);
void SessionManager::addProjects(const QList<Project*> &projects)
{
d->m_virginSession = false;
QList<Project*> clearedList;
foreach (Project *pro, projects) {
QTC_ASSERT(pro, continue);
if (!d->m_projects.contains(pro)) {
clearedList.append(pro);
d->m_projects.append(pro);
d->m_sessionNode->addProjectNodes(QList<ProjectNode *>() << pro->rootProjectNode());
connect(pro, &Project::fileListChanged,
m_instance, &SessionManager::clearProjectFileCache);
connect(pro, &Project::displayNameChanged,
m_instance, &SessionManager::handleProjectDisplayNameChanged);
}
}
QTC_ASSERT(!d->m_projects.contains(pro), return);
foreach (Project *pro, clearedList) {
emit m_instance->projectAdded(pro);
configureEditors(pro);
connect(pro, &Project::fileListChanged,
[pro](){
configureEditors(pro);
});
}
d->m_projects.append(pro);
d->m_sessionNode->addProjectNodes(QList<ProjectNode *>() << pro->rootProjectNode());
connect(pro, &Project::fileListChanged,
m_instance, &SessionManager::clearProjectFileCache);
connect(pro, &Project::displayNameChanged,
m_instance, &SessionManager::handleProjectDisplayNameChanged);
if (clearedList.count() == 1)
emit m_instance->singleProjectAdded(clearedList.first());
emit m_instance->projectAdded(pro);
configureEditors(pro);
connect(pro, &Project::fileListChanged, [pro](){ configureEditors(pro); });
}
void SessionManager::removeProject(Project *project)
......
......@@ -76,7 +76,6 @@ public:
static void closeAllProjects();
static void addProject(Project *project);
static void addProjects(const QList<Project*> &projects);
static void removeProject(Project *project);
static void removeProjects(QList<Project *> remove);
......@@ -125,7 +124,6 @@ public:
signals:
void projectAdded(ProjectExplorer::Project *project);
void singleProjectAdded(ProjectExplorer::Project *project);
void aboutToRemoveProject(ProjectExplorer::Project *project);
void projectDisplayNameChanged(ProjectExplorer::Project *project);
void projectRemoved(ProjectExplorer::Project *project);
......
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