aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/resourceeditor
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2019-03-01 08:38:17 +0100
committerhjk <hjk@qt.io>2019-03-01 09:18:52 +0000
commit4e0ff112e4cb97d2179287e6bd3cb707dc64406d (patch)
treed4975fef43db69aa575042bd8f833988a22ecb10 /src/plugins/resourceeditor
parente3a7aa1ad24c78ea220112d207f452425e316a4d (diff)
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>
Diffstat (limited to 'src/plugins/resourceeditor')
-rw-r--r--src/plugins/resourceeditor/resourceeditorplugin.cpp2
-rw-r--r--src/plugins/resourceeditor/resourcenode.cpp6
-rw-r--r--src/plugins/resourceeditor/resourcenode.h3
3 files changed, 6 insertions, 5 deletions
diff --git a/src/plugins/resourceeditor/resourceeditorplugin.cpp b/src/plugins/resourceeditor/resourceeditorplugin.cpp
index c7de69cb63..f5c3fa1928 100644
--- a/src/plugins/resourceeditor/resourceeditorplugin.cpp
+++ b/src/plugins/resourceeditor/resourceeditorplugin.cpp
@@ -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));
}
diff --git a/src/plugins/resourceeditor/resourcenode.cpp b/src/plugins/resourceeditor/resourcenode.cpp
index 8431fa16fe..cc9888ca6a 100644
--- a/src/plugins/resourceeditor/resourcenode.cpp
+++ b/src/plugins/resourceeditor/resourcenode.cpp
@@ -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
diff --git a/src/plugins/resourceeditor/resourcenode.h b/src/plugins/resourceeditor/resourcenode.h
index 9d38e3c622..f732c6ae52 100644
--- a/src/plugins/resourceeditor/resourcenode.h
+++ b/src/plugins/resourceeditor/resourcenode.h
@@ -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();