QQmlCodeModel: split buildPathsForFileUrl() method
Split the buildPathsForFileUrl method into a static helper method. Future commits will use it to add early exits in buildPathsForFileUrl(). Change-Id: Icadb89e8ea04bcf3e07f6b163c2cf9213e7d5945 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
parent
7cd0db124f
commit
bfda4459c6
|
@ -647,6 +647,25 @@ QStringList QQmlCodeModel::importPaths() const
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QStringList withDependentBuildDirectories(QStringList &&buildPaths)
|
||||||
|
{
|
||||||
|
// add dependent build directories
|
||||||
|
QStringList res;
|
||||||
|
std::reverse(buildPaths.begin(), buildPaths.end());
|
||||||
|
const int maxDeps = 4;
|
||||||
|
while (!buildPaths.isEmpty()) {
|
||||||
|
QString bPath = buildPaths.last();
|
||||||
|
buildPaths.removeLast();
|
||||||
|
res += bPath;
|
||||||
|
if (QFile::exists(bPath + u"/_deps") && bPath.split(u"/_deps/"_s).size() < maxDeps) {
|
||||||
|
QDir d(bPath + u"/_deps");
|
||||||
|
for (const QFileInfo &fInfo : d.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot))
|
||||||
|
buildPaths.append(fInfo.absoluteFilePath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList QQmlCodeModel::buildPathsForFileUrl(const QByteArray &url)
|
QStringList QQmlCodeModel::buildPathsForFileUrl(const QByteArray &url)
|
||||||
{
|
{
|
||||||
QList<QByteArray> roots;
|
QList<QByteArray> roots;
|
||||||
|
@ -716,21 +735,7 @@ QStringList QQmlCodeModel::buildPathsForFileUrl(const QByteArray &url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// add dependent build directories
|
return withDependentBuildDirectories(std::move(buildPaths));
|
||||||
QStringList res;
|
|
||||||
std::reverse(buildPaths.begin(), buildPaths.end());
|
|
||||||
const int maxDeps = 4;
|
|
||||||
while (!buildPaths.isEmpty()) {
|
|
||||||
QString bPath = buildPaths.last();
|
|
||||||
buildPaths.removeLast();
|
|
||||||
res += bPath;
|
|
||||||
if (QFile::exists(bPath + u"/_deps") && bPath.split(u"/_deps/"_s).size() < maxDeps) {
|
|
||||||
QDir d(bPath + u"/_deps");
|
|
||||||
for (const QFileInfo &fInfo : d.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot))
|
|
||||||
buildPaths.append(fInfo.absoluteFilePath());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQmlCodeModel::setDocumentationRootPath(const QString &path)
|
void QQmlCodeModel::setDocumentationRootPath(const QString &path)
|
||||||
|
|
Loading…
Reference in New Issue