forked from qt-creator/qt-creator
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>
This commit is contained in:
committed by
Kai Koehne
parent
0a94329b17
commit
2105115fdf
@@ -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;
|
QList<ProjectExplorer::Project *> projects;
|
||||||
{
|
{
|
||||||
@@ -622,17 +646,7 @@ ModelManagerInterface::ProjectInfo ModelManagerInterface::projectInfoForPath(QSt
|
|||||||
}
|
}
|
||||||
std::sort(infos.begin(), infos.end(), &pInfoLessThanImports);
|
std::sort(infos.begin(), infos.end(), &pInfoLessThanImports);
|
||||||
infos.append(m_defaultProjectInfo);
|
infos.append(m_defaultProjectInfo);
|
||||||
|
return infos;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ModelManagerInterface::isIdle() const
|
bool ModelManagerInterface::isIdle() const
|
||||||
|
|||||||
@@ -177,7 +177,8 @@ public:
|
|||||||
void updateLibraryInfo(const QString &path, const QmlJS::LibraryInfo &info);
|
void updateLibraryInfo(const QString &path, const QmlJS::LibraryInfo &info);
|
||||||
void emitDocumentChangedOnDisk(QmlJS::Document::Ptr doc);
|
void emitDocumentChangedOnDisk(QmlJS::Document::Ptr doc);
|
||||||
void updateQrcFile(const QString &path);
|
void updateQrcFile(const QString &path);
|
||||||
ProjectInfo projectInfoForPath(QString path) const;
|
ProjectInfo projectInfoForPath(const QString &path) const;
|
||||||
|
QList<ProjectInfo> allProjectInfosForPath(const QString &path) const;
|
||||||
bool isIdle() const ;
|
bool isIdle() const ;
|
||||||
|
|
||||||
PathsAndLanguages importPaths() const;
|
PathsAndLanguages importPaths() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user