Qmake: Use a QmakeProFileNode instead of a generic node

... in handleSubDirContextMenu overload, obsoleting one cast there.

Change-Id: Ic6e8bfeee0fa2f8838a29df8123efe10f2faefd4
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2020-02-27 15:57:26 +01:00
parent ef6af1b7df
commit bc79ec1ee2
2 changed files with 16 additions and 16 deletions

View File

@@ -141,7 +141,7 @@ public:
void handleSubDirContextMenu(Action action, bool isFileBuild);
static void handleSubDirContextMenu(Action action, bool isFileBuild,
Project *contextProject,
Node *contextProFileNode,
QmakeProFileNode *profile,
FileNode *buildableFile);
void addLibraryImpl(const QString &fileName, TextEditor::BaseTextEditor *editor);
void runQMakeImpl(Project *p, ProjectExplorer::Node *node);
@@ -477,7 +477,7 @@ void QmakeProjectManagerPluginPrivate::buildFile()
}
}
void QmakeProjectManagerPlugin::buildProduct(Project *project, Node *proFileNode)
void QmakeProjectManagerPlugin::buildProduct(Project *project, QmakeProFileNode *proFileNode)
{
QmakeProjectManagerPluginPrivate::handleSubDirContextMenu(
QmakeProjectManagerPluginPrivate::BUILD, false, project, proFileNode, nullptr);
@@ -500,9 +500,11 @@ void QmakeProjectManagerPluginPrivate::handleSubDirContextMenu(Action action, bo
buildableFileNode);
}
void QmakeProjectManagerPluginPrivate::handleSubDirContextMenu(Action action, bool isFileBuild,
Project *contextProject, Node *contextNode,
FileNode *buildableFile)
void QmakeProjectManagerPluginPrivate::handleSubDirContextMenu(Action action,
bool isFileBuild,
Project *contextProject,
QmakeProFileNode *profile,
FileNode *buildableFile)
{
QTC_ASSERT(contextProject, return);
Target *target = contextProject->activeTarget();
@@ -513,14 +515,12 @@ void QmakeProjectManagerPluginPrivate::handleSubDirContextMenu(Action action, bo
if (!bc)
return;
if (!contextNode || !buildableFile)
if (!profile || !buildableFile)
isFileBuild = false;
if (auto *prifile = dynamic_cast<QmakePriFileNode *>(contextNode)) {
if (QmakeProFileNode *profile = prifile->proFileNode()) {
if (profile != contextProject->rootProjectNode() || isFileBuild)
bc->setSubNodeBuild(profile->proFileNode());
}
if (profile) {
if (profile != contextProject->rootProjectNode() || isFileBuild)
bc->setSubNodeBuild(profile->proFileNode());
}
if (isFileBuild)

View File

@@ -27,12 +27,12 @@
#include <extensionsystem/iplugin.h>
namespace ProjectExplorer {
class Project;
class Node;
} // ProjectExplorer
namespace ProjectExplorer { class Project; }
namespace QmakeProjectManager {
class QmakeProFileNode;
namespace Internal {
class QmakeProjectManagerPlugin final : public ExtensionSystem::IPlugin
@@ -43,7 +43,7 @@ class QmakeProjectManagerPlugin final : public ExtensionSystem::IPlugin
public:
~QmakeProjectManagerPlugin() final;
static void buildProduct(ProjectExplorer::Project *project, ProjectExplorer::Node *proFileNode);
static void buildProduct(ProjectExplorer::Project *project, QmakeProFileNode *proFileNode);
#ifdef WITH_TESTS
private slots: