Commit 45046f70 authored by Tobias Hunger's avatar Tobias Hunger Committed by Tim Jenssen
Browse files

ProjectNodes: Do not derive Project Nodes from QObject



That should save some memory per node, and since creator has a lot of nodes
(e.g. opening the LLVM project adds about 1 000 000 nodes) this should be
noticeable:-)

Calling update inside ProjectTree::currentNode() and rename it to
findCurrentNode() to make sure it is an still existing pointer.
Also, try to reduce the somehow more expensive currentNode() calls
and sprinkle some const around that usage.

Change-Id: I6a7c5db01a71d53d39544d3013cad557d5b96cdc
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent bbb54cde
......@@ -114,8 +114,8 @@ void CMakeProjectPlugin::extensionsInitialized()
void CMakeProjectPlugin::updateContextActions()
{
Project *project = ProjectTree::currentProject();
Node *node = ProjectTree::currentNode();
CMakeTargetNode *targetNode = dynamic_cast<CMakeTargetNode *>(node);
const Node *node = ProjectTree::findCurrentNode();
const CMakeTargetNode *targetNode = dynamic_cast<const CMakeTargetNode *>(node);
// as targetNode can be deleted while the menu is open, we keep only the
const QString targetDisplayName = targetNode ? targetNode->displayName() : QString();
CMakeProject *cmProject = dynamic_cast<CMakeProject *>(project);
......
......@@ -126,7 +126,7 @@ public:
bool showInSimpleTree() const override { return true; }
bool supportsAction(ProjectAction action, Node *) const override
bool supportsAction(ProjectAction action, const Node *) const override
{
return action == AddNewFile
|| action == AddExistingFile
......
......@@ -188,7 +188,7 @@ void ModelsManager::onAboutToShowContextMenu(ProjectExplorer::Project *project,
void ModelsManager::onOpenDiagramFromProjectExplorer()
{
if (ProjectExplorer::ProjectTree::instance()->currentNode() == d->contextMenuOwnerNode) {
if (ProjectExplorer::ProjectTree::findCurrentNode() == d->contextMenuOwnerNode) {
qmt::MDiagram *diagram = 0;
foreach (const ManagedModel &managedModel, d->managedModels) {
if ((diagram = managedModel.m_documentController->pxNodeController()->findDiagramForExplorerNode(d->contextMenuOwnerNode))) {
......
......@@ -37,7 +37,7 @@ NimProjectNode::NimProjectNode(NimProject &project,
, m_project(project)
{}
bool NimProjectNode::supportsAction(ProjectAction action, Node *node) const
bool NimProjectNode::supportsAction(ProjectAction action, const Node *node) const
{
switch (node->nodeType()) {
case NodeType::File:
......
......@@ -38,7 +38,7 @@ class NimProjectNode : public ProjectExplorer::ProjectNode
public:
NimProjectNode(NimProject &project, const Utils::FileName &projectFilePath);
bool supportsAction(ProjectExplorer::ProjectAction action, Node *node) const override;
bool supportsAction(ProjectExplorer::ProjectAction action, const Node *node) const override;
bool addFiles(const QStringList &filePaths, QStringList *) override;
bool removeFiles(const QStringList &filePaths, QStringList *) override;
bool deleteFiles(const QStringList &) override;
......
......@@ -2154,11 +2154,11 @@ QList<QPair<QString, QString> > ProjectExplorerPluginPrivate::recentProjects() c
});
}
static QString pathOrDirectoryFor(Node *node, bool dir)
static QString pathOrDirectoryFor(const Node *node, bool dir)
{
Utils::FileName path = node->filePath();
QString location;
FolderNode *folder = node->asFolderNode();
const FolderNode *folder = node->asFolderNode();
if (node->nodeType() == NodeType::VirtualFolder && folder) {
// Virtual Folder case
// If there are files directly below or no subfolders, take the folder path
......@@ -2192,12 +2192,12 @@ static QString pathOrDirectoryFor(Node *node, bool dir)
return location;
}
static QString pathFor(Node *node)
static QString pathFor(const Node *node)
{
return pathOrDirectoryFor(node, false);
}
static QString directoryFor(Node *node)
static QString directoryFor(const Node *node)
{
return pathOrDirectoryFor(node, true);
}
......@@ -2448,8 +2448,8 @@ void ProjectExplorerPlugin::buildProject(Project *p)
void ProjectExplorerPluginPrivate::runProjectContextMenu()
{
Node *node = ProjectTree::currentNode();
ProjectNode *projectNode = node ? node->asProjectNode() : nullptr;
const Node *node = ProjectTree::findCurrentNode();
const ProjectNode *projectNode = node ? node->asProjectNode() : nullptr;
if (projectNode == ProjectTree::currentProject()->rootProjectNode() || !projectNode) {
m_instance->runProject(ProjectTree::currentProject(), Constants::NORMAL_RUN_MODE);
} else {
......@@ -2985,14 +2985,14 @@ void ProjectExplorerPluginPrivate::updateContextMenuActions()
runMenu->menu()->clear();
runMenu->menu()->menuAction()->setVisible(false);
Node *currentNode = ProjectTree::currentNode();
const Node *currentNode = ProjectTree::findCurrentNode();
if (currentNode && currentNode->managingProject()) {
ProjectNode *pn;
if (ContainerNode *cn = currentNode->asContainerNode())
if (const ContainerNode *cn = currentNode->asContainerNode())
pn = cn->rootProjectNode();
else
pn = currentNode->asProjectNode();
pn = const_cast<ProjectNode*>(currentNode->asProjectNode());
if (pn) {
if (ProjectTree::currentProject() && pn == ProjectTree::currentProject()->rootProjectNode()) {
......@@ -3047,7 +3047,7 @@ void ProjectExplorerPluginPrivate::updateContextMenuActions()
m_removeFileAction->setVisible(!enableDelete || enableRemove);
m_renameFileAction->setEnabled(supports(Rename));
const bool currentNodeIsTextFile = isTextFile(
ProjectTree::currentNode()->filePath().toString());
currentNode->filePath().toString());
m_diffFileAction->setEnabled(isDiffServiceAvailable()
&& currentNodeIsTextFile && TextEditor::TextDocument::currentTextDocument());
......@@ -3055,7 +3055,7 @@ void ProjectExplorerPluginPrivate::updateContextMenuActions()
m_duplicateFileAction->setEnabled(supports(DuplicateFile));
EditorManager::populateOpenWithMenu(m_openWithMenu,
ProjectTree::currentNode()->filePath().toString());
currentNode->filePath().toString());
}
if (supports(HidePathActions)) {
......@@ -3096,7 +3096,7 @@ void ProjectExplorerPluginPrivate::updateLocationSubMenus()
QTC_CHECK(folderMenu->actions().isEmpty());
const FolderNode *const fn
= ProjectTree::currentNode() ? ProjectTree::currentNode()->asFolderNode() : nullptr;
= ProjectTree::findCurrentNode() ? ProjectTree::findCurrentNode()->asFolderNode() : nullptr;
const QList<FolderNode::LocationInfo> locations
= fn ? fn->locationInfo() : QList<FolderNode::LocationInfo>();
......@@ -3124,11 +3124,12 @@ void ProjectExplorerPluginPrivate::updateLocationSubMenus()
void ProjectExplorerPluginPrivate::addNewFile()
{
QTC_ASSERT(ProjectTree::currentNode(), return);
QString location = directoryFor(ProjectTree::currentNode());
Node* currentNode = ProjectTree::findCurrentNode();
QTC_ASSERT(currentNode, return);
QString location = directoryFor(currentNode);
QVariantMap map;
map.insert(QLatin1String(Constants::PREFERRED_PROJECT_NODE), QVariant::fromValue(ProjectTree::currentNode()));
map.insert(QLatin1String(Constants::PREFERRED_PROJECT_NODE), QVariant::fromValue(currentNode));
if (ProjectTree::currentProject()) {
QList<Id> profileIds = Utils::transform(ProjectTree::currentProject()->targets(), &Target::id);
map.insert(QLatin1String(Constants::PROJECT_KIT_IDS), QVariant::fromValue(profileIds));
......@@ -3143,8 +3144,8 @@ void ProjectExplorerPluginPrivate::addNewFile()
void ProjectExplorerPluginPrivate::addNewSubproject()
{
QTC_ASSERT(ProjectTree::currentNode(), return);
Node *currentNode = ProjectTree::currentNode();
Node* currentNode = ProjectTree::findCurrentNode();
QTC_ASSERT(currentNode, return);
QString location = directoryFor(currentNode);
if (currentNode->nodeType() == NodeType::Project
......@@ -3170,13 +3171,13 @@ void ProjectExplorerPluginPrivate::addNewSubproject()
void ProjectExplorerPluginPrivate::handleAddExistingFiles()
{
Node *node = ProjectTree::currentNode();
Node *node = ProjectTree::findCurrentNode();
FolderNode *folderNode = node ? node->asFolderNode() : nullptr;
QTC_ASSERT(folderNode, return);
QStringList fileNames = QFileDialog::getOpenFileNames(ICore::mainWindow(),
tr("Add Existing Files"), directoryFor(ProjectTree::currentNode()));
tr("Add Existing Files"), directoryFor(node));
if (fileNames.isEmpty())
return;
......@@ -3185,12 +3186,12 @@ void ProjectExplorerPluginPrivate::handleAddExistingFiles()
void ProjectExplorerPluginPrivate::addExistingDirectory()
{
Node *node = ProjectTree::currentNode();
Node *node = ProjectTree::findCurrentNode();
FolderNode *folderNode = node ? node->asFolderNode() : nullptr;
QTC_ASSERT(folderNode, return);
SelectableFilesDialogAddDirectory dialog(Utils::FileName::fromString(directoryFor(ProjectTree::currentNode())),
SelectableFilesDialogAddDirectory dialog(Utils::FileName::fromString(directoryFor(node)),
Utils::FileNameList(), ICore::mainWindow());
dialog.setAddFileFilter(folderNode->addFileFilter());
......@@ -3225,7 +3226,7 @@ void ProjectExplorerPlugin::addExistingFiles(FolderNode *folderNode, const QStri
void ProjectExplorerPluginPrivate::removeProject()
{
Node *node = ProjectTree::currentNode();
Node *node = ProjectTree::findCurrentNode();
if (!node)
return;
ProjectNode *subProjectNode = node->managingProject();
......@@ -3242,31 +3243,35 @@ void ProjectExplorerPluginPrivate::removeProject()
void ProjectExplorerPluginPrivate::openFile()
{
QTC_ASSERT(ProjectTree::currentNode(), return);
EditorManager::openEditor(ProjectTree::currentNode()->filePath().toString());
const Node *currentNode = ProjectTree::findCurrentNode();
QTC_ASSERT(currentNode, return);
EditorManager::openEditor(currentNode->filePath().toString());
}
void ProjectExplorerPluginPrivate::searchOnFileSystem()
{
QTC_ASSERT(ProjectTree::currentNode(), return);
TextEditor::FindInFiles::findOnFileSystem(pathFor(ProjectTree::currentNode()));
const Node *currentNode = ProjectTree::findCurrentNode();
QTC_ASSERT(currentNode, return);
TextEditor::FindInFiles::findOnFileSystem(pathFor(currentNode));
}
void ProjectExplorerPluginPrivate::showInGraphicalShell()
{
QTC_ASSERT(ProjectTree::currentNode(), return);
FileUtils::showInGraphicalShell(ICore::mainWindow(), pathFor(ProjectTree::currentNode()));
Node *currentNode = ProjectTree::findCurrentNode();
QTC_ASSERT(currentNode, return);
FileUtils::showInGraphicalShell(ICore::mainWindow(), pathFor(currentNode));
}
void ProjectExplorerPluginPrivate::openTerminalHere()
{
QTC_ASSERT(ProjectTree::currentNode(), return);
FileUtils::openTerminal(directoryFor(ProjectTree::currentNode()));
const Node *currentNode = ProjectTree::findCurrentNode();
QTC_ASSERT(currentNode, return);
FileUtils::openTerminal(directoryFor(currentNode));
}
void ProjectExplorerPluginPrivate::removeFile()
{
Node *currentNode = ProjectTree::currentNode();
const Node *currentNode = ProjectTree::findCurrentNode();
QTC_ASSERT(currentNode && currentNode->nodeType() == NodeType::File, return);
const Utils::FileName filePath = currentNode->filePath();
......@@ -3276,7 +3281,7 @@ void ProjectExplorerPluginPrivate::removeFile()
const bool deleteFile = removeFileDialog.isDeleteFileChecked();
// Re-read the current node, in case the project is re-parsed while the dialog is open
if (currentNode != ProjectTree::currentNode()) {
if (currentNode != ProjectTree::findCurrentNode()) {
currentNode = ProjectTreeWidget::nodeForFile(filePath);
QTC_ASSERT(currentNode && currentNode->nodeType() == NodeType::File, return);
}
......@@ -3301,7 +3306,7 @@ void ProjectExplorerPluginPrivate::removeFile()
void ProjectExplorerPluginPrivate::duplicateFile()
{
Node *currentNode = ProjectTree::currentNode();
Node *currentNode = ProjectTree::findCurrentNode();
QTC_ASSERT(currentNode && currentNode->nodeType() == NodeType::File, return);
FileNode *fileNode = currentNode->asFileNode();
......@@ -3332,7 +3337,7 @@ void ProjectExplorerPluginPrivate::duplicateFile()
void ProjectExplorerPluginPrivate::deleteFile()
{
Node *currentNode = ProjectTree::currentNode();
Node *currentNode = ProjectTree::findCurrentNode();
QTC_ASSERT(currentNode && currentNode->nodeType() == NodeType::File, return);
FileNode *fileNode = currentNode->asFileNode();
......@@ -3393,7 +3398,7 @@ void ProjectExplorerPluginPrivate::handleDiffFile()
return;
// current item's file
Node *currentNode = ProjectTree::currentNode();
Node *currentNode = ProjectTree::findCurrentNode();
QTC_ASSERT(currentNode && currentNode->nodeType() == NodeType::File, return);
FileNode *fileNode = currentNode->asFileNode();
......
......@@ -49,7 +49,7 @@ class WrapperNode : public Utils::TypedTreeItem<WrapperNode>
{
public:
explicit WrapperNode(Node *node) : m_node(node) {}
QPointer<Node> m_node;
Node *m_node = nullptr;
};
class FlatModel : public Utils::TreeModel<WrapperNode, WrapperNode>
......
......@@ -248,7 +248,7 @@ bool Node::isGenerated() const
return (m_flags & FlagIsGenerated) == FlagIsGenerated;
}
bool Node::supportsAction(ProjectAction, Node *) const
bool Node::supportsAction(ProjectAction, const Node *) const
{
return false;
}
......@@ -403,7 +403,7 @@ FileNode::scanForFilesWithVersionControls(const Utils::FileName &directory,
return scanForFilesRecursively(directory, factory, visited, future, 0.0, 1000000.0, versionControls);
}
bool FileNode::supportsAction(ProjectAction action, Node *node) const
bool FileNode::supportsAction(ProjectAction action, const Node *node) const
{
if (action == InheritedFromParent)
return true;
......@@ -653,7 +653,7 @@ QString FolderNode::addFileFilter() const
return fn ? fn->addFileFilter() : QString();
}
bool FolderNode::supportsAction(ProjectAction action, Node *node) const
bool FolderNode::supportsAction(ProjectAction action, const Node *node) const
{
if (action == InheritedFromParent)
return true;
......@@ -831,7 +831,7 @@ bool ProjectNode::renameFile(const QString &filePath, const QString &newFilePath
return false;
}
bool ProjectNode::supportsAction(ProjectAction, Node *) const
bool ProjectNode::supportsAction(ProjectAction, const Node *) const
{
return false;
}
......@@ -886,9 +886,9 @@ QString ContainerNode::displayName() const
return name;
}
bool ContainerNode::supportsAction(ProjectAction action, Node *node) const
bool ContainerNode::supportsAction(ProjectAction action, const Node *node) const
{
Node *rootNode = m_project->rootProjectNode();
const Node *rootNode = m_project->rootProjectNode();
return rootNode && rootNode->supportsAction(action, node);
}
......
......@@ -29,7 +29,6 @@
#include <QFutureInterface>
#include <QIcon>
#include <QObject>
#include <QStringList>
#include <utils/fileutils.h>
......@@ -98,9 +97,8 @@ class ProjectNode;
class ContainerNode;
// Documentation inside.
class PROJECTEXPLORER_EXPORT Node : public QObject
class PROJECTEXPLORER_EXPORT Node
{
Q_OBJECT
public:
enum PriorityLevel {
DefaultPriority = 0,
......@@ -133,7 +131,7 @@ public:
bool listInProject() const;
bool isGenerated() const;
virtual bool supportsAction(ProjectAction action, Node *node) const;
virtual bool supportsAction(ProjectAction action, const Node *node) const;
void setEnabled(bool enabled);
void setAbsoluteFilePathAndLine(const Utils::FileName &filePath, int line);
......@@ -199,7 +197,7 @@ public:
const std::function<FileNode *(const Utils::FileName &fileName)> factory,
const QList<Core::IVersionControl *> &versionControls,
QFutureInterface<QList<FileNode *>> *future = nullptr);
bool supportsAction(ProjectAction action, Node *node) const override;
bool supportsAction(ProjectAction action, const Node *node) const override;
private:
FileType m_fileType;
......@@ -257,7 +255,7 @@ public:
virtual QString addFileFilter() const;
bool supportsAction(ProjectAction action, Node *node) const override;
bool supportsAction(ProjectAction action, const Node *node) const override;
virtual bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0);
virtual bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
......@@ -323,7 +321,7 @@ public:
bool deleteFiles(const QStringList &filePaths) override;
bool canRenameFile(const QString &filePath, const QString &newFilePath) override;
bool renameFile(const QString &filePath, const QString &newFilePath) override;
bool supportsAction(ProjectAction action, Node *node) const override;
bool supportsAction(ProjectAction action, const Node *node) const override;
// by default returns false
virtual bool deploysFolder(const QString &folder) const;
......@@ -345,7 +343,7 @@ public:
ContainerNode(Project *project);
QString displayName() const final;
bool supportsAction(ProjectAction action, Node *node) const final;
bool supportsAction(ProjectAction action, const Node *node) const final;
ContainerNode *asContainerNode() final { return this; }
const ContainerNode *asContainerNode() const final { return this; }
......
......@@ -103,8 +103,9 @@ Project *ProjectTree::currentProject()
return s_instance->m_currentProject;
}
Node *ProjectTree::currentNode()
Node *ProjectTree::findCurrentNode()
{
s_instance->update();
return s_instance->m_currentNode;
}
......
......@@ -51,7 +51,7 @@ public:
static ProjectTree *instance();
static Project *currentProject();
static Node *currentNode();
static Node *findCurrentNode();
// Integration with ProjectTreeWidget
static void registerWidget(Internal::ProjectTreeWidget *widget);
......@@ -102,7 +102,7 @@ private:
static ProjectTree *s_instance;
QList<QPointer<Internal::ProjectTreeWidget>> m_projectTreeWidgets;
QVector<TreeManagerFunction> m_treeManagers;
QPointer<Node> m_currentNode;
Node *m_currentNode = nullptr;
Project *m_currentProject = nullptr;
Internal::ProjectTreeWidget *m_focusForContextMenu = nullptr;
Core::Context m_lastProjectContext;
......
......@@ -279,7 +279,7 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent) : QWidget(parent)
connect(m_toggleSync, &QAbstractButton::clicked,
this, &ProjectTreeWidget::toggleAutoSynchronization);
setCurrentItem(ProjectTree::currentNode());
setCurrentItem(ProjectTree::findCurrentNode());
setAutoSynchronization(true);
m_projectTreeWidgets << this;
......
......@@ -67,20 +67,20 @@ static QIcon generateIcon(const QString &overlay)
namespace QbsProjectManager {
namespace Internal {
static QbsProjectNode *parentQbsProjectNode(ProjectExplorer::Node *node)
static const QbsProjectNode *parentQbsProjectNode(const ProjectExplorer::Node *node)
{
for (ProjectExplorer::FolderNode *pn = node->managingProject(); pn; pn = pn->parentProjectNode()) {
QbsProjectNode *prjNode = dynamic_cast<QbsProjectNode *>(pn);
for (const ProjectExplorer::FolderNode *pn = node->managingProject(); pn; pn = pn->parentProjectNode()) {
const QbsProjectNode *prjNode = dynamic_cast<const QbsProjectNode *>(pn);
if (prjNode)
return prjNode;
}
return 0;
}
static QbsProductNode *parentQbsProductNode(ProjectExplorer::Node *node)
static const QbsProductNode *parentQbsProductNode(const ProjectExplorer::Node *node)
{
for (; node; node = node->parentFolderNode()) {
QbsProductNode *prdNode = dynamic_cast<QbsProductNode *>(node);
const QbsProductNode *prdNode = dynamic_cast<const QbsProductNode *>(node);
if (prdNode)
return prdNode;
}
......@@ -225,7 +225,7 @@ public:
};
static bool supportsNodeAction(ProjectAction action, Node *node)
static bool supportsNodeAction(ProjectAction action, const Node *node)
{
const QbsProject * const project = parentQbsProjectNode(node)->project();
if (!project->isProjectEditable())
......@@ -270,7 +270,7 @@ QbsFolderNode::QbsFolderNode(const Utils::FileName &folderPath, ProjectExplorer:
{
}
bool QbsFolderNode::supportsAction(ProjectAction action, Node *node) const
bool QbsFolderNode::supportsAction(ProjectAction action, const Node *node) const
{
return supportsNodeAction(action, node);
}
......@@ -302,7 +302,7 @@ QbsGroupNode::QbsGroupNode(const qbs::GroupData &grp, const QString &productPath
m_qbsGroupData = grp;
}
bool QbsGroupNode::supportsAction(ProjectAction action, Node *node) const
bool QbsGroupNode::supportsAction(ProjectAction action, const Node *node) const
{
if (action == AddNewFile || action == AddExistingFile)
return true;
......@@ -316,13 +316,13 @@ bool QbsGroupNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
if (!notAdded)
notAdded = &notAddedDummy;
QbsProjectNode *prjNode = parentQbsProjectNode(this);
const QbsProjectNode *prjNode = parentQbsProjectNode(this);
if (!prjNode || !prjNode->qbsProject().isValid()) {
*notAdded += filePaths;
return false;
}
QbsProductNode *prdNode = parentQbsProductNode(this);
const QbsProductNode *prdNode = parentQbsProductNode(this);
if (!prdNode || !prdNode->qbsProductData().isValid()) {
*notAdded += filePaths;
return false;
......@@ -338,13 +338,13 @@ bool QbsGroupNode::removeFiles(const QStringList &filePaths, QStringList *notRem
if (!notRemoved)
notRemoved = &notRemovedDummy;
QbsProjectNode *prjNode = parentQbsProjectNode(this);
const QbsProjectNode *prjNode = parentQbsProjectNode(this);
if (!prjNode || !prjNode->qbsProject().isValid()) {
*notRemoved += filePaths;
return false;
}
QbsProductNode *prdNode = parentQbsProductNode(this);
const QbsProductNode *prdNode = parentQbsProductNode(this);
if (!prdNode || !prdNode->qbsProductData().isValid()) {
*notRemoved += filePaths;
return false;
......@@ -356,10 +356,10 @@ bool QbsGroupNode::removeFiles(const QStringList &filePaths, QStringList *notRem
bool QbsGroupNode::renameFile(const QString &filePath, const QString &newFilePath)
{
QbsProjectNode * const prjNode = parentQbsProjectNode(this);
const QbsProjectNode *prjNode = parentQbsProjectNode(this);
if (!prjNode || !prjNode->qbsProject().isValid())
return false;
QbsProductNode * const prdNode = parentQbsProductNode(this);
const QbsProductNode *prdNode = parentQbsProductNode(this);
if (!prdNode || !prdNode->qbsProductData().isValid())
return false;
......@@ -384,7 +384,7 @@ bool QbsProductNode::showInSimpleTree() const
return true;
}
bool QbsProductNode::supportsAction(ProjectAction action, Node *node) const
bool QbsProductNode::supportsAction(ProjectAction action, const Node *node) const
{
if (action == AddNewFile || action == AddExistingFile)
return true;
......@@ -398,7 +398,7 @@ bool QbsProductNode::addFiles(const QStringList &filePaths, QStringList *notAdde
if (!notAdded)
notAdded = &notAddedDummy;
QbsProjectNode *prjNode = parentQbsProjectNode(this);
const QbsProjectNode *prjNode = parentQbsProjectNode(this);
if (!prjNode || !prjNode->qbsProject().isValid()) {
*notAdded += filePaths;
return false;
......@@ -418,7 +418,7 @@ bool QbsProductNode::removeFiles(const QStringList &filePaths, QStringList *notR
if (!notRemoved)
notRemoved = &notRemovedDummy;
QbsProjectNode *prjNode = parentQbsProjectNode(this);
const QbsProjectNode *prjNode = parentQbsProjectNode(this);
if (!prjNode || !prjNode->qbsProject().isValid()) {
*notRemoved += filePaths;
return false;
......@@ -435,7 +435,7 @@ bool QbsProductNode::removeFiles(const QStringList &filePaths, QStringList *notR
bool QbsProductNode::renameFile(const QString &filePath, const QString &newFilePath)
{
QbsProjectNode * const prjNode = parentQbsProjectNode(this);
const QbsProjectNode * prjNode = parentQbsProjectNode(this);
if (!prjNode || !prjNode->qbsProject().isValid())
return false;
const qbs::GroupData grp = findMainQbsGroup(m_qbsProductData);
......
......@@ -55,7 +55,7 @@ public:
const QString &displayName);
private:
bool supportsAction(ProjectExplorer::ProjectAction action, Node *node) const final;
bool supportsAction(ProjectExplorer::ProjectAction action, const Node *node) const final;
};
// ---------------------------------------------------------------------------
......@@ -81,7 +81,7 @@ class QbsGroupNode : public QbsBaseProjectNode
public:
QbsGroupNode(const qbs::GroupData &grp, const QString &productPath);
bool supportsAction(ProjectExplorer::ProjectAction action, Node *node) const final;
bool supportsAction(ProjectExplorer::ProjectAction action, const Node *node) const final;
bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0) override;
bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0) override;
bool renameFile(const QString &filePath, const QString &newFilePath) override;
......@@ -103,7 +103,7 @@ public: