From 28de30df18db15d081ccad3944cc341b8b29829b Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 30 Apr 2019 12:54:47 +0200 Subject: [PATCH] QmakeProjectManager: Remove some local aliases ... for ProjectTree functions. Change-Id: Ia3608e79e046a13305995bfc07eb32cbe53060cf Reviewed-by: Christian Kandeler --- .../qmakeprojectmanager.cpp | 23 +++++++------------ .../qmakeprojectmanager/qmakeprojectmanager.h | 2 -- .../qmakeprojectmanagerplugin.cpp | 2 +- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp index 3af228874a7..0f6a4b98456 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp @@ -53,16 +53,6 @@ using namespace TextEditor; namespace QmakeProjectManager { -Node *QmakeManager::contextNode() -{ - return ProjectTree::findCurrentNode(); -} - -Project *QmakeManager::contextProject() -{ - return ProjectTree::currentProject(); -} - static QmakeProFileNode *buildableFileProFile(Node *node) { if (node) { @@ -77,7 +67,7 @@ static QmakeProFileNode *buildableFileProFile(Node *node) FileNode *QmakeManager::contextBuildableFileNode() { - Node *node = contextNode(); + Node *node = ProjectTree::findCurrentNode(); QmakeProFileNode *subProjectNode = buildableFileProFile(node); FileNode *fileNode = node ? node->asFileNode() : nullptr; @@ -97,7 +87,7 @@ void QmakeManager::addLibraryContextMenu() { QString projectPath; - Node *node = contextNode(); + Node *node = ProjectTree::findCurrentNode(); if (ContainerNode *cn = node->asContainerNode()) projectPath = cn->project()->projectFilePath().toString(); else if (dynamic_cast(node)) @@ -142,7 +132,7 @@ void QmakeManager::runQMake() void QmakeManager::runQMakeContextMenu() { - runQMakeImpl(contextProject(), contextNode()); + runQMakeImpl(ProjectTree::currentProject(), ProjectTree::findCurrentNode()); } void QmakeManager::runQMakeImpl(ProjectExplorer::Project *p, ProjectExplorer::Node *node) @@ -206,8 +196,11 @@ void QmakeManager::buildFile() void QmakeManager::handleSubDirContextMenu(QmakeManager::Action action, bool isFileBuild) { - handleSubDirContextMenu(action, isFileBuild, contextProject(), - buildableFileProFile(contextNode()), contextBuildableFileNode()); + handleSubDirContextMenu(action, + isFileBuild, + ProjectTree::currentProject(), + buildableFileProFile(ProjectTree::findCurrentNode()), + contextBuildableFileNode()); } void QmakeManager::handleSubDirContextMenu(QmakeManager::Action action, bool isFileBuild, diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.h b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.h index b7869f93748..f137f98289b 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.h +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.h @@ -48,8 +48,6 @@ public: void notifyChanged(const Utils::FileName &name); // Context information used in the slot implementations - static ProjectExplorer::Node *contextNode(); - static ProjectExplorer::Project *contextProject(); static ProjectExplorer::FileNode *contextBuildableFileNode(); enum Action { BUILD, REBUILD, CLEAN }; diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp index a6c256db806..c748ec8eaa8 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp @@ -376,7 +376,7 @@ void QmakeProjectManagerPluginPrivate::updateContextActions() const auto *proFileNode = dynamic_cast(containerNode ? containerNode->rootProjectNode() : node); m_addLibraryActionContextMenu->setEnabled(proFileNode); - auto *qmakeProject = qobject_cast(QmakeManager::contextProject()); + auto *qmakeProject = qobject_cast(project); QmakeProFileNode *subProjectNode = nullptr; disableBuildFileMenus(); if (node) {