QmakeProjectManager: Remove some local aliases

... for ProjectTree functions.

Change-Id: Ia3608e79e046a13305995bfc07eb32cbe53060cf
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-04-30 12:54:47 +02:00
parent d4c5a6f9b2
commit 28de30df18
3 changed files with 9 additions and 18 deletions

View File

@@ -53,16 +53,6 @@ using namespace TextEditor;
namespace QmakeProjectManager { namespace QmakeProjectManager {
Node *QmakeManager::contextNode()
{
return ProjectTree::findCurrentNode();
}
Project *QmakeManager::contextProject()
{
return ProjectTree::currentProject();
}
static QmakeProFileNode *buildableFileProFile(Node *node) static QmakeProFileNode *buildableFileProFile(Node *node)
{ {
if (node) { if (node) {
@@ -77,7 +67,7 @@ static QmakeProFileNode *buildableFileProFile(Node *node)
FileNode *QmakeManager::contextBuildableFileNode() FileNode *QmakeManager::contextBuildableFileNode()
{ {
Node *node = contextNode(); Node *node = ProjectTree::findCurrentNode();
QmakeProFileNode *subProjectNode = buildableFileProFile(node); QmakeProFileNode *subProjectNode = buildableFileProFile(node);
FileNode *fileNode = node ? node->asFileNode() : nullptr; FileNode *fileNode = node ? node->asFileNode() : nullptr;
@@ -97,7 +87,7 @@ void QmakeManager::addLibraryContextMenu()
{ {
QString projectPath; QString projectPath;
Node *node = contextNode(); Node *node = ProjectTree::findCurrentNode();
if (ContainerNode *cn = node->asContainerNode()) if (ContainerNode *cn = node->asContainerNode())
projectPath = cn->project()->projectFilePath().toString(); projectPath = cn->project()->projectFilePath().toString();
else if (dynamic_cast<QmakeProFileNode *>(node)) else if (dynamic_cast<QmakeProFileNode *>(node))
@@ -142,7 +132,7 @@ void QmakeManager::runQMake()
void QmakeManager::runQMakeContextMenu() void QmakeManager::runQMakeContextMenu()
{ {
runQMakeImpl(contextProject(), contextNode()); runQMakeImpl(ProjectTree::currentProject(), ProjectTree::findCurrentNode());
} }
void QmakeManager::runQMakeImpl(ProjectExplorer::Project *p, ProjectExplorer::Node *node) void QmakeManager::runQMakeImpl(ProjectExplorer::Project *p, ProjectExplorer::Node *node)
@@ -206,8 +196,11 @@ void QmakeManager::buildFile()
void QmakeManager::handleSubDirContextMenu(QmakeManager::Action action, bool isFileBuild) void QmakeManager::handleSubDirContextMenu(QmakeManager::Action action, bool isFileBuild)
{ {
handleSubDirContextMenu(action, isFileBuild, contextProject(), handleSubDirContextMenu(action,
buildableFileProFile(contextNode()), contextBuildableFileNode()); isFileBuild,
ProjectTree::currentProject(),
buildableFileProFile(ProjectTree::findCurrentNode()),
contextBuildableFileNode());
} }
void QmakeManager::handleSubDirContextMenu(QmakeManager::Action action, bool isFileBuild, void QmakeManager::handleSubDirContextMenu(QmakeManager::Action action, bool isFileBuild,

View File

@@ -48,8 +48,6 @@ public:
void notifyChanged(const Utils::FileName &name); void notifyChanged(const Utils::FileName &name);
// Context information used in the slot implementations // Context information used in the slot implementations
static ProjectExplorer::Node *contextNode();
static ProjectExplorer::Project *contextProject();
static ProjectExplorer::FileNode *contextBuildableFileNode(); static ProjectExplorer::FileNode *contextBuildableFileNode();
enum Action { BUILD, REBUILD, CLEAN }; enum Action { BUILD, REBUILD, CLEAN };

View File

@@ -376,7 +376,7 @@ void QmakeProjectManagerPluginPrivate::updateContextActions()
const auto *proFileNode = dynamic_cast<const QmakeProFileNode *>(containerNode ? containerNode->rootProjectNode() : node); const auto *proFileNode = dynamic_cast<const QmakeProFileNode *>(containerNode ? containerNode->rootProjectNode() : node);
m_addLibraryActionContextMenu->setEnabled(proFileNode); m_addLibraryActionContextMenu->setEnabled(proFileNode);
auto *qmakeProject = qobject_cast<QmakeProject *>(QmakeManager::contextProject()); auto *qmakeProject = qobject_cast<QmakeProject *>(project);
QmakeProFileNode *subProjectNode = nullptr; QmakeProFileNode *subProjectNode = nullptr;
disableBuildFileMenus(); disableBuildFileMenus();
if (node) { if (node) {