Commit 241d3a1e authored by Daniel Teske's avatar Daniel Teske

QmakeProject: Rework allProFiles()

Change-Id: I49309565368fb8e00dd5a67c0e3ac77392924c75
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 0926da3a
......@@ -90,11 +90,15 @@ QList<Core::Id> AndroidRunConfigurationFactory::availableCreationIds(Target *par
QList<Core::Id> ids;
if (!AndroidManager::supportsAndroid(parent))
return ids;
QList<QmakeProFileNode *> nodes = static_cast<QmakeProject *>(parent->project())->allProFiles();
QmakeProject *project = static_cast<QmakeProject *>(parent->project());
QList<QmakeProFileNode *> nodes = project->allProFiles(QList<QmakeProjectType>()
<< ApplicationTemplate
<< LibraryTemplate);
const Core::Id base = Core::Id(ANDROID_RC_ID_PREFIX);
foreach (QmakeProFileNode *node, nodes)
if (node->projectType() == ApplicationTemplate || node->projectType() == LibraryTemplate)
ids << base.withSuffix(node->path());
ids << base.withSuffix(node->path());
return ids;
}
......
......@@ -98,11 +98,15 @@ QList<Core::Id> IosRunConfigurationFactory::availableCreationIds(Target *parent)
if (!IosManager::supportsIos(parent))
return ids;
Core::Id baseId(IOS_RC_ID_PREFIX);
QList<QmakeProFileNode *> nodes = static_cast<QmakeProject *>(parent->project())->allProFiles();
QmakeProject *project = static_cast<QmakeProject *>(parent->project());
QList<QmakeProFileNode *> nodes = project->allProFiles(QList<QmakeProjectType>()
<< ApplicationTemplate
<< LibraryTemplate
<< AuxTemplate);
foreach (QmakeProFileNode *node, nodes)
if (node->projectType() == ApplicationTemplate || node->projectType() == LibraryTemplate
|| node->projectType() == AuxTemplate)
ids << baseId.withSuffix(node->path());
ids << baseId.withSuffix(node->path());
return ids;
}
......
......@@ -67,6 +67,7 @@
using namespace QmakeProjectManager;
using namespace QmakeProjectManager::Internal;
using namespace ProjectExplorer;
using namespace Utils;
enum { debug = 0 };
......@@ -1058,46 +1059,30 @@ bool QmakeProject::parseInProgress(const QString &proFilePath) const
return node && node->parseInProgress();
}
void QmakeProject::collectAllfProFiles(QList<QmakeProFileNode *> &list, QmakeProFileNode *node, Parsing parse)
void QmakeProject::collectAllProFiles(QList<QmakeProFileNode *> &list, QmakeProFileNode *node, Parsing parse,
const QList<QmakeProjectType> &projectTypes)
{
if (parse == ExactAndCumulativeParse || node->includedInExactParse())
list.append(node);
foreach (ProjectNode *n, node->subProjectNodes()) {
QmakeProFileNode *qmakeProFileNode = qobject_cast<QmakeProFileNode *>(n);
if (qmakeProFileNode)
collectAllfProFiles(list, qmakeProFileNode, parse);
}
}
void QmakeProject::collectApplicationProFiles(QList<QmakeProFileNode *> &list, QmakeProFileNode *node, Parsing parse)
{
if (node->projectType() == ApplicationTemplate
|| node->projectType() == ScriptTemplate) {
if (parse == ExactAndCumulativeParse || node->includedInExactParse())
if (projectTypes.isEmpty() || projectTypes.contains(node->projectType()))
list.append(node);
}
foreach (ProjectNode *n, node->subProjectNodes()) {
QmakeProFileNode *qmakeProFileNode = qobject_cast<QmakeProFileNode *>(n);
if (qmakeProFileNode)
collectApplicationProFiles(list, qmakeProFileNode, parse);
collectAllProFiles(list, qmakeProFileNode, parse, projectTypes);
}
}
QList<QmakeProFileNode *> QmakeProject::allProFiles(Parsing parse) const
QList<QmakeProFileNode *> QmakeProject::applicationProFiles(Parsing parse) const
{
QList<QmakeProFileNode *> list;
if (!rootProjectNode())
return list;
collectAllfProFiles(list, rootQmakeProjectNode(), parse);
return list;
return allProFiles(QList<QmakeProjectType>() << ApplicationTemplate << ScriptTemplate, parse);
}
QList<QmakeProFileNode *> QmakeProject::applicationProFiles(Parsing parse) const
QList<QmakeProFileNode *> QmakeProject::allProFiles(const QList<QmakeProjectType> &projectTypes, Parsing parse) const
{
QList<QmakeProFileNode *> list;
if (!rootProjectNode())
return list;
collectApplicationProFiles(list, rootQmakeProjectNode(), parse);
collectAllProFiles(list, rootQmakeProjectNode(), parse, projectTypes);
return list;
}
......
......@@ -31,6 +31,7 @@
#define QMAKEPROJECT_H
#include "qmakeprojectmanager_global.h"
#include "qmakenodes.h"
#include <projectexplorer/project.h>
#include <projectexplorer/projectnodes.h>
......@@ -86,7 +87,8 @@ public:
virtual QString generatedUiHeader(const QString &formFile) const;
enum Parsing {ExactParse, ExactAndCumulativeParse };
QList<QmakeProFileNode *> allProFiles(Parsing parse = ExactParse) const;
QList<QmakeProFileNode *> allProFiles(const QList<QmakeProjectType> &projectTypes = QList<QmakeProjectType>(),
Parsing parse = ExactParse) const;
QList<QmakeProFileNode *> applicationProFiles(Parsing parse = ExactParse) const;
bool hasApplicationProFile(const QString &path) const;
QStringList applicationProFilePathes(const QString &prepend = QString(), Parsing parse = ExactParse) const;
......@@ -162,8 +164,8 @@ private:
void updateCppCodeModel();
void updateQmlJSCodeModel();
static void collectAllfProFiles(QList<QmakeProFileNode *> &list, QmakeProFileNode *node, Parsing parse);
static void collectApplicationProFiles(QList<QmakeProFileNode *> &list, QmakeProFileNode *node, Parsing parse);
static void collectAllProFiles(QList<QmakeProFileNode *> &list, QmakeProFileNode *node, Parsing parse,
const QList<QmakeProjectManager::QmakeProjectType> &projectTypes);
static void findProFile(const QString& fileName, QmakeProFileNode *root, QList<QmakeProFileNode *> &list);
static bool hasSubNode(QmakePriFileNode *root, const QString &path);
......
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