CppEditor: FilePathify some of the refactoring operations

... and adjust surrounding code.

Change-Id: I1d36e5a0c6ba14a1d9b8fd59340f1bb2a1e45ad1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2022-11-24 17:00:52 +01:00
parent edd0e97ce1
commit e42d24fca9
18 changed files with 221 additions and 233 deletions

View File

@@ -31,7 +31,9 @@
#include <QMessageBox>
using namespace ProjectExplorer;
using namespace CMakeProjectManager::Internal;
using namespace Utils;
namespace CMakeProjectManager::Internal {
CMakeManager::CMakeManager()
: m_runCMakeAction(new QAction(QIcon(), Tr::tr("Run CMake"), this))
@@ -218,12 +220,12 @@ void CMakeManager::buildFile(Node *node)
CMakeTargetNode *targetNode = dynamic_cast<CMakeTargetNode *>(fileNode->parentProjectNode());
if (!targetNode)
return;
Utils::FilePath filePath = fileNode->filePath();
FilePath filePath = fileNode->filePath();
if (filePath.fileName().contains(".h")) {
bool wasHeader = false;
const QString sourceFile = CppEditor::correspondingHeaderOrSource(filePath.toString(), &wasHeader);
const FilePath sourceFile = CppEditor::correspondingHeaderOrSource(filePath, &wasHeader);
if (wasHeader && !sourceFile.isEmpty())
filePath = Utils::FilePath::fromString(sourceFile);
filePath = sourceFile;
}
Target *target = project->activeTarget();
QTC_ASSERT(target, return);
@@ -252,3 +254,5 @@ void CMakeManager::buildFileContextMenu()
if (Node *node = ProjectTree::currentNode())
buildFile(node);
}
} // CMakeProjectManager::Internal