ProjectExplorer: Remove Node::m_id

It was only used within cmake, in a role that is nowadays covered by
buildKey.

Change-Id: I4fd77c06a3bb8965db5235315cb017c7b548fbaa
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-02-25 17:32:26 +01:00
parent c1c3f74dee
commit 2aacf26a77
5 changed files with 11 additions and 35 deletions

View File

@@ -109,18 +109,12 @@ void noAutoAdditionNotify(const QStringList &filePaths, const ProjectExplorer::P
CMakeInputsNode::CMakeInputsNode(const Utils::FileName &cmakeLists) :
ProjectExplorer::ProjectNode(cmakeLists)
{
setNodeId(generateId(cmakeLists));
setPriority(Node::DefaultPriority - 10); // Bottom most!
setDisplayName(QCoreApplication::translate("CMakeFilesProjectNode", "CMake Modules"));
setIcon(QIcon(":/projectexplorer/images/session.png")); // TODO: Use a better icon!
setListInProject(false);
}
QByteArray CMakeInputsNode::generateId(const Utils::FileName &inputFile)
{
return inputFile.toString().toUtf8() + "/cmakeInputs";
}
bool CMakeInputsNode::showInSimpleTree() const
{
return true;
@@ -175,17 +169,16 @@ bool CMakeProjectNode::addFiles(const QStringList &filePaths, QStringList *)
}
CMakeTargetNode::CMakeTargetNode(const Utils::FileName &directory, const QString &target) :
ProjectExplorer::ProjectNode(directory)
ProjectExplorer::ProjectNode(directory), m_target(target)
{
setNodeId(generateId(directory, target));
setPriority(Node::DefaultProjectPriority + 900);
setIcon(QIcon(":/projectexplorer/images/build.png")); // TODO: Use proper icon!
setListInProject(false);
}
QByteArray CMakeTargetNode::generateId(const Utils::FileName &directory, const QString &target)
QString CMakeTargetNode::generateId(const Utils::FileName &directory, const QString &target)
{
return directory.toString().toUtf8() + "///::///" + target.toUtf8();
return directory.toString() + "///::///" + target;
}
bool CMakeTargetNode::showInSimpleTree() const
@@ -200,7 +193,7 @@ QString CMakeTargetNode::tooltip() const
QString CMakeTargetNode::buildKey() const
{
return QString::fromUtf8(id());
return generateId(filePath(), m_target);
}
bool CMakeTargetNode::supportsAction(ProjectExplorer::ProjectAction action,

View File

@@ -35,8 +35,6 @@ class CMakeInputsNode : public ProjectExplorer::ProjectNode
public:
CMakeInputsNode(const Utils::FileName &cmakeLists);
static QByteArray generateId(const Utils::FileName &inputFile);
bool showInSimpleTree() const final;
};
@@ -66,7 +64,7 @@ class CMakeTargetNode : public ProjectExplorer::ProjectNode
public:
CMakeTargetNode(const Utils::FileName &directory, const QString &target);
static QByteArray generateId(const Utils::FileName &directory, const QString &target);
static QString generateId(const Utils::FileName &directory, const QString &target);
void setTargetInformation(const QList<Utils::FileName> &artifacts, const QString &type);
@@ -80,6 +78,7 @@ public:
private:
QString m_tooltip;
QString m_target;
};
} // namespace Internal

View File

@@ -840,10 +840,10 @@ static CMakeTargetNode *createTargetNode(const QHash<Utils::FileName, ProjectNod
ProjectNode *cmln = cmakeListsNodes.value(dir);
QTC_ASSERT(cmln, return nullptr);
QByteArray targetId = CMakeTargetNode::generateId(dir, displayName);
QString targetId = CMakeTargetNode::generateId(dir, displayName);
CMakeTargetNode *tn = static_cast<CMakeTargetNode *>(cmln->findNode([&targetId](const Node *n) {
return n->id() == targetId;
return n->buildKey() == targetId;
}));
if (!tn) {
auto newNode = std::make_unique<CMakeTargetNode>(dir, displayName);

View File

@@ -128,11 +128,6 @@ void Node::setPriority(int p)
m_priority = p;
}
void Node::setNodeId(const QByteArray &nodeId)
{
m_nodeId = nodeId;
}
void Node::setFilePath(const Utils::FileName &filePath)
{
m_filePath = filePath;
@@ -237,11 +232,6 @@ int Node::line() const
return m_line;
}
QByteArray Node::id() const
{
return m_nodeId;
}
QString Node::displayName() const
{
return filePath().fileName();
@@ -346,7 +336,6 @@ FileNode *FileNode::clone() const
{
auto fn = new FileNode(filePath(), fileType());
fn->setLine(line());
fn->setNodeId(id());
fn->setIsGenerated(isGenerated());
fn->setEnabled(isEnabled());
fn->setPriority(priority());
@@ -794,12 +783,10 @@ bool FolderNode::showWhenEmpty() const
\sa ProjectExplorer::FileNode, ProjectExplorer::ProjectNode
*/
VirtualFolderNode::VirtualFolderNode(const Utils::FileName &folderPath, int priority,
const QByteArray &id) :
VirtualFolderNode::VirtualFolderNode(const Utils::FileName &folderPath, int priority) :
FolderNode(folderPath, NodeType::VirtualFolder, QString())
{
setPriority(priority);
setNodeId(id);
}
QString VirtualFolderNode::addFileFilter() const

View File

@@ -127,7 +127,6 @@ public:
const Utils::FileName &filePath() const; // file system path
int line() const;
QByteArray id() const;
virtual QString displayName() const;
virtual QString tooltip() const;
bool isEnabled() const;
@@ -164,13 +163,11 @@ protected:
void setPriority(int priority);
void setLine(int line);
void setNodeId(const QByteArray &nodeId);
void setFilePath(const Utils::FileName &filePath);
private:
FolderNode *m_parentFolderNode = nullptr;
Utils::FileName m_filePath;
QByteArray m_nodeId;
int m_line = -1;
int m_priority = DefaultPriority;
const NodeType m_nodeType;
@@ -310,8 +307,7 @@ private:
class PROJECTEXPLORER_EXPORT VirtualFolderNode : public FolderNode
{
public:
explicit VirtualFolderNode(const Utils::FileName &folderPath, int priority,
const QByteArray &id = {});
explicit VirtualFolderNode(const Utils::FileName &folderPath, int priority);
void setAddFileFilter(const QString &filter) { m_addFileFilter = filter; }
QString addFileFilter() const override;
@@ -356,6 +352,7 @@ public:
protected:
explicit ProjectNode(const Utils::FileName &projectFilePath);
QString m_target;
};
class PROJECTEXPLORER_EXPORT ContainerNode : public FolderNode