Commit 51ba32bc authored by Daniel Teske's avatar Daniel Teske

QmakeProject: Show project hierarchy of .pri files

For a reason that seems lost in time, all .pri files that are
(directly or indirectly) included in a .pro file are listed
in a flat list.

Change that to properly show a tree.

For example a.pro including b.pri, which includes c.pri is
now shown like this:
a.pro
|-> b.pri
    |-> c.pri

Task-number: QTCREATORBUG-487
Change-Id: I1bc29a512fb27e6fe9b399738f2a37f2a95ce10f
Reviewed-by: default avatarOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: default avatarDaniel Teske <daniel.teske@theqtcompany.com>
parent 9aa58ab2
......@@ -204,7 +204,7 @@ private:
QStringList formResources(const QString &formFile) const;
static QStringList baseVPaths(QtSupport::ProFileReader *reader, const QString &projectDir, const QString &buildDir);
static QStringList fullVPaths(const QStringList &baseVPaths, QtSupport::ProFileReader *reader, const QString &qmakeVariable, const QString &projectDir);
static Internal::PriFileEvalResult extractValues(const Internal::EvalInput &input, ProFile *includeFileExact, ProFile *includeFileCumlative,
static Internal::PriFileEvalResult extractValues(const Internal::EvalInput &input, QVector<ProFile *> includeFilesExact, QVector<ProFile *> includeFilesCumlative,
const QList<QList<Internal::VariableAndVPathInformation>> &variableAndVPathInformation);
void watchFolders(const QSet<QString> &folders);
......
......@@ -86,14 +86,17 @@ void ProFileReader::setCumulative(bool on)
ProFileEvaluator::setCumulative(on);
}
void ProFileReader::aboutToEval(ProFile *, ProFile *pro, EvalFileType type)
void ProFileReader::aboutToEval(ProFile *parent, ProFile *pro, EvalFileType type)
{
if (m_ignoreLevel || (type != EvalProjectFile && type != EvalIncludeFile)) {
m_ignoreLevel++;
} else if (!m_includeFiles.contains(pro->fileName())) {
m_includeFiles.insert(pro->fileName(), pro);
m_proFiles.append(pro);
pro->ref();
} else {
QVector<ProFile *> children = m_includeFiles[parent];
if (!children.contains(pro)) {
children.append(pro);
m_proFiles.append(pro);
pro->ref();
}
}
}
......@@ -103,14 +106,9 @@ void ProFileReader::doneWithEval(ProFile *)
m_ignoreLevel--;
}
QList<ProFile*> ProFileReader::includeFiles() const
QHash<ProFile *, QVector<ProFile *> > ProFileReader::includeFiles() const
{
return m_includeFiles.values();
}
ProFile *ProFileReader::proFileFor(const QString &name)
{
return m_includeFiles.value(name);
return m_includeFiles;
}
ProFileCacheManager *ProFileCacheManager::s_instance = 0;
......
......@@ -38,6 +38,7 @@
#include <QObject>
#include <QMap>
#include <QVector>
#include <QTimer>
namespace QtSupport {
......@@ -75,15 +76,15 @@ public:
void setCumulative(bool on);
QList<ProFile*> includeFiles() const;
ProFile *proFileFor(const QString &name);
QHash<ProFile *, QVector<ProFile *> > includeFiles() const;
virtual void aboutToEval(ProFile *parent, ProFile *proFile, EvalFileType type);
virtual void doneWithEval(ProFile *parent);
private:
QMap<QString, ProFile *> m_includeFiles;
// Tree of ProFiles, mapping from parent to children
QHash<ProFile *, QVector<ProFile *> > m_includeFiles;
// One entry per ProFile::ref() call, might contain duplicates
QList<ProFile *> m_proFiles;
int m_ignoreLevel;
};
......
Markdown is supported
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