Commit 650b280b authored by Christian Kamm's avatar Christian Kamm
Browse files

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: default avatarFawzi Mohamed <fawzi.mohamed@nokia.com>
parent c264f5b2
......@@ -131,6 +131,7 @@ public:
virtual QList<ProjectInfo> projectInfos() const = 0;
virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const = 0;
virtual void updateProjectInfo(const ProjectInfo &pinfo) = 0;
Q_SLOT virtual void removeProjectInfo(ProjectExplorer::Project *project) = 0;
virtual QStringList importPaths() const = 0;
......
......@@ -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); }
......
......@@ -80,6 +80,7 @@ public:
virtual QList<ProjectInfo> projectInfos() const;
virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const;
virtual void updateProjectInfo(const ProjectInfo &pinfo);
Q_SLOT virtual void removeProjectInfo(ProjectExplorer::Project *project);
void updateDocument(QmlJS::Document::Ptr doc);
void updateLibraryInfo(const QString &path, const QmlJS::LibraryInfo &info);
......
Supports Markdown
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