QmlJS: Ensure project infos are removed when a project closes.

As a side effect, this removes parse errors of QML files that are no
longer in any project from the "Build Issues" list.

Change-Id: I7aef8850a207ac060648dc92e2dd759108b71731
Reviewed-on: http://codereview.qt.nokia.com/3668
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
Christian Kamm
2011-08-26 13:31:18 +02:00
parent c264f5b23c
commit 650b280b30
3 changed files with 21 additions and 0 deletions

View File

@@ -102,6 +102,12 @@ void ModelManager::delayedInitialization()
connect(cppModelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)),
this, SLOT(maybeQueueCppQmlTypeUpdate(CPlusPlus::Document::Ptr)), Qt::DirectConnection);
}
ProjectExplorer::SessionManager *sessionManager = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
if (sessionManager) {
connect(sessionManager, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
this, SLOT(removeProjectInfo(ProjectExplorer::Project*)));
}
}
void ModelManager::loadQmlTypeDescriptions()
@@ -303,6 +309,19 @@ void ModelManager::updateProjectInfo(const ProjectInfo &pinfo)
emit projectInfoUpdated(pinfo);
}
void ModelManager::removeProjectInfo(ProjectExplorer::Project *project)
{
ProjectInfo info(project);
// update with an empty project info to clear data
updateProjectInfo(info);
{
QMutexLocker locker(&m_mutex);
m_projects.remove(project);
}
}
void ModelManager::emitDocumentChangedOnDisk(Document::Ptr doc)
{ emit documentChangedOnDisk(doc); }