summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2016-11-09 13:39:59 +0100
committerTobias Hunger <tobias.hunger@qt.io>2016-11-10 15:24:14 +0000
commitad003363b7e27d2d55b7c29dacaa3fca10b07045 (patch)
treeb13dc6bc82aac97771c179ee641f30826021755d /src
parentc7b0163fcbe1019bca4efb57d1e298c8c206f47e (diff)
downloadqt-creator-ad003363b7e27d2d55b7c29dacaa3fca10b07045.tar.gz
ProjectExplorer: Rename Node::projectNode to Node::parentProjectNode
Change-Id: I47fa794a0bd8456ae23271934a957d9667d2d7bb Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp10
-rw-r--r--src/plugins/projectexplorer/projectnodes.cpp34
-rw-r--r--src/plugins/projectexplorer/projectnodes.h2
-rw-r--r--src/plugins/projectexplorer/projecttree.cpp4
-rw-r--r--src/plugins/qbsprojectmanager/qbsnodes.cpp4
-rw-r--r--src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp12
-rw-r--r--src/plugins/qmakeprojectmanager/qmakenodes.cpp6
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp2
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp4
-rw-r--r--src/plugins/qmldesigner/documentmanager.cpp4
-rw-r--r--src/plugins/resourceeditor/resourcenode.cpp2
-rw-r--r--src/plugins/todo/todoitemsprovider.cpp2
12 files changed, 44 insertions, 42 deletions
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 7c174a44c8..775ac704fd 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -2914,7 +2914,7 @@ void ProjectExplorerPluginPrivate::updateContextMenuActions()
Node *currentNode = ProjectTree::currentNode();
- if (currentNode && currentNode->projectNode()) {
+ if (currentNode && currentNode->parentProjectNode()) {
QList<ProjectAction> actions = currentNode->supportedActions(currentNode);
if (ProjectNode *pn = currentNode->asProjectNode()) {
@@ -3082,7 +3082,7 @@ void ProjectExplorerPlugin::addExistingFiles(FolderNode *folderNode, const QStri
if (!notAdded.isEmpty()) {
const QString message = tr("Could not add following files to project %1:")
- .arg(folderNode->projectNode()->displayName()) + QLatin1Char('\n');
+ .arg(folderNode->parentProjectNode()->displayName()) + QLatin1Char('\n');
const QStringList nativeFiles
= Utils::transform(notAdded,
[](const QString &f) { return QDir::toNativeSeparators(f); });
@@ -3100,7 +3100,7 @@ void ProjectExplorerPluginPrivate::removeProject()
Node *node = ProjectTree::currentNode();
if (!node)
return;
- ProjectNode *subProjectNode = node->projectNode();
+ ProjectNode *subProjectNode = node->parentProjectNode();
if (!subProjectNode)
return;
ProjectNode *projectNode = subProjectNode->parentFolderNode()->asProjectNode();
@@ -3157,7 +3157,7 @@ void ProjectExplorerPluginPrivate::removeFile()
QMessageBox::warning(ICore::mainWindow(), tr("Removing File Failed"),
tr("Could not remove file %1 from project %2.")
.arg(QDir::toNativeSeparators(filePath))
- .arg(folderNode->projectNode()->displayName()));
+ .arg(folderNode->parentProjectNode()->displayName()));
if (!deleteFile)
return;
}
@@ -3251,7 +3251,7 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &newFilePath)
{
const QString oldFilePath = node->filePath().toFileInfo().absoluteFilePath();
FolderNode *folderNode = node->parentFolderNode();
- const QString projectFileName = folderNode->projectNode()->filePath().fileName();
+ const QString projectFileName = folderNode->parentProjectNode()->filePath().fileName();
if (oldFilePath == newFilePath)
return;
diff --git a/src/plugins/projectexplorer/projectnodes.cpp b/src/plugins/projectexplorer/projectnodes.cpp
index da2ab831d1..abcd193138 100644
--- a/src/plugins/projectexplorer/projectnodes.cpp
+++ b/src/plugins/projectexplorer/projectnodes.cpp
@@ -96,7 +96,7 @@ NodeType Node::nodeType() const
The project that owns and manages the node. It is the first project in the list
of ancestors.
*/
-ProjectNode *Node::projectNode() const
+ProjectNode *Node::parentProjectNode() const
{
return m_projectNode;
}
@@ -485,36 +485,36 @@ QString FolderNode::addFileFilter() const
bool FolderNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
{
- if (projectNode())
- return projectNode()->addFiles(filePaths, notAdded);
+ if (parentProjectNode())
+ return parentProjectNode()->addFiles(filePaths, notAdded);
return false;
}
bool FolderNode::removeFiles(const QStringList &filePaths, QStringList *notRemoved)
{
- if (projectNode())
- return projectNode()->removeFiles(filePaths, notRemoved);
+ if (parentProjectNode())
+ return parentProjectNode()->removeFiles(filePaths, notRemoved);
return false;
}
bool FolderNode::deleteFiles(const QStringList &filePaths)
{
- if (projectNode())
- return projectNode()->deleteFiles(filePaths);
+ if (parentProjectNode())
+ return parentProjectNode()->deleteFiles(filePaths);
return false;
}
bool FolderNode::canRenameFile(const QString &filePath, const QString &newFilePath)
{
- if (projectNode())
- return projectNode()->canRenameFile(filePath, newFilePath);
+ if (parentProjectNode())
+ return parentProjectNode()->canRenameFile(filePath, newFilePath);
return false;
}
bool FolderNode::renameFile(const QString &filePath, const QString &newFilePath)
{
- if (projectNode())
- return projectNode()->renameFile(filePath, newFilePath);
+ if (parentProjectNode())
+ return parentProjectNode()->renameFile(filePath, newFilePath);
return false;
}
@@ -534,7 +534,7 @@ FolderNode::AddNewInformation FolderNode::addNewInformation(const QStringList &f
void FolderNode::addFileNodes(const QList<FileNode *> &files)
{
- Q_ASSERT(projectNode());
+ Q_ASSERT(parentProjectNode());
if (files.isEmpty())
return;
@@ -545,7 +545,7 @@ void FolderNode::addFileNodes(const QList<FileNode *> &files)
qDebug("File node has already a parent folder"));
file->setParentFolderNode(this);
- file->setProjectNode(projectNode());
+ file->setProjectNode(parentProjectNode());
// Now find the correct place to insert file
if (m_fileNodes.count() == 0
|| m_fileNodes.last() < file) {
@@ -570,7 +570,7 @@ void FolderNode::addFileNodes(const QList<FileNode *> &files)
void FolderNode::removeFileNodes(const QList<FileNode *> &files)
{
- Q_ASSERT(projectNode());
+ Q_ASSERT(parentProjectNode());
if (files.isEmpty())
return;
@@ -601,7 +601,7 @@ void FolderNode::removeFileNodes(const QList<FileNode *> &files)
*/
void FolderNode::addFolderNodes(const QList<FolderNode*> &subFolders)
{
- Q_ASSERT(projectNode());
+ Q_ASSERT(parentProjectNode());
if (subFolders.isEmpty())
return;
@@ -611,7 +611,7 @@ void FolderNode::addFolderNodes(const QList<FolderNode*> &subFolders)
QTC_ASSERT(!folder->parentFolderNode(),
qDebug("Project node has already a parent folder"));
folder->setParentFolderNode(this);
- folder->setProjectNode(projectNode());
+ folder->setProjectNode(parentProjectNode());
// Find the correct place to insert
if (m_folderNodes.count() == 0
@@ -640,7 +640,7 @@ void FolderNode::addFolderNodes(const QList<FolderNode*> &subFolders)
*/
void FolderNode::removeFolderNodes(const QList<FolderNode*> &subFolders)
{
- Q_ASSERT(projectNode());
+ Q_ASSERT(parentProjectNode());
if (subFolders.isEmpty())
return;
diff --git a/src/plugins/projectexplorer/projectnodes.h b/src/plugins/projectexplorer/projectnodes.h
index bdc283e7af..547ab7e1b0 100644
--- a/src/plugins/projectexplorer/projectnodes.h
+++ b/src/plugins/projectexplorer/projectnodes.h
@@ -109,7 +109,7 @@ class PROJECTEXPLORER_EXPORT Node
public:
virtual ~Node() = default;
NodeType nodeType() const;
- ProjectNode *projectNode() const; // managing project
+ ProjectNode *parentProjectNode() const; // managing project
FolderNode *parentFolderNode() const; // parent folder or project
const Utils::FileName &filePath() const; // file system path
int line() const;
diff --git a/src/plugins/projectexplorer/projecttree.cpp b/src/plugins/projectexplorer/projecttree.cpp
index c7f09ff022..1ec856c651 100644
--- a/src/plugins/projectexplorer/projecttree.cpp
+++ b/src/plugins/projectexplorer/projecttree.cpp
@@ -341,10 +341,10 @@ void ProjectTree::emitFoldersAboutToBeRemoved(FolderNode *parentFolder, const QL
while (n) {
if (FolderNode *fn = n->asFolderNode()) {
if (staleFolders.contains(fn)) {
- ProjectNode *pn = n->projectNode();
+ ProjectNode *pn = n->parentProjectNode();
// Make sure the node we are switching too isn't going to be removed also
while (staleFolders.contains(pn))
- pn = pn->parentFolderNode()->projectNode();
+ pn = pn->parentFolderNode()->parentProjectNode();
m_resetCurrentNodeFolder = true;
break;
}
diff --git a/src/plugins/qbsprojectmanager/qbsnodes.cpp b/src/plugins/qbsprojectmanager/qbsnodes.cpp
index 8898e753ef..93055f492f 100644
--- a/src/plugins/qbsprojectmanager/qbsnodes.cpp
+++ b/src/plugins/qbsprojectmanager/qbsnodes.cpp
@@ -87,7 +87,7 @@ QIcon QbsProductNode::m_productIcon;
static QbsProjectNode *parentQbsProjectNode(ProjectExplorer::Node *node)
{
- for (ProjectExplorer::FolderNode *pn = node->projectNode(); pn; pn = pn->parentFolderNode()) {
+ for (ProjectExplorer::FolderNode *pn = node->parentProjectNode(); pn; pn = pn->parentFolderNode()) {
QbsProjectNode *prjNode = dynamic_cast<QbsProjectNode *>(pn);
if (prjNode)
return prjNode;
@@ -719,7 +719,7 @@ void QbsProductNode::setQbsProductData(const qbs::Project &project, const qbs::P
QList<ProjectExplorer::RunConfiguration *> QbsProductNode::runConfigurations() const
{
QList<ProjectExplorer::RunConfiguration *> result;
- QbsProjectNode *pn = dynamic_cast<QbsProjectNode *>(projectNode());
+ QbsProjectNode *pn = dynamic_cast<QbsProjectNode *>(parentProjectNode());
if (!isEnabled() || !pn || m_qbsProductData.targetExecutable().isEmpty())
return result;
diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
index b12a71fe39..b078fc6b7e 100644
--- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
+++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
@@ -259,7 +259,9 @@ void QbsProjectManagerPlugin::updateContextActions()
&& m_selectedNode && m_selectedNode->isEnabled();
bool isFile = m_selectedProject && m_selectedNode && (m_selectedNode->nodeType() == NodeType::File);
- bool isProduct = m_selectedProject && m_selectedNode && dynamic_cast<QbsProductNode *>(m_selectedNode->projectNode());
+ bool isProduct = m_selectedProject
+ && m_selectedNode
+ && dynamic_cast<QbsProductNode *>(m_selectedNode->parentProjectNode());
QbsProjectNode *subproject = dynamic_cast<QbsProjectNode *>(m_selectedNode);
bool isSubproject = m_selectedProject && subproject && subproject != m_selectedProject->rootProjectNode();
@@ -293,10 +295,10 @@ void QbsProjectManagerPlugin::updateBuildActions()
&& !m_editorProject->isParsing();
fileName = m_editorNode->filePath().fileName();
- fileVisible = m_editorProject && m_editorNode && dynamic_cast<QbsBaseProjectNode *>(m_editorNode->projectNode());
+ fileVisible = m_editorProject && m_editorNode && dynamic_cast<QbsBaseProjectNode *>(m_editorNode->parentProjectNode());
QbsProductNode *productNode
- = dynamic_cast<QbsProductNode *>(m_editorNode ? m_editorNode->projectNode() : 0);
+ = dynamic_cast<QbsProductNode *>(m_editorNode ? m_editorNode->parentProjectNode() : 0);
if (productNode) {
productVisible = true;
productName = productNode->displayName();
@@ -393,7 +395,7 @@ void QbsProjectManagerPlugin::buildProduct()
if (!m_editorProject || !m_editorNode)
return;
- QbsProductNode *product = dynamic_cast<QbsProductNode *>(m_editorNode->projectNode());
+ QbsProductNode *product = dynamic_cast<QbsProductNode *>(m_editorNode->parentProjectNode());
if (!product)
return;
@@ -423,7 +425,7 @@ void QbsProjectManagerPlugin::buildSubproject()
return;
QbsProjectNode *subproject = 0;
- QbsBaseProjectNode *start = dynamic_cast<QbsBaseProjectNode *>(m_editorNode->projectNode());
+ QbsBaseProjectNode *start = dynamic_cast<QbsBaseProjectNode *>(m_editorNode->parentProjectNode());
while (start && start != m_editorProject->rootProjectNode()) {
QbsProjectNode *tmp = dynamic_cast<QbsProjectNode *>(start);
if (tmp) {
diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp
index 387cadd63f..9f5b495060 100644
--- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp
@@ -578,7 +578,7 @@ struct InternalNode
nodesToAdd.reserve(resourcesToAdd.size());
foreach (const FileName &file, resourcesToAdd) {
- auto vfs = static_cast<QmakePriFileNode *>(folder->projectNode())->m_project->qmakeVfs();
+ auto vfs = static_cast<QmakePriFileNode *>(folder->parentProjectNode())->m_project->qmakeVfs();
QString contents;
// Prefer the cumulative file if it's non-empty, based on the assumption
// that it contains more "stuff".
@@ -1110,7 +1110,7 @@ bool QmakePriFileNode::renameFile(const QString &filePath, const QString &newFil
FolderNode::AddNewInformation QmakePriFileNode::addNewInformation(const QStringList &files, Node *context) const
{
Q_UNUSED(files)
- return FolderNode::AddNewInformation(filePath().fileName(), context && context->projectNode() == this ? 120 : 90);
+ return FolderNode::AddNewInformation(filePath().fileName(), context && context->parentProjectNode() == this ? 120 : 90);
}
bool QmakePriFileNode::priFileWritable(const QString &path)
@@ -1637,7 +1637,7 @@ bool QmakeProFileNode::showInSimpleTree() const
FolderNode::AddNewInformation QmakeProFileNode::addNewInformation(const QStringList &files, Node *context) const
{
Q_UNUSED(files)
- return AddNewInformation(filePath().fileName(), context && context->projectNode() == this ? 120 : 100);
+ return AddNewInformation(filePath().fileName(), context && context->parentProjectNode() == this ? 120 : 100);
}
bool QmakeProFileNode::showInSimpleTree(QmakeProjectType projectType) const
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp
index 2bdf16f76c..aa9f96d423 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp
@@ -221,7 +221,7 @@ void QmakeManager::buildFile()
Project *project = SessionManager::projectForFile(file);
if (project && node)
- handleSubDirContextMenu(BUILD, true, project, node->projectNode(), node);
+ handleSubDirContextMenu(BUILD, true, project, node->parentProjectNode(), node);
}
}
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
index bd6ed110b9..30ba229d27 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
@@ -323,7 +323,7 @@ void QmakeProjectManagerPlugin::updateContextActions(ProjectExplorer::Node *node
auto qmakeProject = qobject_cast<QmakeProject *>(project);
QmakeProFileNode *subProjectNode = nullptr;
if (node) {
- if (auto subPriFileNode = dynamic_cast<QmakePriFileNode *>(node->projectNode()))
+ if (auto subPriFileNode = dynamic_cast<QmakePriFileNode *>(node->parentProjectNode()))
subProjectNode = subPriFileNode->proFileNode();
}
ProjectExplorer::FileNode *fileNode = node ? node->asFileNode() : nullptr;
@@ -397,7 +397,7 @@ void QmakeProjectManagerPlugin::updateBuildFileAction()
m_buildFileAction->setParameter(file.fileName());
visible = qobject_cast<QmakeProject *>(project)
&& node
- && dynamic_cast<QmakePriFileNode *>(node->projectNode());
+ && dynamic_cast<QmakePriFileNode *>(node->parentProjectNode());
enabled = !BuildManager::isBuilding(project);
}
diff --git a/src/plugins/qmldesigner/documentmanager.cpp b/src/plugins/qmldesigner/documentmanager.cpp
index af48686126..1caa8c433d 100644
--- a/src/plugins/qmldesigner/documentmanager.cpp
+++ b/src/plugins/qmldesigner/documentmanager.cpp
@@ -399,7 +399,7 @@ void DocumentManager::findPathToIsoProFile(bool *iconResourceFileAlreadyExists,
qCDebug(documentManagerLog) << "Found" << isoIconsQrcFile << "in" << virtualFolderNode->filePath();
iconQrcFileNode = subFolderNode;
- *resourceFileProPath = iconQrcFileNode->projectNode()->filePath().toString();
+ *resourceFileProPath = iconQrcFileNode->parentProjectNode()->filePath().toString();
}
}
}
@@ -416,7 +416,7 @@ void DocumentManager::findPathToIsoProFile(bool *iconResourceFileAlreadyExists,
*resourceFilePath = project->projectDirectory().toString() + "/" + isoIconsQrcFile;
// We assume that the .pro containing the QML file is an acceptable place to add the .qrc file.
- ProjectExplorer::ProjectNode *projectNode = ProjectExplorer::SessionManager::nodeForFile(qmlFileName)->projectNode();
+ ProjectExplorer::ProjectNode *projectNode = ProjectExplorer::SessionManager::nodeForFile(qmlFileName)->parentProjectNode();
*resourceFileProPath = projectNode->filePath().toString();
} else {
// We found the QRC file that we want.
diff --git a/src/plugins/resourceeditor/resourcenode.cpp b/src/plugins/resourceeditor/resourcenode.cpp
index 6b408d2398..c91763be35 100644
--- a/src/plugins/resourceeditor/resourcenode.cpp
+++ b/src/plugins/resourceeditor/resourcenode.cpp
@@ -345,7 +345,7 @@ ProjectExplorer::FolderNode::AddNewInformation ResourceTopLevelNode::addNewInfor
p = 110;
if (context == this)
p = 120;
- else if (projectNode() == context)
+ else if (parentProjectNode() == context)
p = 150; // steal from our project node
// The ResourceFolderNode '/' defers to us, as otherwise
// two nodes would be responsible for '/'
diff --git a/src/plugins/todo/todoitemsprovider.cpp b/src/plugins/todo/todoitemsprovider.cpp
index 3bedefac05..858efa6731 100644
--- a/src/plugins/todo/todoitemsprovider.cpp
+++ b/src/plugins/todo/todoitemsprovider.cpp
@@ -146,7 +146,7 @@ void TodoItemsProvider::setItemsListWithinSubproject()
// TODO prefer current editor as source of sub-project
Node *node = ProjectTree::currentNode();
if (node) {
- ProjectNode *projectNode = node->projectNode();
+ ProjectNode *projectNode = node->parentProjectNode();
if (projectNode) {
FindAllFilesVisitor filesVisitor;