Revert CMakePM: Treat all sourceGroups as sourcesOrHeaders project nodes

This reverts commit 973e9dcf90.

Fixes: QTCREATORBUG-30602
Change-Id: I9db6dc6d3fbd7d9a5e48a25bca725a4f86124318
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Cristian Adam
2024-04-11 15:17:45 +02:00
parent c431f24816
commit 4a95a2d63d
3 changed files with 6 additions and 10 deletions

View File

@@ -633,7 +633,7 @@ static FolderNode *createSourceGroupNode(const QString &sourceGroupName,
FolderNode *existingNode = currentNode->findChildFolderNode( FolderNode *existingNode = currentNode->findChildFolderNode(
[&p](const FolderNode *fn) { return fn->displayName() == p; }); [&p](const FolderNode *fn) { return fn->displayName() == p; });
if (!existingNode) { if (!existingNode) {
auto node = createCMakeVFolder(sourceDirectory, Node::DefaultFolderPriority + 5, p, true); auto node = createCMakeVFolder(sourceDirectory, Node::DefaultFolderPriority + 5, p);
node->setListInProject(false); node->setListInProject(false);
node->setIcon([] { return Icon::fromTheme("edit-copy"); }); node->setIcon([] { return Icon::fromTheme("edit-copy"); });

View File

@@ -20,13 +20,13 @@ namespace CMakeProjectManager::Internal {
std::unique_ptr<FolderNode> createCMakeVFolder(const Utils::FilePath &basePath, std::unique_ptr<FolderNode> createCMakeVFolder(const Utils::FilePath &basePath,
int priority, int priority,
const QString &displayName, const QString &displayName)
bool sourcesOrHeaders)
{ {
auto newFolder = std::make_unique<VirtualFolderNode>(basePath); auto newFolder = std::make_unique<VirtualFolderNode>(basePath);
newFolder->setPriority(priority); newFolder->setPriority(priority);
newFolder->setDisplayName(displayName); newFolder->setDisplayName(displayName);
newFolder->setIsSourcesOrHeaders(sourcesOrHeaders); newFolder->setIsSourcesOrHeaders(displayName == "Source Files"
|| displayName == "Header Files");
return newFolder; return newFolder;
} }
@@ -35,14 +35,13 @@ void addCMakeVFolder(FolderNode *base,
int priority, int priority,
const QString &displayName, const QString &displayName,
std::vector<std::unique_ptr<FileNode>> &&files, std::vector<std::unique_ptr<FileNode>> &&files,
bool sourcesOrHeaders,
bool listInProject) bool listInProject)
{ {
if (files.size() == 0) if (files.size() == 0)
return; return;
FolderNode *folder = base; FolderNode *folder = base;
if (!displayName.isEmpty()) { if (!displayName.isEmpty()) {
auto newFolder = createCMakeVFolder(basePath, priority, displayName, sourcesOrHeaders); auto newFolder = createCMakeVFolder(basePath, priority, displayName);
folder = newFolder.get(); folder = newFolder.get();
base->addNode(std::move(newFolder)); base->addNode(std::move(newFolder));
} }
@@ -90,7 +89,6 @@ void addCMakeInputs(FolderNode *root,
10, 10,
Tr::tr("<Other Locations>"), Tr::tr("<Other Locations>"),
removeKnownNodes(knownFiles, std::move(rootInputs)), removeKnownNodes(knownFiles, std::move(rootInputs)),
/*sourcesOrHeaders=*/false,
/*listInProject=*/false); /*listInProject=*/false);
root->addNode(std::move(cmakeVFolder)); root->addNode(std::move(cmakeVFolder));

View File

@@ -13,15 +13,13 @@ namespace CMakeProjectManager::Internal {
std::unique_ptr<ProjectExplorer::FolderNode> createCMakeVFolder(const Utils::FilePath &basePath, std::unique_ptr<ProjectExplorer::FolderNode> createCMakeVFolder(const Utils::FilePath &basePath,
int priority, int priority,
const QString &displayName, const QString &displayName);
bool sourcesOrHeaders);
void addCMakeVFolder(ProjectExplorer::FolderNode *base, void addCMakeVFolder(ProjectExplorer::FolderNode *base,
const Utils::FilePath &basePath, const Utils::FilePath &basePath,
int priority, int priority,
const QString &displayName, const QString &displayName,
std::vector<std::unique_ptr<ProjectExplorer::FileNode>> &&files, std::vector<std::unique_ptr<ProjectExplorer::FileNode>> &&files,
bool sourcesOrHeaders = false,
bool listInProject = true); bool listInProject = true);
std::vector<std::unique_ptr<ProjectExplorer::FileNode>> &&removeKnownNodes( std::vector<std::unique_ptr<ProjectExplorer::FileNode>> &&removeKnownNodes(