diff options
-rw-r--r-- | src/plugins/projectexplorer/projectnodes.h | 3 | ||||
-rw-r--r-- | src/plugins/qbsprojectmanager/qbsnodetreebuilder.cpp | 18 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/plugins/projectexplorer/projectnodes.h b/src/plugins/projectexplorer/projectnodes.h index dc03cd5aec..7c440b7355 100644 --- a/src/plugins/projectexplorer/projectnodes.h +++ b/src/plugins/projectexplorer/projectnodes.h @@ -149,6 +149,8 @@ public: static bool sortByPath(const Node *a, const Node *b); void setParentFolderNode(FolderNode *parentFolder); + void setListInProject(bool l); + static FileType fileTypeForMimeType(const Utils::MimeType &mt); static FileType fileTypeForFileName(const Utils::FileName &file); @@ -156,7 +158,6 @@ protected: Node(NodeType nodeType, const Utils::FileName &filePath, int line = -1); void setPriority(int priority); - void setListInProject(bool l); void setIsGenerated(bool g); private: diff --git a/src/plugins/qbsprojectmanager/qbsnodetreebuilder.cpp b/src/plugins/qbsprojectmanager/qbsnodetreebuilder.cpp index bc4bd6504e..bc3731f625 100644 --- a/src/plugins/qbsprojectmanager/qbsnodetreebuilder.cpp +++ b/src/plugins/qbsprojectmanager/qbsnodetreebuilder.cpp @@ -59,9 +59,23 @@ void setupArtifacts(ProjectExplorer::FolderNode *root, const QList<qbs::Artifact const Utils::FileName path = Utils::FileName::fromString(ad.filePath()); const ProjectExplorer::FileType type = fileType(ad); const bool isGenerated = ad.isGenerated(); - root->addNestedNode(new ProjectExplorer::FileNode(path, type, isGenerated)); - }; + // A list of human-readable file types that we can reasonably expect + // to get generated during a build. Extend as needed. + static const QSet<QString> sourceTags = { + QLatin1String("c"), QLatin1String("cpp"), QLatin1String("hpp"), + QLatin1String("objc"), QLatin1String("objcpp"), + QLatin1String("c_pch_src"), QLatin1String("cpp_pch_src"), + QLatin1String("objc_pch_src"), QLatin1String("objcpp_pch_src"), + QLatin1String("asm"), QLatin1String("asm_cpp"), + QLatin1String("linkerscript"), + QLatin1String("qrc"), QLatin1String("java.java") + }; + ProjectExplorer::FileNode * const node + = new ProjectExplorer::FileNode(path, type, isGenerated); + node->setListInProject(!isGenerated || ad.fileTags().toSet().intersects(sourceTags)); + root->addNestedNode(node); + } root->compress(); } |