From bc79ec1ee2f7c76fbc0ec19094a5bf5386bf2e84 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 27 Feb 2020 15:57:26 +0100 Subject: Qmake: Use a QmakeProFileNode instead of a generic node ... in handleSubDirContextMenu overload, obsoleting one cast there. Change-Id: Ic6e8bfeee0fa2f8838a29df8123efe10f2faefd4 Reviewed-by: Christian Kandeler --- .../qmakeprojectmanagerplugin.cpp | 22 +++++++++++----------- .../qmakeprojectmanagerplugin.h | 10 +++++----- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src/plugins/qmakeprojectmanager') diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp index e1899418dd9..35862044dce 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp @@ -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(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) diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.h b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.h index 1d11bb45cb5..9cab4ae8495 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.h +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.h @@ -27,12 +27,12 @@ #include -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: -- cgit v1.2.3