forked from qt-creator/qt-creator
ResourceEditor: Change signature of ResourceTopLevelNode ctor
Replace the parent node by the only data item it is used for to make it more clear that this is not about tree structure. Also move the parameter with possible default to the last position. Change-Id: Ibf62328dea335b5999595e5cebb36051ec84bc3a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -168,7 +168,8 @@ static void createTree(const QmakePriFile *pri, QmakePriFileNode *node, const Fi
|
||||
int eid = vfs->idForFileName(file.toString(), QMakeVfs::VfsExact);
|
||||
vfs->readFile(eid, &contents, &errorMessage);
|
||||
}
|
||||
vfolder->addNode(std::make_unique<ResourceEditor::ResourceTopLevelNode>(file, contents, vfolder.get()));
|
||||
vfolder->addNode(std::make_unique<ResourceEditor::ResourceTopLevelNode>
|
||||
(file, vfolder->filePath(), contents));
|
||||
}
|
||||
} else {
|
||||
for (const FileName &fn : newFilePaths) {
|
||||
|
@@ -217,7 +217,7 @@ void ResourceEditorPlugin::extensionsInitialized()
|
||||
FolderNode *const pn = file->parentFolderNode();
|
||||
QTC_ASSERT(pn, continue);
|
||||
const Utils::FileName path = file->filePath();
|
||||
auto topLevel = std::make_unique<ResourceTopLevelNode>(path, QString(), pn);
|
||||
auto topLevel = std::make_unique<ResourceTopLevelNode>(path, pn->filePath());
|
||||
topLevel->setIsGenerated(file->isGenerated());
|
||||
pn->replaceSubtree(file, std::move(topLevel));
|
||||
}
|
||||
|
@@ -73,7 +73,7 @@ public:
|
||||
FolderNode *parent = m_node->parentFolderNode();
|
||||
QTC_ASSERT(parent, return false);
|
||||
parent->replaceSubtree(m_node, std::make_unique<ResourceTopLevelNode>(
|
||||
m_node->filePath(), m_node->contents(), parent));
|
||||
m_node->filePath(), parent->filePath(), m_node->contents()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -265,7 +265,8 @@ bool SimpleResourceFolderNode::renameFile(const QString &filePath, const QString
|
||||
} // Internal
|
||||
|
||||
ResourceTopLevelNode::ResourceTopLevelNode(const FileName &filePath,
|
||||
const QString &contents, FolderNode *parent)
|
||||
const FileName &base,
|
||||
const QString &contents)
|
||||
: FolderNode(filePath)
|
||||
{
|
||||
setIcon(FileIconProvider::icon(filePath.toString()));
|
||||
@@ -283,7 +284,6 @@ ResourceTopLevelNode::ResourceTopLevelNode(const FileName &filePath,
|
||||
m_contents = contents;
|
||||
}
|
||||
|
||||
FileName base = parent->filePath();
|
||||
if (filePath.isChildOf(base))
|
||||
setDisplayName(filePath.relativeChildPath(base).toUserOutput());
|
||||
else
|
||||
|
@@ -35,7 +35,8 @@ class RESOURCE_EXPORT ResourceTopLevelNode : public ProjectExplorer::FolderNode
|
||||
{
|
||||
public:
|
||||
ResourceTopLevelNode(const Utils::FileName &filePath,
|
||||
const QString &contents, FolderNode *parent);
|
||||
const Utils::FileName &basePath,
|
||||
const QString &contents = {});
|
||||
~ResourceTopLevelNode() override;
|
||||
|
||||
void addInternalNodes();
|
||||
|
Reference in New Issue
Block a user