summaryrefslogtreecommitdiff
path: root/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
diff options
context:
space:
mode:
authorDenis Kormalev <kormalev.denis@gmail.com>2015-04-26 23:59:36 +0300
committerKai Koehne <kai.koehne@theqtcompany.com>2015-05-19 08:00:50 +0000
commit2105115fdf13b37c60ed12cd61f8863c1d461fd0 (patch)
treed0c612a7f0dfdec6a1f1349242fe7ad2e0549e41 /src/libs/qmljs/qmljsmodelmanagerinterface.cpp
parent0a94329b17889bb4d1a0335a639b3d28a8dc17e2 (diff)
downloadqt-creator-2105115fdf13b37c60ed12cd61f8863c1d461fd0.tar.gz
QmlJS: allProjectsInfosForPath method
Method that returns list of all project infos where this file belongs (similar to methods in cpp module). Change-Id: I94eb86ffa5bdbee8d794377a03160418b7340662 Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src/libs/qmljs/qmljsmodelmanagerinterface.cpp')
-rw-r--r--src/libs/qmljs/qmljsmodelmanagerinterface.cpp38
1 files changed, 26 insertions, 12 deletions
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
index 37d2e595c1..1d84dfe015 100644
--- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
+++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
@@ -603,7 +603,31 @@ void ModelManagerInterface::removeProjectInfo(ProjectExplorer::Project *project)
}
}
-ModelManagerInterface::ProjectInfo ModelManagerInterface::projectInfoForPath(QString path) const
+/*!
+ Returns project info with summarized info for \a path
+
+ \note Project pointer will be empty
+ */
+ModelManagerInterface::ProjectInfo ModelManagerInterface::projectInfoForPath(const QString &path) const
+{
+ QList<ProjectInfo> infos = allProjectInfosForPath(path);
+
+ ProjectInfo res;
+ foreach (const ProjectInfo &pInfo, infos) {
+ if (res.qtImportsPath.isEmpty())
+ res.qtImportsPath = pInfo.qtImportsPath;
+ if (res.qtQmlPath.isEmpty())
+ res.qtQmlPath = pInfo.qtQmlPath;
+ for (int i = 0; i < pInfo.importPaths.size(); ++i)
+ res.importPaths.maybeInsert(pInfo.importPaths.at(i));
+ }
+ return res;
+}
+
+/*!
+ Returns list of project infos for \a path
+ */
+QList<ModelManagerInterface::ProjectInfo> ModelManagerInterface::allProjectInfosForPath(const QString &path) const
{
QList<ProjectExplorer::Project *> projects;
{
@@ -622,17 +646,7 @@ ModelManagerInterface::ProjectInfo ModelManagerInterface::projectInfoForPath(QSt
}
std::sort(infos.begin(), infos.end(), &pInfoLessThanImports);
infos.append(m_defaultProjectInfo);
-
- ProjectInfo res;
- foreach (const ProjectInfo &pInfo, infos) {
- if (res.qtImportsPath.isEmpty())
- res.qtImportsPath = pInfo.qtImportsPath;
- if (res.qtQmlPath.isEmpty())
- res.qtQmlPath = pInfo.qtQmlPath;
- for (int i = 0; i < pInfo.importPaths.size(); ++i)
- res.importPaths.maybeInsert(pInfo.importPaths.at(i));
- }
- return res;
+ return infos;
}
bool ModelManagerInterface::isIdle() const