forked from qt-creator/qt-creator
PE: Move ResourceFileNode to ProjectExplorer
Avoids additional dependencies later on. No functional change. Change-Id: Idc21ed856f4f31d68d55742b5796243227b254dc Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -1094,4 +1094,28 @@ QIcon DirectoryIcon::icon() const
|
||||
return icon;
|
||||
}
|
||||
|
||||
ResourceFileNode::ResourceFileNode(const FilePath &filePath, const QString &qrcPath, const QString &displayName)
|
||||
: FileNode(filePath, FileNode::fileTypeForFileName(filePath))
|
||||
, m_qrcPath(qrcPath)
|
||||
, m_displayName(displayName)
|
||||
{
|
||||
}
|
||||
|
||||
QString ResourceFileNode::displayName() const
|
||||
{
|
||||
return m_displayName;
|
||||
}
|
||||
|
||||
QString ResourceFileNode::qrcPath() const
|
||||
{
|
||||
return m_qrcPath;
|
||||
}
|
||||
|
||||
bool ResourceFileNode::supportsAction(ProjectAction action, const Node *node) const
|
||||
{
|
||||
if (action == HidePathActions)
|
||||
return false;
|
||||
return parentFolderNode()->supportsAction(action, node);
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -464,6 +464,20 @@ private:
|
||||
Project *m_project;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT ResourceFileNode : public ProjectExplorer::FileNode
|
||||
{
|
||||
public:
|
||||
ResourceFileNode(const Utils::FilePath &filePath, const QString &qrcPath, const QString &displayName);
|
||||
|
||||
QString displayName() const override;
|
||||
QString qrcPath() const;
|
||||
bool supportsAction(ProjectExplorer::ProjectAction action, const Node *node) const override;
|
||||
|
||||
private:
|
||||
QString m_qrcPath;
|
||||
QString m_displayName;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
Q_DECLARE_METATYPE(ProjectExplorer::Node *)
|
||||
|
@@ -33,8 +33,6 @@
|
||||
#include <projectexplorer/projecttree.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <resourceeditor/resourcenode.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
namespace QmlPreview {
|
||||
@@ -52,7 +50,7 @@ ProjectExplorer::Target *QmlPreviewFileOnTargetFinder::target() const
|
||||
|
||||
QString resourceNodePath(const ProjectExplorer::Node *node)
|
||||
{
|
||||
if (auto resourceNode = dynamic_cast<const ResourceEditor::ResourceFileNode *>(node))
|
||||
if (auto resourceNode = dynamic_cast<const ProjectExplorer::ResourceFileNode *>(node))
|
||||
return ":" + resourceNode->qrcPath();
|
||||
return QString();
|
||||
}
|
||||
|
@@ -1693,7 +1693,7 @@ void QtVersion::populateQmlFileFinder(FileInProjectFinder *finder, const Target
|
||||
if (startupProject) {
|
||||
if (ProjectNode *rootNode = startupProject->rootProjectNode()) {
|
||||
rootNode->forEachNode([&](FileNode *node) {
|
||||
if (auto resourceNode = dynamic_cast<ResourceEditor::ResourceFileNode *>(node))
|
||||
if (auto resourceNode = dynamic_cast<ProjectExplorer::ResourceFileNode *>(node))
|
||||
finder->addMappedPath(node->filePath(), ":" + resourceNode->qrcPath());
|
||||
});
|
||||
} else {
|
||||
|
@@ -637,28 +637,4 @@ ResourceTopLevelNode *ResourceFolderNode::resourceNode() const
|
||||
return m_topLevelNode;
|
||||
}
|
||||
|
||||
ResourceFileNode::ResourceFileNode(const FilePath &filePath, const QString &qrcPath, const QString &displayName)
|
||||
: FileNode(filePath, FileNode::fileTypeForFileName(filePath))
|
||||
, m_qrcPath(qrcPath)
|
||||
, m_displayName(displayName)
|
||||
{
|
||||
}
|
||||
|
||||
QString ResourceFileNode::displayName() const
|
||||
{
|
||||
return m_displayName;
|
||||
}
|
||||
|
||||
QString ResourceFileNode::qrcPath() const
|
||||
{
|
||||
return m_qrcPath;
|
||||
}
|
||||
|
||||
bool ResourceFileNode::supportsAction(ProjectAction action, const Node *node) const
|
||||
{
|
||||
if (action == HidePathActions)
|
||||
return false;
|
||||
return parentFolderNode()->supportsAction(action, node);
|
||||
}
|
||||
|
||||
} // ResourceEditor
|
||||
|
@@ -91,18 +91,4 @@ private:
|
||||
QString m_lang;
|
||||
};
|
||||
|
||||
class RESOURCE_EXPORT ResourceFileNode : public ProjectExplorer::FileNode
|
||||
{
|
||||
public:
|
||||
ResourceFileNode(const Utils::FilePath &filePath, const QString &qrcPath, const QString &displayName);
|
||||
|
||||
QString displayName() const override;
|
||||
QString qrcPath() const;
|
||||
bool supportsAction(ProjectExplorer::ProjectAction action, const Node *node) const override;
|
||||
|
||||
private:
|
||||
QString m_qrcPath;
|
||||
QString m_displayName;
|
||||
};
|
||||
|
||||
} // namespace ResourceEditor
|
||||
|
Reference in New Issue
Block a user