Commit 518720e0 authored by Daniel Teske's avatar Daniel Teske
Browse files

Speed up opening .pro files on windows for some users

If the build directory is empty, which can happen if we are parsing
a completely unconfigured project, then UIDIR might end up being '/'.

The uiHeaderFile function appeneded /ui_XXX.h to that, leading to
a network path.

Fix that by ensuring in various places that we handle this case.

Task-number: QTCREATORBUG-10733
Change-Id: Ib848ed4efbeacc6ee7ff862bef861a58f6d3ea34
Reviewed-by: default avatarRobert Loehning <>
Reviewed-by: default avatarOrgad Shaneh <>
Reviewed-by: default avatarDaniel Teske <>
parent d765cd73
......@@ -2483,21 +2483,24 @@ QString QmakeProFileNode::buildDir(QmakeBuildConfiguration *bc) const
return QDir::cleanPath(QDir(bc->buildDirectory().toString()).absoluteFilePath(relativeDir));
QString QmakeProFileNode::uiDirectory(const QString &buildDir) const
Utils::FileName QmakeProFileNode::uiDirectory(const Utils::FileName &buildDir) const
if (buildDir.isEmpty())
return buildDir;
const QmakeVariablesHash::const_iterator it = m_varValues.constFind(UiDirVar);
if (it != m_varValues.constEnd() && !it.value().isEmpty())
return it.value().front();
return Utils::FileName::fromString(it.value().front());
return buildDir;
QString QmakeProFileNode::uiHeaderFile(const QString &uiDir, const FileName &formFile)
QString QmakeProFileNode::uiHeaderFile(const Utils::FileName &uiDir, const FileName &formFile)
QString uiHeaderFilePath = uiDir;
uiHeaderFilePath += QLatin1String("/ui_");
uiHeaderFilePath += formFile.toFileInfo().completeBaseName();
uiHeaderFilePath += QLatin1String(".h");
return QDir::cleanPath(uiHeaderFilePath);
if (uiDir.isEmpty())
return QString();
Utils::FileName uiHeaderFilePath = uiDir;
uiHeaderFilePath.appendPath(QLatin1String("ui_") + formFile.toFileInfo().completeBaseName() + QLatin1String(".h"));
return QDir::cleanPath(uiHeaderFilePath.toString());
void QmakeProFileNode::updateUiFiles(const QString &buildDir)
......@@ -2514,8 +2517,11 @@ void QmakeProFileNode::updateUiFiles(const QString &buildDir)
const QList<FileNode*> uiFiles = uiFilesVisitor.uiFileNodes;
// Find the UiDir, there can only ever be one
const QString uiDir = uiDirectory(buildDir);
foreach (const FileNode *uiFile, uiFiles)
m_uiFiles.insert(uiFile->path().toString(), uiHeaderFile(uiDir, uiFile->path()));
const Utils::FileName uiDir = uiDirectory(Utils::FileName::fromString(buildDir));
foreach (const FileNode *uiFile, uiFiles) {
QString headerFile = uiHeaderFile(uiDir, uiFile->path());
if (!headerFile.isEmpty())
m_uiFiles.insert(uiFile->path().toString(), headerFile);
......@@ -337,8 +337,8 @@ public:
QString sourceDir() const;
QString buildDir(QmakeBuildConfiguration *bc = 0) const;
QString uiDirectory(const QString &buildDir) const;
static QString uiHeaderFile(const QString &uiDir, const Utils::FileName &formFile);
Utils::FileName uiDirectory(const Utils::FileName &buildDir) const;
static QString uiHeaderFile(const Utils::FileName &uiDir, const Utils::FileName &formFile);
QHash<QString, QString> uiFiles() const;
QmakeProFileNode *findProFileFor(const Utils::FileName &string) const;
......@@ -896,7 +896,9 @@ QString QmakeProject::generatedUiHeader(const FileName &formFile) const
// the top-level project only.
if (m_rootProjectNode)
if (const QmakeProFileNode *pro = proFileNodeOf(m_rootProjectNode, FormType, formFile))
return QmakeProFileNode::uiHeaderFile(pro->uiDirectory(pro->buildDir()), formFile);
return QmakeProFileNode::uiHeaderFile(
return QString();
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