forked from qt-creator/qt-creator
Qbs: Remove QbsFileNode
It's a ProjectExplorer::FileNode with a custom constructor. Change-Id: I3057647a5843141ef9e55c97dd19255ea454479a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -155,6 +155,7 @@ public:
|
|||||||
void setListInProject(bool l);
|
void setListInProject(bool l);
|
||||||
void setIsGenerated(bool g);
|
void setIsGenerated(bool g);
|
||||||
void setPriority(int priority);
|
void setPriority(int priority);
|
||||||
|
void setLine(int line);
|
||||||
|
|
||||||
static FileType fileTypeForMimeType(const Utils::MimeType &mt);
|
static FileType fileTypeForMimeType(const Utils::MimeType &mt);
|
||||||
static FileType fileTypeForFileName(const Utils::FileName &file);
|
static FileType fileTypeForFileName(const Utils::FileName &file);
|
||||||
@@ -164,7 +165,6 @@ protected:
|
|||||||
Node(const Node &other) = delete;
|
Node(const Node &other) = delete;
|
||||||
|
|
||||||
void setNodeType(NodeType nodeType);
|
void setNodeType(NodeType nodeType);
|
||||||
void setLine(int line);
|
|
||||||
void setFilePath(const Utils::FileName &filePath);
|
void setFilePath(const Utils::FileName &filePath);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -230,19 +230,6 @@ static bool supportsNodeAction(ProjectAction action, const Node *node)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// QbsFileNode:
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
QbsFileNode::QbsFileNode(const Utils::FileName &filePath,
|
|
||||||
const ProjectExplorer::FileType fileType,
|
|
||||||
int line) :
|
|
||||||
ProjectExplorer::FileNode(filePath, fileType)
|
|
||||||
{
|
|
||||||
setLine(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// QbsBaseProjectNode:
|
// QbsBaseProjectNode:
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
@@ -35,17 +35,6 @@ namespace Internal {
|
|||||||
class QbsNodeTreeBuilder;
|
class QbsNodeTreeBuilder;
|
||||||
class QbsProject;
|
class QbsProject;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// QbsFileNode:
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
class QbsFileNode : public ProjectExplorer::FileNode
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QbsFileNode(const Utils::FileName &filePath, const ProjectExplorer::FileType fileType,
|
|
||||||
int line);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// QbsBaseProjectNode:
|
// QbsBaseProjectNode:
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
@@ -93,16 +93,17 @@ buildGroupNodeTree(const qbs::GroupData &grp, const QString &productPath, bool p
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(grp.isValid(), return nullptr);
|
QTC_ASSERT(grp.isValid(), return nullptr);
|
||||||
|
|
||||||
|
auto fileNode = std::make_unique<FileNode>(FileName::fromString(grp.location().filePath()),
|
||||||
|
FileType::Project);
|
||||||
|
fileNode->setLine(grp.location().line());
|
||||||
|
|
||||||
auto result = std::make_unique<QbsGroupNode>(grp, productPath);
|
auto result = std::make_unique<QbsGroupNode>(grp, productPath);
|
||||||
|
|
||||||
result->setEnabled(productIsEnabled && grp.isEnabled());
|
result->setEnabled(productIsEnabled && grp.isEnabled());
|
||||||
result->setAbsoluteFilePathAndLine(
|
result->setAbsoluteFilePathAndLine(
|
||||||
FileName::fromString(grp.location().filePath()).parentDir(), -1);
|
FileName::fromString(grp.location().filePath()).parentDir(), -1);
|
||||||
result->setDisplayName(grp.name());
|
result->setDisplayName(grp.name());
|
||||||
result->addNode(std::make_unique<QbsFileNode>(
|
result->addNode(std::move(fileNode));
|
||||||
FileName::fromString(grp.location().filePath()),
|
|
||||||
FileType::Project,
|
|
||||||
grp.location().line()));
|
|
||||||
|
|
||||||
setupArtifacts(result.get(), grp.allSourceArtifacts());
|
setupArtifacts(result.get(), grp.allSourceArtifacts());
|
||||||
|
|
||||||
@@ -111,18 +112,16 @@ buildGroupNodeTree(const qbs::GroupData &grp, const QString &productPath, bool p
|
|||||||
|
|
||||||
void setupQbsProductData(QbsProductNode *node, const qbs::ProductData &prd)
|
void setupQbsProductData(QbsProductNode *node, const qbs::ProductData &prd)
|
||||||
{
|
{
|
||||||
node->setEnabled(prd.isEnabled());
|
auto fileNode = std::make_unique<FileNode>(FileName::fromString(prd.location().filePath()),
|
||||||
|
FileType::Project);
|
||||||
|
fileNode->setLine(prd.location().line());
|
||||||
|
|
||||||
|
node->setEnabled(prd.isEnabled());
|
||||||
node->setDisplayName(prd.fullDisplayName());
|
node->setDisplayName(prd.fullDisplayName());
|
||||||
node->setAbsoluteFilePathAndLine(FileName::fromString(prd.location().filePath()).parentDir(), -1);
|
node->setAbsoluteFilePathAndLine(FileName::fromString(prd.location().filePath()).parentDir(), -1);
|
||||||
|
node->addNode(std::move(fileNode));
|
||||||
|
|
||||||
const QString &productPath = QFileInfo(prd.location().filePath()).absolutePath();
|
const QString &productPath = QFileInfo(prd.location().filePath()).absolutePath();
|
||||||
|
|
||||||
// Add QbsFileNode:
|
|
||||||
node->addNode(std::make_unique<QbsFileNode>(FileName::fromString(prd.location().filePath()),
|
|
||||||
FileType::Project,
|
|
||||||
prd.location().line()));
|
|
||||||
|
|
||||||
|
|
||||||
foreach (const qbs::GroupData &grp, prd.groups()) {
|
foreach (const qbs::GroupData &grp, prd.groups()) {
|
||||||
if (grp.name() == prd.name() && grp.location() == prd.location()) {
|
if (grp.name() == prd.name() && grp.location() == prd.location()) {
|
||||||
// Set implicit product group right onto this node:
|
// Set implicit product group right onto this node:
|
||||||
@@ -151,9 +150,11 @@ std::unique_ptr<QbsProductNode> buildProductNodeTree(const qbs::ProductData &prd
|
|||||||
void setupProjectNode(QbsProjectNode *node, const qbs::ProjectData &prjData,
|
void setupProjectNode(QbsProjectNode *node, const qbs::ProjectData &prjData,
|
||||||
const qbs::Project &qbsProject)
|
const qbs::Project &qbsProject)
|
||||||
{
|
{
|
||||||
node->addNode(std::make_unique<QbsFileNode>(FileName::fromString(prjData.location().filePath()),
|
auto fileNode = std::make_unique<FileNode>(FileName::fromString(prjData.location().filePath()),
|
||||||
FileType::Project,
|
FileType::Project);
|
||||||
prjData.location().line()));
|
fileNode->setLine(prjData.location().line());
|
||||||
|
|
||||||
|
node->addNode(std::move(fileNode));
|
||||||
foreach (const qbs::ProjectData &subData, prjData.subProjects()) {
|
foreach (const qbs::ProjectData &subData, prjData.subProjects()) {
|
||||||
auto subProject = std::make_unique<QbsProjectNode>(
|
auto subProject = std::make_unique<QbsProjectNode>(
|
||||||
FileName::fromString(subData.location().filePath()).parentDir());
|
FileName::fromString(subData.location().filePath()).parentDir());
|
||||||
|
Reference in New Issue
Block a user