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

View File

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