CMakePM: Allow files to be renamed in project view

This includes both with source files explicitly specified or
resulted from a file(GLOB|GLOB_RECOURSE) call.

Fixes: QTCREATORBUG-27538
Change-Id: I5ee113af168bdb8cd0a96e8ab2ae603c0607fb0b
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Cristian Adam
2023-04-21 22:08:45 +02:00
parent f5d7765094
commit 54af6bd5b3
3 changed files with 167 additions and 1 deletions

View File

@@ -48,6 +48,13 @@ public:
bool addFiles(ProjectExplorer::Node *context,
const Utils::FilePaths &filePaths, Utils::FilePaths *) final;
bool canRenameFile(ProjectExplorer::Node *context,
const Utils::FilePath &oldFilePath,
const Utils::FilePath &newFilePath) final;
bool renameFile(ProjectExplorer::Node *context,
const Utils::FilePath &oldFilePath,
const Utils::FilePath &newFilePath) final;
Utils::FilePaths filesGeneratedFrom(const Utils::FilePath &sourceFile) const final;
QString name() const final { return QLatin1String("cmake"); }
@@ -201,6 +208,15 @@ private:
QList<CMakeBuildTarget> m_buildTargets;
QSet<CMakeFileInfo> m_cmakeFiles;
struct FileToBeRenamed
{
cmListFileArgument argumentPosition;
Utils::FilePath cmakeFile;
QString oldRelativeFileName;
bool fromGlobbing = false;
};
QHash<QString, FileToBeRenamed> m_filesToBeRenamed;
// Parsing state:
BuildDirParameters m_parameters;
int m_reparseParameters = REPARSE_DEFAULT;