forked from qt-creator/qt-creator
ResourceEditor: Use Node::setIsGenerated setter
Change-Id: I51029f4d92b6959da363dc9f4f5efddf63c57894 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -168,7 +168,7 @@ static void createTree(const QmakePriFile *pri, QmakePriFileNode *node, const Fi
|
|||||||
int eid = vfs->idForFileName(file.toString(), QMakeVfs::VfsExact);
|
int eid = vfs->idForFileName(file.toString(), QMakeVfs::VfsExact);
|
||||||
vfs->readFile(eid, &contents, &errorMessage);
|
vfs->readFile(eid, &contents, &errorMessage);
|
||||||
}
|
}
|
||||||
vfolder->addNode(std::make_unique<ResourceEditor::ResourceTopLevelNode>(file, false, contents, vfolder.get()));
|
vfolder->addNode(std::make_unique<ResourceEditor::ResourceTopLevelNode>(file, contents, vfolder.get()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (const FileName &fn : newFilePaths) {
|
for (const FileName &fn : newFilePaths) {
|
||||||
|
@@ -217,8 +217,9 @@ void ResourceEditorPlugin::extensionsInitialized()
|
|||||||
FolderNode *const pn = file->parentFolderNode();
|
FolderNode *const pn = file->parentFolderNode();
|
||||||
QTC_ASSERT(pn, continue);
|
QTC_ASSERT(pn, continue);
|
||||||
const Utils::FileName path = file->filePath();
|
const Utils::FileName path = file->filePath();
|
||||||
pn->replaceSubtree(file, std::make_unique<ResourceTopLevelNode>(path, file->isGenerated(),
|
auto topLevel = std::make_unique<ResourceTopLevelNode>(path, QString(), pn);
|
||||||
QString(), pn));
|
topLevel->setIsGenerated(file->isGenerated());
|
||||||
|
pn->replaceSubtree(file, std::move(topLevel));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -73,7 +73,7 @@ public:
|
|||||||
FolderNode *parent = m_node->parentFolderNode();
|
FolderNode *parent = m_node->parentFolderNode();
|
||||||
QTC_ASSERT(parent, return false);
|
QTC_ASSERT(parent, return false);
|
||||||
parent->replaceSubtree(m_node, std::make_unique<ResourceTopLevelNode>(
|
parent->replaceSubtree(m_node, std::make_unique<ResourceTopLevelNode>(
|
||||||
m_node->filePath(), false, m_node->contents(), parent));
|
m_node->filePath(), m_node->contents(), parent));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,11 +264,10 @@ bool SimpleResourceFolderNode::renameFile(const QString &filePath, const QString
|
|||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
|
||||||
ResourceTopLevelNode::ResourceTopLevelNode(const FileName &filePath, bool generated,
|
ResourceTopLevelNode::ResourceTopLevelNode(const FileName &filePath,
|
||||||
const QString &contents, FolderNode *parent)
|
const QString &contents, FolderNode *parent)
|
||||||
: FolderNode(filePath)
|
: FolderNode(filePath)
|
||||||
{
|
{
|
||||||
setIsGenerated(generated);
|
|
||||||
setIcon(FileIconProvider::icon(filePath.toString()));
|
setIcon(FileIconProvider::icon(filePath.toString()));
|
||||||
setPriority(Node::DefaultFilePriority);
|
setPriority(Node::DefaultFilePriority);
|
||||||
setListInProject(true);
|
setListInProject(true);
|
||||||
|
@@ -34,7 +34,7 @@ namespace Internal { class ResourceFileWatcher; }
|
|||||||
class RESOURCE_EXPORT ResourceTopLevelNode : public ProjectExplorer::FolderNode
|
class RESOURCE_EXPORT ResourceTopLevelNode : public ProjectExplorer::FolderNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ResourceTopLevelNode(const Utils::FileName &filePath, bool generated,
|
ResourceTopLevelNode(const Utils::FileName &filePath,
|
||||||
const QString &contents, FolderNode *parent);
|
const QString &contents, FolderNode *parent);
|
||||||
~ResourceTopLevelNode() override;
|
~ResourceTopLevelNode() override;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user