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);