From ad4e2562fa732892b717f76779ca56cc52543f1b Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 26 Feb 2019 17:44:56 +0100 Subject: ProjectExplorer: Replace Node::setNodeType by virtual functions Not the usual direction of change, but currently there are several systems to identify or invoke node functionality. Virtual functions are likely to stay in this context, so this here attempts to help consolidation by reducing the influence of the node type flags, hopefully leading to full removal by making remaining functionality available through the other mechanisms (virtual functions, asFooNode() 'casts', less so the FileType flag). Change-Id: I12a17ce30b3c8883995b29b4720408020ee0fa3e Reviewed-by: Christian Kandeler --- src/plugins/pythoneditor/pythoneditorplugin.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/plugins/pythoneditor/pythoneditorplugin.cpp') diff --git a/src/plugins/pythoneditor/pythoneditorplugin.cpp b/src/plugins/pythoneditor/pythoneditorplugin.cpp index b937f9c89e..57db21346c 100644 --- a/src/plugins/pythoneditor/pythoneditorplugin.cpp +++ b/src/plugins/pythoneditor/pythoneditorplugin.cpp @@ -623,18 +623,16 @@ QString PythonProjectNode::addFileFilter() const bool PythonProjectNode::supportsAction(ProjectAction action, const Node *node) const { - switch (node->nodeType()) { - case NodeType::File: + if (node->isFileNodeType()) { return action == ProjectAction::Rename || action == ProjectAction::RemoveFile; - case NodeType::Folder: - case NodeType::Project: + } + if (node->isFolderNodeType() || node->isProjectNodeType()) { return action == ProjectAction::AddNewFile || action == ProjectAction::RemoveFile || action == ProjectAction::AddExistingFile; - default: - return ProjectNode::supportsAction(action, node); } + return ProjectNode::supportsAction(action, node); } bool PythonProjectNode::addFiles(const QStringList &filePaths, QStringList *) -- cgit v1.2.1