ProjectExplorer: Replace FolderNode ctor display argument

... by use of the setter.

Change-Id: Ie6bf15b4dfae4d4e4d98694313b6e7dc9a22c117
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-02-25 18:08:36 +01:00
parent 2aacf26a77
commit ffa88006a5
4 changed files with 11 additions and 13 deletions

View File

@@ -250,8 +250,9 @@ FolderNode *addChildFolderNode(FolderNode *parent, const QString &childName)
{
Utils::FileName parentPath = parent->filePath();
auto node = std::make_unique<FolderNode>(
parentPath.appendPath(childName), NodeType::Folder, childName);
parentPath.appendPath(childName), NodeType::Folder);
FolderNode *childNode = node.get();
childNode->setDisplayName(childName);
parent->addNode(std::move(node));
return childNode;

View File

@@ -422,17 +422,14 @@ bool FileNode::supportsAction(ProjectAction action, const Node *node) const
\sa ProjectExplorer::FileNode, ProjectExplorer::ProjectNode
*/
FolderNode::FolderNode(const Utils::FileName &folderPath, NodeType nodeType,
const QString &displayName) :
Node(nodeType),
m_displayName(displayName)
FolderNode::FolderNode(const Utils::FileName &folderPath, NodeType nodeType) :
Node(nodeType)
{
setFilePath(folderPath);
setPriority(DefaultFolderPriority);
setListInProject(false);
setIsGenerated(false);
if (m_displayName.isEmpty())
m_displayName = folderPath.toUserOutput();
m_displayName = folderPath.toUserOutput();
}
/*!
@@ -784,7 +781,7 @@ bool FolderNode::showWhenEmpty() const
\sa ProjectExplorer::FileNode, ProjectExplorer::ProjectNode
*/
VirtualFolderNode::VirtualFolderNode(const Utils::FileName &folderPath, int priority) :
FolderNode(folderPath, NodeType::VirtualFolder, QString())
FolderNode(folderPath, NodeType::VirtualFolder)
{
setPriority(priority);
}
@@ -810,10 +807,11 @@ QString VirtualFolderNode::addFileFilter() const
Creates an uninitialized project node object.
*/
ProjectNode::ProjectNode(const Utils::FileName &projectFilePath) :
FolderNode(projectFilePath, NodeType::Project, projectFilePath.fileName())
FolderNode(projectFilePath, NodeType::Project)
{
setPriority(DefaultProjectPriority);
setListInProject(true);
setDisplayName(projectFilePath.fileName());
}
bool ProjectNode::canAddSubProject(const QString &proFilePath) const

View File

@@ -206,8 +206,7 @@ private:
class PROJECTEXPLORER_EXPORT FolderNode : public Node
{
public:
explicit FolderNode(const Utils::FileName &folderPath, NodeType nodeType = NodeType::Folder,
const QString &displayName = QString());
explicit FolderNode(const Utils::FileName &folderPath, NodeType nodeType = NodeType::Folder);
QString displayName() const override;
QIcon icon() const;

View File

@@ -215,8 +215,8 @@ std::unique_ptr<QbsRootProjectNode> QbsNodeTreeBuilder::buildTree(QbsProject *pr
setupProjectNode(root.get(), project->qbsProjectData(), project->qbsProject());
auto buildSystemFiles
= std::make_unique<ProjectExplorer::FolderNode>(project->projectDirectory(),
ProjectExplorer::NodeType::Folder,
QCoreApplication::translate("QbsRootProjectNode", "Qbs files"));
ProjectExplorer::NodeType::Folder);
buildSystemFiles->setDisplayName(QCoreApplication::translate("QbsRootProjectNode", "Qbs files"));
Utils::FileName base = project->projectDirectory();
const QStringList &files = unreferencedBuildSystemFiles(project->qbsProject());