forked from qt-creator/qt-creator
QmakeProjectManager et al: Reduce use of qmake specific logic
Change-Id: I8f7e5d822ccb27e3ec241b814ec67aed7fe7539f Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -159,27 +159,13 @@ void IosRunConfiguration::updateEnabledState()
|
|||||||
|
|
||||||
bool IosRunConfiguration::canRunForNode(const Node *node) const
|
bool IosRunConfiguration::canRunForNode(const Node *node) const
|
||||||
{
|
{
|
||||||
return node->filePath() == profilePath();
|
return node->filePath().toString() == buildKey();
|
||||||
}
|
|
||||||
|
|
||||||
FileName IosRunConfiguration::profilePath() const
|
|
||||||
{
|
|
||||||
return FileName::fromString(buildKey());
|
|
||||||
}
|
|
||||||
|
|
||||||
static QmakeProFile *proFile(const IosRunConfiguration *rc)
|
|
||||||
{
|
|
||||||
auto pro = qobject_cast<const QmakeProject *>(rc->target()->project());
|
|
||||||
QmakeProFile *proFile = pro ? pro->rootProFile() : nullptr;
|
|
||||||
if (proFile)
|
|
||||||
proFile = proFile->findProFile(rc->profilePath());
|
|
||||||
return proFile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString IosRunConfiguration::applicationName() const
|
QString IosRunConfiguration::applicationName() const
|
||||||
{
|
{
|
||||||
QmakeProFile *pro = proFile(this);
|
Project *project = target()->project();
|
||||||
if (pro) {
|
if (auto pro = dynamic_cast<const QmakeProFileNode *>(project->findNodeForBuildKey(buildKey()))) {
|
||||||
TargetInformation ti = pro->targetInformation();
|
TargetInformation ti = pro->targetInformation();
|
||||||
if (ti.valid)
|
if (ti.valid)
|
||||||
return ti.target;
|
return ti.target;
|
||||||
@@ -197,7 +183,8 @@ FileName IosRunConfiguration::bundleDirectory() const
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if (BuildConfiguration *bc = target()->activeBuildConfiguration()) {
|
if (BuildConfiguration *bc = target()->activeBuildConfiguration()) {
|
||||||
const QmakeProFile *pro = proFile(this);
|
Project *project = target()->project();
|
||||||
|
auto pro = dynamic_cast<const QmakeProFileNode *>(project->findNodeForBuildKey(buildKey()));
|
||||||
if (pro) {
|
if (pro) {
|
||||||
TargetInformation ti = pro->targetInformation();
|
TargetInformation ti = pro->targetInformation();
|
||||||
if (ti.valid)
|
if (ti.valid)
|
||||||
|
@@ -61,10 +61,8 @@ QVariant QmakeAndroidSupport::targetData(Core::Id role, const Target *target) co
|
|||||||
return {};
|
return {};
|
||||||
|
|
||||||
const FileName projectFilePath = FileName::fromString(rc->buildKey());
|
const FileName projectFilePath = FileName::fromString(rc->buildKey());
|
||||||
const QmakeProject *pro = qobject_cast<QmakeProject *>(target->project());
|
const ProjectNode *projectNode = target->project()->findNodeForBuildKey(rc->buildKey());
|
||||||
QTC_ASSERT(pro, return {});
|
auto profileNode = dynamic_cast<const QmakeProFileNode *>(projectNode);
|
||||||
QTC_ASSERT(pro->rootProjectNode(), return {});
|
|
||||||
const QmakeProFileNode *profileNode = pro->rootProjectNode()->findProFileFor(projectFilePath);
|
|
||||||
QTC_ASSERT(profileNode, return {});
|
QTC_ASSERT(profileNode, return {});
|
||||||
|
|
||||||
if (role == Android::Constants::AndroidPackageSourceDir)
|
if (role == Android::Constants::AndroidPackageSourceDir)
|
||||||
|
@@ -864,12 +864,12 @@ bool PackageLibraryDetailsController::isLinkPackageGenerated() const
|
|||||||
if (!project)
|
if (!project)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const auto *rootProject = dynamic_cast<const QmakeProFileNode *>(project->rootProjectNode());
|
const ProjectNode *projectNode = project->findNodeForBuildKey(proFile());
|
||||||
if (!rootProject)
|
if (!projectNode)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const QmakeProFileNode *currentProject =
|
const QmakeProFileNode *currentProject =
|
||||||
rootProject->findProFileFor(Utils::FileName::fromString(proFile()));
|
dynamic_cast<const QmakeProFileNode *>(projectNode);
|
||||||
if (!currentProject)
|
if (!currentProject)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@@ -198,18 +198,6 @@ FolderNode::AddNewInformation QmakePriFileNode::addNewInformation(const QStringL
|
|||||||
return FolderNode::AddNewInformation(filePath().fileName(), context && context->parentProjectNode() == this ? 120 : 90);
|
return FolderNode::AddNewInformation(filePath().fileName(), context && context->parentProjectNode() == this ? 120 : 90);
|
||||||
}
|
}
|
||||||
|
|
||||||
QmakeProFileNode *QmakeProFileNode::findProFileFor(const FileName &fileName) const
|
|
||||||
{
|
|
||||||
if (fileName == filePath())
|
|
||||||
return const_cast<QmakeProFileNode *>(this);
|
|
||||||
for (Node *node : nodes()) {
|
|
||||||
if (auto *qmakeProFileNode = dynamic_cast<QmakeProFileNode *>(node))
|
|
||||||
if (QmakeProFileNode *result = qmakeProFileNode->findProFileFor(fileName))
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class QmakeProFileNode
|
\class QmakeProFileNode
|
||||||
Implements abstract ProjectNode class
|
Implements abstract ProjectNode class
|
||||||
|
@@ -102,7 +102,6 @@ public:
|
|||||||
QStringList variableValue(const Variable var) const;
|
QStringList variableValue(const Variable var) const;
|
||||||
QString singleVariableValue(const Variable var) const;
|
QString singleVariableValue(const Variable var) const;
|
||||||
|
|
||||||
QmakeProFileNode *findProFileFor(const Utils::FileName &string) const;
|
|
||||||
TargetInformation targetInformation() const;
|
TargetInformation targetInformation() const;
|
||||||
|
|
||||||
bool showInSimpleTree(ProjectType projectType) const;
|
bool showInSimpleTree(ProjectType projectType) const;
|
||||||
|
Reference in New Issue
Block a user