forked from qt-creator/qt-creator
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:
@@ -109,18 +109,12 @@ void noAutoAdditionNotify(const QStringList &filePaths, const ProjectExplorer::P
|
|||||||
CMakeInputsNode::CMakeInputsNode(const Utils::FileName &cmakeLists) :
|
CMakeInputsNode::CMakeInputsNode(const Utils::FileName &cmakeLists) :
|
||||||
ProjectExplorer::ProjectNode(cmakeLists)
|
ProjectExplorer::ProjectNode(cmakeLists)
|
||||||
{
|
{
|
||||||
setNodeId(generateId(cmakeLists));
|
|
||||||
setPriority(Node::DefaultPriority - 10); // Bottom most!
|
setPriority(Node::DefaultPriority - 10); // Bottom most!
|
||||||
setDisplayName(QCoreApplication::translate("CMakeFilesProjectNode", "CMake Modules"));
|
setDisplayName(QCoreApplication::translate("CMakeFilesProjectNode", "CMake Modules"));
|
||||||
setIcon(QIcon(":/projectexplorer/images/session.png")); // TODO: Use a better icon!
|
setIcon(QIcon(":/projectexplorer/images/session.png")); // TODO: Use a better icon!
|
||||||
setListInProject(false);
|
setListInProject(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray CMakeInputsNode::generateId(const Utils::FileName &inputFile)
|
|
||||||
{
|
|
||||||
return inputFile.toString().toUtf8() + "/cmakeInputs";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CMakeInputsNode::showInSimpleTree() const
|
bool CMakeInputsNode::showInSimpleTree() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@@ -175,17 +169,16 @@ bool CMakeProjectNode::addFiles(const QStringList &filePaths, QStringList *)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CMakeTargetNode::CMakeTargetNode(const Utils::FileName &directory, const QString &target) :
|
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);
|
setPriority(Node::DefaultProjectPriority + 900);
|
||||||
setIcon(QIcon(":/projectexplorer/images/build.png")); // TODO: Use proper icon!
|
setIcon(QIcon(":/projectexplorer/images/build.png")); // TODO: Use proper icon!
|
||||||
setListInProject(false);
|
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
|
bool CMakeTargetNode::showInSimpleTree() const
|
||||||
@@ -200,7 +193,7 @@ QString CMakeTargetNode::tooltip() const
|
|||||||
|
|
||||||
QString CMakeTargetNode::buildKey() const
|
QString CMakeTargetNode::buildKey() const
|
||||||
{
|
{
|
||||||
return QString::fromUtf8(id());
|
return generateId(filePath(), m_target);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMakeTargetNode::supportsAction(ProjectExplorer::ProjectAction action,
|
bool CMakeTargetNode::supportsAction(ProjectExplorer::ProjectAction action,
|
||||||
|
@@ -35,8 +35,6 @@ class CMakeInputsNode : public ProjectExplorer::ProjectNode
|
|||||||
public:
|
public:
|
||||||
CMakeInputsNode(const Utils::FileName &cmakeLists);
|
CMakeInputsNode(const Utils::FileName &cmakeLists);
|
||||||
|
|
||||||
static QByteArray generateId(const Utils::FileName &inputFile);
|
|
||||||
|
|
||||||
bool showInSimpleTree() const final;
|
bool showInSimpleTree() const final;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -66,7 +64,7 @@ class CMakeTargetNode : public ProjectExplorer::ProjectNode
|
|||||||
public:
|
public:
|
||||||
CMakeTargetNode(const Utils::FileName &directory, const QString &target);
|
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);
|
void setTargetInformation(const QList<Utils::FileName> &artifacts, const QString &type);
|
||||||
|
|
||||||
@@ -80,6 +78,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_tooltip;
|
QString m_tooltip;
|
||||||
|
QString m_target;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -840,10 +840,10 @@ static CMakeTargetNode *createTargetNode(const QHash<Utils::FileName, ProjectNod
|
|||||||
ProjectNode *cmln = cmakeListsNodes.value(dir);
|
ProjectNode *cmln = cmakeListsNodes.value(dir);
|
||||||
QTC_ASSERT(cmln, return nullptr);
|
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) {
|
CMakeTargetNode *tn = static_cast<CMakeTargetNode *>(cmln->findNode([&targetId](const Node *n) {
|
||||||
return n->id() == targetId;
|
return n->buildKey() == targetId;
|
||||||
}));
|
}));
|
||||||
if (!tn) {
|
if (!tn) {
|
||||||
auto newNode = std::make_unique<CMakeTargetNode>(dir, displayName);
|
auto newNode = std::make_unique<CMakeTargetNode>(dir, displayName);
|
||||||
|
@@ -128,11 +128,6 @@ void Node::setPriority(int p)
|
|||||||
m_priority = p;
|
m_priority = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setNodeId(const QByteArray &nodeId)
|
|
||||||
{
|
|
||||||
m_nodeId = nodeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Node::setFilePath(const Utils::FileName &filePath)
|
void Node::setFilePath(const Utils::FileName &filePath)
|
||||||
{
|
{
|
||||||
m_filePath = filePath;
|
m_filePath = filePath;
|
||||||
@@ -237,11 +232,6 @@ int Node::line() const
|
|||||||
return m_line;
|
return m_line;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Node::id() const
|
|
||||||
{
|
|
||||||
return m_nodeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Node::displayName() const
|
QString Node::displayName() const
|
||||||
{
|
{
|
||||||
return filePath().fileName();
|
return filePath().fileName();
|
||||||
@@ -346,7 +336,6 @@ FileNode *FileNode::clone() const
|
|||||||
{
|
{
|
||||||
auto fn = new FileNode(filePath(), fileType());
|
auto fn = new FileNode(filePath(), fileType());
|
||||||
fn->setLine(line());
|
fn->setLine(line());
|
||||||
fn->setNodeId(id());
|
|
||||||
fn->setIsGenerated(isGenerated());
|
fn->setIsGenerated(isGenerated());
|
||||||
fn->setEnabled(isEnabled());
|
fn->setEnabled(isEnabled());
|
||||||
fn->setPriority(priority());
|
fn->setPriority(priority());
|
||||||
@@ -794,12 +783,10 @@ bool FolderNode::showWhenEmpty() const
|
|||||||
|
|
||||||
\sa ProjectExplorer::FileNode, ProjectExplorer::ProjectNode
|
\sa ProjectExplorer::FileNode, ProjectExplorer::ProjectNode
|
||||||
*/
|
*/
|
||||||
VirtualFolderNode::VirtualFolderNode(const Utils::FileName &folderPath, int priority,
|
VirtualFolderNode::VirtualFolderNode(const Utils::FileName &folderPath, int priority) :
|
||||||
const QByteArray &id) :
|
|
||||||
FolderNode(folderPath, NodeType::VirtualFolder, QString())
|
FolderNode(folderPath, NodeType::VirtualFolder, QString())
|
||||||
{
|
{
|
||||||
setPriority(priority);
|
setPriority(priority);
|
||||||
setNodeId(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VirtualFolderNode::addFileFilter() const
|
QString VirtualFolderNode::addFileFilter() const
|
||||||
|
@@ -127,7 +127,6 @@ public:
|
|||||||
|
|
||||||
const Utils::FileName &filePath() const; // file system path
|
const Utils::FileName &filePath() const; // file system path
|
||||||
int line() const;
|
int line() const;
|
||||||
QByteArray id() const;
|
|
||||||
virtual QString displayName() const;
|
virtual QString displayName() const;
|
||||||
virtual QString tooltip() const;
|
virtual QString tooltip() const;
|
||||||
bool isEnabled() const;
|
bool isEnabled() const;
|
||||||
@@ -164,13 +163,11 @@ protected:
|
|||||||
|
|
||||||
void setPriority(int priority);
|
void setPriority(int priority);
|
||||||
void setLine(int line);
|
void setLine(int line);
|
||||||
void setNodeId(const QByteArray &nodeId);
|
|
||||||
void setFilePath(const Utils::FileName &filePath);
|
void setFilePath(const Utils::FileName &filePath);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FolderNode *m_parentFolderNode = nullptr;
|
FolderNode *m_parentFolderNode = nullptr;
|
||||||
Utils::FileName m_filePath;
|
Utils::FileName m_filePath;
|
||||||
QByteArray m_nodeId;
|
|
||||||
int m_line = -1;
|
int m_line = -1;
|
||||||
int m_priority = DefaultPriority;
|
int m_priority = DefaultPriority;
|
||||||
const NodeType m_nodeType;
|
const NodeType m_nodeType;
|
||||||
@@ -310,8 +307,7 @@ private:
|
|||||||
class PROJECTEXPLORER_EXPORT VirtualFolderNode : public FolderNode
|
class PROJECTEXPLORER_EXPORT VirtualFolderNode : public FolderNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit VirtualFolderNode(const Utils::FileName &folderPath, int priority,
|
explicit VirtualFolderNode(const Utils::FileName &folderPath, int priority);
|
||||||
const QByteArray &id = {});
|
|
||||||
|
|
||||||
void setAddFileFilter(const QString &filter) { m_addFileFilter = filter; }
|
void setAddFileFilter(const QString &filter) { m_addFileFilter = filter; }
|
||||||
QString addFileFilter() const override;
|
QString addFileFilter() const override;
|
||||||
@@ -356,6 +352,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit ProjectNode(const Utils::FileName &projectFilePath);
|
explicit ProjectNode(const Utils::FileName &projectFilePath);
|
||||||
|
QString m_target;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT ContainerNode : public FolderNode
|
class PROJECTEXPLORER_EXPORT ContainerNode : public FolderNode
|
||||||
|
Reference in New Issue
Block a user