summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2021-08-09 14:03:54 +0200
committerhjk <hjk@qt.io>2021-08-10 08:24:21 +0000
commit2a20778937d705c4bce9c44156c25a26882d0c84 (patch)
treebadd42980a10c13b754cabe4c7e722c1832a745c /src/plugins
parent34b7ef6bb38e3bf14ef2897a5e7940d82fe2a5f6 (diff)
downloadqt-creator-2a20778937d705c4bce9c44156c25a26882d0c84.tar.gz
ProjectExplorer: Use more FilePaths in ProjectNodes
... and related classes. Change-Id: I50844a0b60e4b0769727b17d5b3d544cd6d10f0d Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp18
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp4
-rw-r--r--src/plugins/projectexplorer/projectfilewizardextension.cpp22
-rw-r--r--src/plugins/projectexplorer/projectfilewizardextension.h2
-rw-r--r--src/plugins/projectexplorer/projectnodes.cpp16
-rw-r--r--src/plugins/projectexplorer/projectnodes.h8
-rw-r--r--src/plugins/projectexplorer/projectwizardpage.cpp17
-rw-r--r--src/plugins/projectexplorer/projectwizardpage.h2
-rw-r--r--src/plugins/qbsprojectmanager/qbsnodes.cpp2
-rw-r--r--src/plugins/qbsprojectmanager/qbsnodes.h2
-rw-r--r--src/plugins/qmakeprojectmanager/qmakenodes.cpp10
-rw-r--r--src/plugins/qmakeprojectmanager/qmakenodes.h10
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp18
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeparsernodes.h6
-rw-r--r--src/plugins/resourceeditor/resourcenode.cpp6
-rw-r--r--src/plugins/resourceeditor/resourcenode.h4
16 files changed, 72 insertions, 75 deletions
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp
index f23d8fb3d9..4090203c65 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp
@@ -59,12 +59,12 @@ namespace ProjectExplorer {
// Helper:
// --------------------------------------------------------------------
-static QString generatedProjectFilePath(const QList<JsonWizard::GeneratorFile> &files)
+static FilePath generatedProjectFilePath(const QList<JsonWizard::GeneratorFile> &files)
{
- foreach (const JsonWizard::GeneratorFile &file, files)
+ for (const JsonWizard::GeneratorFile &file : files)
if (file.file.attributes() & GeneratedFile::OpenProjectAttribute)
- return file.file.path();
- return QString();
+ return file.file.filePath();
+ return {};
}
static IWizardFactory::WizardKind wizardKind(JsonWizard *wiz)
@@ -118,17 +118,17 @@ void JsonSummaryPage::initializePage()
IWizardFactory::WizardKind kind = wizardKind(m_wizard);
bool isProject = (kind == IWizardFactory::ProjectWizard);
- QStringList files;
+ FilePaths files;
if (isProject) {
JsonWizard::GeneratorFile f
= Utils::findOrDefault(m_fileList, [](const JsonWizard::GeneratorFile &f) {
return f.file.attributes() & GeneratedFile::OpenProjectAttribute;
});
- files << f.file.path();
+ files << f.file.filePath();
} else {
files = Utils::transform(m_fileList,
[](const JsonWizard::GeneratorFile &f) {
- return f.file.path();
+ return f.file.filePath();
});
}
@@ -183,7 +183,7 @@ void JsonSummaryPage::triggerCommit(const JsonWizard::GeneratorFiles &files)
void JsonSummaryPage::addToProject(const JsonWizard::GeneratorFiles &files)
{
QTC_CHECK(m_fileList.isEmpty()); // Happens after this page is done
- QString generatedProject = generatedProjectFilePath(files);
+ const FilePath generatedProject = generatedProjectFilePath(files);
IWizardFactory::WizardKind kind = wizardKind(m_wizard);
FolderNode *folder = currentNode();
@@ -193,7 +193,7 @@ void JsonSummaryPage::addToProject(const JsonWizard::GeneratorFiles &files)
if (!static_cast<ProjectNode *>(folder)->addSubProject(generatedProject)) {
QMessageBox::critical(m_wizard, tr("Failed to Add to Project"),
tr("Failed to add subproject \"%1\"\nto project \"%2\".")
- .arg(QDir::toNativeSeparators(generatedProject))
+ .arg(generatedProject.toUserOutput())
.arg(folder->filePath().toUserOutput()));
return;
}
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 2eadaf954d..c89a330bc1 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -3593,7 +3593,7 @@ void ProjectExplorerPluginPrivate::addExistingProjects()
FilePaths failedProjects;
QStringList addedProjects;
for (const FilePath &filePath : qAsConst(subProjectFilePaths)) {
- if (projectNode->addSubProject(filePath.toString()))
+ if (projectNode->addSubProject(filePath))
addedProjects << filePath.toString();
else
failedProjects << filePath;
@@ -3670,7 +3670,7 @@ void ProjectExplorerPluginPrivate::removeProject()
RemoveFileDialog removeFileDialog(node->filePath().toString(), ICore::dialogParent());
removeFileDialog.setDeleteFileVisible(false);
if (removeFileDialog.exec() == QDialog::Accepted)
- projectNode->removeSubProject(node->filePath().toString());
+ projectNode->removeSubProject(node->filePath());
}
}
diff --git a/src/plugins/projectexplorer/projectfilewizardextension.cpp b/src/plugins/projectexplorer/projectfilewizardextension.cpp
index d3cae0aed3..52b20b3ad0 100644
--- a/src/plugins/projectexplorer/projectfilewizardextension.cpp
+++ b/src/plugins/projectexplorer/projectfilewizardextension.cpp
@@ -103,12 +103,12 @@ ProjectFileWizardExtension::~ProjectFileWizardExtension()
delete m_context;
}
-static QString generatedProjectFilePath(const QList<GeneratedFile> &files)
+static FilePath generatedProjectFilePath(const QList<GeneratedFile> &files)
{
- foreach (const GeneratedFile &file, files)
+ for (const GeneratedFile &file : files)
if (file.attributes() & GeneratedFile::OpenProjectAttribute)
- return file.path();
- return QString();
+ return file.filePath();
+ return {};
}
void ProjectFileWizardExtension::firstExtensionPageShown(
@@ -121,7 +121,7 @@ void ProjectFileWizardExtension::firstExtensionPageShown(
QStringList fileNames = Utils::transform(files, &GeneratedFile::path);
m_context->page->setFiles(fileNames);
- QStringList filePaths;
+ FilePaths filePaths;
ProjectAction projectAction;
const IWizardFactory::WizardKind kind = m_context->wizard->kind();
if (kind == IWizardFactory::ProjectWizard) {
@@ -129,13 +129,13 @@ void ProjectFileWizardExtension::firstExtensionPageShown(
filePaths << generatedProjectFilePath(files);
} else {
projectAction = AddNewFile;
- filePaths = Utils::transform(files, &GeneratedFile::path);
+ filePaths = Utils::transform(files, &GeneratedFile::filePath);
}
// Static cast from void * to avoid qobject_cast (which needs a valid object) in value().
auto contextNode = static_cast<Node *>(extraValues.value(QLatin1String(Constants::PREFERRED_PROJECT_NODE)).value<void *>());
auto project = static_cast<Project *>(extraValues.value(Constants::PROJECT_POINTER).value<void *>());
- const QString path = extraValues.value(Constants::PREFERRED_PROJECT_NODE_PATH).toString();
+ const FilePath path = FilePath::fromVariant(extraValues.value(Constants::PREFERRED_PROJECT_NODE_PATH));
m_context->page->initializeProjectTree(findWizardContextNode(contextNode, project, path),
filePaths, m_context->wizard->kind(),
@@ -152,12 +152,12 @@ void ProjectFileWizardExtension::firstExtensionPageShown(
}
Node *ProjectFileWizardExtension::findWizardContextNode(Node *contextNode, Project *project,
- const QString &path)
+ const FilePath &path)
{
if (contextNode && !ProjectTree::hasNode(contextNode)) {
if (SessionManager::projects().contains(project) && project->rootProjectNode()) {
contextNode = project->rootProjectNode()->findNode([path](const Node *n) {
- return path == n->filePath().toString();
+ return path == n->filePath();
});
}
}
@@ -204,7 +204,7 @@ bool ProjectFileWizardExtension::processProject(
{
*removeOpenProjectAttribute = false;
- QString generatedProject = generatedProjectFilePath(files);
+ const FilePath generatedProject = generatedProjectFilePath(files);
FolderNode *folder = m_context->page->currentNode();
if (!folder)
@@ -212,7 +212,7 @@ bool ProjectFileWizardExtension::processProject(
if (m_context->wizard->kind() == IWizardFactory::ProjectWizard) {
if (!static_cast<ProjectNode *>(folder)->addSubProject(generatedProject)) {
*errorMessage = tr("Failed to add subproject \"%1\"\nto project \"%2\".")
- .arg(generatedProject).arg(folder->filePath().toUserOutput());
+ .arg(generatedProject.toUserOutput()).arg(folder->filePath().toUserOutput());
return false;
}
*removeOpenProjectAttribute = true;
diff --git a/src/plugins/projectexplorer/projectfilewizardextension.h b/src/plugins/projectexplorer/projectfilewizardextension.h
index df1c61a650..2a1893d1e7 100644
--- a/src/plugins/projectexplorer/projectfilewizardextension.h
+++ b/src/plugins/projectexplorer/projectfilewizardextension.h
@@ -54,7 +54,7 @@ public slots:
void firstExtensionPageShown(const QList<Core::GeneratedFile> &files, const QVariantMap &extraValues) override;
private:
- Node *findWizardContextNode(Node *contextNode, Project *project, const QString &path);
+ Node *findWizardContextNode(Node *contextNode, Project *project, const Utils::FilePath &path);
bool processProject(const QList<Core::GeneratedFile> &files,
bool *removeOpenProjectAttribute, QString *errorMessage);
diff --git a/src/plugins/projectexplorer/projectnodes.cpp b/src/plugins/projectexplorer/projectnodes.cpp
index 4f7b04dc51..161eccdd2e 100644
--- a/src/plugins/projectexplorer/projectnodes.cpp
+++ b/src/plugins/projectexplorer/projectnodes.cpp
@@ -768,7 +768,7 @@ bool FolderNode::deleteFiles(const FilePaths &filePaths)
return false;
}
-bool FolderNode::canRenameFile(const Utils::FilePath &oldFilePath, const Utils::FilePath &newFilePath)
+bool FolderNode::canRenameFile(const FilePath &oldFilePath, const FilePath &newFilePath)
{
ProjectNode *pn = managingProject();
if (pn)
@@ -776,7 +776,7 @@ bool FolderNode::canRenameFile(const Utils::FilePath &oldFilePath, const Utils::
return false;
}
-bool FolderNode::renameFile(const Utils::FilePath &oldFilePath, const Utils::FilePath &newFilePath)
+bool FolderNode::renameFile(const FilePath &oldFilePath, const FilePath &newFilePath)
{
ProjectNode *pn = managingProject();
if (pn)
@@ -791,7 +791,7 @@ bool FolderNode::addDependencies(const QStringList &dependencies)
return false;
}
-FolderNode::AddNewInformation FolderNode::addNewInformation(const QStringList &files, Node *context) const
+FolderNode::AddNewInformation FolderNode::addNewInformation(const FilePaths &files, Node *context) const
{
Q_UNUSED(files)
return AddNewInformation(displayName(), context == this ? 120 : 100);
@@ -839,7 +839,7 @@ bool FolderNode::showWhenEmpty() const
\sa ProjectExplorer::FileNode, ProjectExplorer::ProjectNode
*/
-VirtualFolderNode::VirtualFolderNode(const Utils::FilePath &folderPath) :
+VirtualFolderNode::VirtualFolderNode(const FilePath &folderPath) :
FolderNode(folderPath)
{
}
@@ -857,7 +857,7 @@ VirtualFolderNode::VirtualFolderNode(const Utils::FilePath &folderPath) :
/*!
Creates an uninitialized project node object.
*/
-ProjectNode::ProjectNode(const Utils::FilePath &projectFilePath) :
+ProjectNode::ProjectNode(const FilePath &projectFilePath) :
FolderNode(projectFilePath)
{
setPriority(DefaultProjectPriority);
@@ -865,13 +865,13 @@ ProjectNode::ProjectNode(const Utils::FilePath &projectFilePath) :
setDisplayName(projectFilePath.fileName());
}
-bool ProjectNode::canAddSubProject(const QString &proFilePath) const
+bool ProjectNode::canAddSubProject(const FilePath &proFilePath) const
{
Q_UNUSED(proFilePath)
return false;
}
-bool ProjectNode::addSubProject(const QString &proFilePath)
+bool ProjectNode::addSubProject(const FilePath &proFilePath)
{
Q_UNUSED(proFilePath)
return false;
@@ -882,7 +882,7 @@ QStringList ProjectNode::subProjectFileNamePatterns() const
return QStringList();
}
-bool ProjectNode::removeSubProject(const QString &proFilePath)
+bool ProjectNode::removeSubProject(const FilePath &proFilePath)
{
Q_UNUSED(proFilePath)
return false;
diff --git a/src/plugins/projectexplorer/projectnodes.h b/src/plugins/projectexplorer/projectnodes.h
index ad8b9f3eeb..c416d6d652 100644
--- a/src/plugins/projectexplorer/projectnodes.h
+++ b/src/plugins/projectexplorer/projectnodes.h
@@ -317,7 +317,7 @@ public:
int priority;
};
- virtual AddNewInformation addNewInformation(const QStringList &files, Node *context) const;
+ virtual AddNewInformation addNewInformation(const Utils::FilePaths &files, Node *context) const;
// determines if node will be shown in the flat view, by default folder and projects aren't shown
@@ -370,10 +370,10 @@ class PROJECTEXPLORER_EXPORT ProjectNode : public FolderNode
public:
explicit ProjectNode(const Utils::FilePath &projectFilePath);
- virtual bool canAddSubProject(const QString &proFilePath) const;
- virtual bool addSubProject(const QString &proFile);
+ virtual bool canAddSubProject(const Utils::FilePath &proFilePath) const;
+ virtual bool addSubProject(const Utils::FilePath &proFile);
virtual QStringList subProjectFileNamePatterns() const;
- virtual bool removeSubProject(const QString &proFilePath);
+ virtual bool removeSubProject(const Utils::FilePath &proFilePath);
virtual Utils::optional<Utils::FilePath> visibleAfterAddFileAction() const {
return Utils::nullopt;
}
diff --git a/src/plugins/projectexplorer/projectwizardpage.cpp b/src/plugins/projectexplorer/projectwizardpage.cpp
index aaa63116b5..10ad1b66dd 100644
--- a/src/plugins/projectexplorer/projectwizardpage.cpp
+++ b/src/plugins/projectexplorer/projectwizardpage.cpp
@@ -141,7 +141,7 @@ Qt::ItemFlags AddNewTree::flags(int) const
class BestNodeSelector
{
public:
- BestNodeSelector(const QString &commonDirectory, const QStringList &files);
+ BestNodeSelector(const QString &commonDirectory, const FilePaths &files);
void inspect(AddNewTree *tree, bool isContextNode);
AddNewTree *bestChoice() const;
bool deploys();
@@ -149,7 +149,7 @@ public:
private:
QString m_commonDirectory;
- QStringList m_files;
+ FilePaths m_files;
bool m_deploys = false;
QString m_deployText;
AddNewTree *m_bestChoice = nullptr;
@@ -157,7 +157,7 @@ private:
int m_bestMatchPriority = -1;
};
-BestNodeSelector::BestNodeSelector(const QString &commonDirectory, const QStringList &files) :
+BestNodeSelector::BestNodeSelector(const QString &commonDirectory, const FilePaths &files) :
m_commonDirectory(commonDirectory),
m_files(files),
m_deployText(QCoreApplication::translate("ProjectWizard", "The files are implicitly added to the projects:") + QLatin1Char('\n'))
@@ -230,7 +230,8 @@ static inline AddNewTree *createNoneNode(BestNodeSelector *selector)
return new AddNewTree(displayName);
}
-static inline AddNewTree *buildAddProjectTree(ProjectNode *root, const QString &projectPath, Node *contextNode, BestNodeSelector *selector)
+static inline AddNewTree *buildAddProjectTree(ProjectNode *root, const FilePath &projectPath,
+ Node *contextNode, BestNodeSelector *selector)
{
QList<AddNewTree *> children;
for (Node *node : root->nodes()) {
@@ -242,7 +243,7 @@ static inline AddNewTree *buildAddProjectTree(ProjectNode *root, const QString &
if (root->supportsAction(AddSubProject, root) && !root->supportsAction(InheritedFromParent, root)) {
if (projectPath.isEmpty() || root->canAddSubProject(projectPath)) {
- FolderNode::AddNewInformation info = root->addNewInformation(QStringList() << projectPath, contextNode);
+ FolderNode::AddNewInformation info = root->addNewInformation({projectPath}, contextNode);
auto item = new AddNewTree(root, children, info);
selector->inspect(item, root == contextNode);
return item;
@@ -254,8 +255,8 @@ static inline AddNewTree *buildAddProjectTree(ProjectNode *root, const QString &
return new AddNewTree(root, children, root->displayName());
}
-static inline AddNewTree *buildAddFilesTree(FolderNode *root, const QStringList &files,
- Node *contextNode, BestNodeSelector *selector)
+static AddNewTree *buildAddFilesTree(FolderNode *root, const FilePaths &files,
+ Node *contextNode, BestNodeSelector *selector)
{
QList<AddNewTree *> children;
foreach (FolderNode *fn, root->folderNodes()) {
@@ -436,7 +437,7 @@ bool ProjectWizardPage::runVersionControl(const QList<GeneratedFile> &files, QSt
return true;
}
-void ProjectWizardPage::initializeProjectTree(Node *context, const QStringList &paths,
+void ProjectWizardPage::initializeProjectTree(Node *context, const FilePaths &paths,
IWizardFactory::WizardKind kind,
ProjectAction action)
{
diff --git a/src/plugins/projectexplorer/projectwizardpage.h b/src/plugins/projectexplorer/projectwizardpage.h
index e930e3c4d3..0306aeb936 100644
--- a/src/plugins/projectexplorer/projectwizardpage.h
+++ b/src/plugins/projectexplorer/projectwizardpage.h
@@ -69,7 +69,7 @@ public:
bool runVersionControl(const QList<Core::GeneratedFile> &files, QString *errorMessage);
- void initializeProjectTree(Node *context, const QStringList &paths,
+ void initializeProjectTree(Node *context, const Utils::FilePaths &paths,
Core::IWizardFactory::WizardKind kind,
ProjectAction action);
diff --git a/src/plugins/qbsprojectmanager/qbsnodes.cpp b/src/plugins/qbsprojectmanager/qbsnodes.cpp
index 1393583213..2a155d2128 100644
--- a/src/plugins/qbsprojectmanager/qbsnodes.cpp
+++ b/src/plugins/qbsprojectmanager/qbsnodes.cpp
@@ -78,7 +78,7 @@ QbsGroupNode::QbsGroupNode(const QJsonObject &grp) : ProjectNode(FilePath()), m_
setEnabled(grp.value("is-enabled").toBool());
}
-FolderNode::AddNewInformation QbsGroupNode::addNewInformation(const QStringList &files,
+FolderNode::AddNewInformation QbsGroupNode::addNewInformation(const FilePaths &files,
Node *context) const
{
AddNewInformation info = ProjectNode::addNewInformation(files, context);
diff --git a/src/plugins/qbsprojectmanager/qbsnodes.h b/src/plugins/qbsprojectmanager/qbsnodes.h
index 0f188ea6dc..9882c0ea59 100644
--- a/src/plugins/qbsprojectmanager/qbsnodes.h
+++ b/src/plugins/qbsprojectmanager/qbsnodes.h
@@ -46,7 +46,7 @@ public:
private:
friend class QbsBuildSystem;
- AddNewInformation addNewInformation(const QStringList &files, Node *context) const override;
+ AddNewInformation addNewInformation(const Utils::FilePaths &files, Node *context) const override;
QVariant data(Utils::Id role) const override;
const QJsonObject m_groupData;
diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp
index cb4222db97..b3b719f925 100644
--- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp
@@ -169,19 +169,19 @@ bool QmakeBuildSystem::supportsAction(Node *context, ProjectAction action, const
return BuildSystem::supportsAction(context, action, node);
}
-bool QmakePriFileNode::canAddSubProject(const QString &proFilePath) const
+bool QmakePriFileNode::canAddSubProject(const FilePath &proFilePath) const
{
const QmakePriFile *pri = priFile();
return pri ? pri->canAddSubProject(proFilePath) : false;
}
-bool QmakePriFileNode::addSubProject(const QString &proFilePath)
+bool QmakePriFileNode::addSubProject(const FilePath &proFilePath)
{
QmakePriFile *pri = priFile();
return pri ? pri->addSubProject(proFilePath) : false;
}
-bool QmakePriFileNode::removeSubProject(const QString &proFilePath)
+bool QmakePriFileNode::removeSubProject(const FilePath &proFilePath)
{
QmakePriFile *pri = priFile();
return pri ? pri->removeSubProjects(proFilePath) : false;
@@ -299,7 +299,7 @@ bool QmakeBuildSystem::addDependencies(Node *context, const QStringList &depende
return BuildSystem::addDependencies(context, dependencies);
}
-FolderNode::AddNewInformation QmakePriFileNode::addNewInformation(const QStringList &files, Node *context) const
+FolderNode::AddNewInformation QmakePriFileNode::addNewInformation(const FilePaths &files, Node *context) const
{
Q_UNUSED(files)
return FolderNode::AddNewInformation(filePath().fileName(), context && context->parentProjectNode() == this ? 120 : 90);
@@ -483,7 +483,7 @@ bool QmakeProFileNode::includedInExactParse() const
return pro && pro->includedInExactParse();
}
-FolderNode::AddNewInformation QmakeProFileNode::addNewInformation(const QStringList &files, Node *context) const
+FolderNode::AddNewInformation QmakeProFileNode::addNewInformation(const FilePaths &files, Node *context) const
{
Q_UNUSED(files)
return AddNewInformation(filePath().fileName(), context && context->parentProjectNode() == this ? 120 : 100);
diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.h b/src/plugins/qmakeprojectmanager/qmakenodes.h
index 3195ce2291..798a813dad 100644
--- a/src/plugins/qmakeprojectmanager/qmakenodes.h
+++ b/src/plugins/qmakeprojectmanager/qmakenodes.h
@@ -48,12 +48,12 @@ public:
bool showInSimpleTree() const override { return false; }
- bool canAddSubProject(const QString &proFilePath) const override;
- bool addSubProject(const QString &proFilePath) override;
- bool removeSubProject(const QString &proFilePath) override;
+ bool canAddSubProject(const Utils::FilePath &proFilePath) const override;
+ bool addSubProject(const Utils::FilePath &proFilePath) override;
+ bool removeSubProject(const Utils::FilePath &proFilePath) override;
QStringList subProjectFileNamePatterns() const override;
- AddNewInformation addNewInformation(const QStringList &files, Node *context) const override;
+ AddNewInformation addNewInformation(const Utils::FilePaths &files, Node *context) const override;
bool deploysFolder(const QString &folder) const override;
@@ -93,7 +93,7 @@ public:
void build() override;
QStringList targetApplications() const override;
- AddNewInformation addNewInformation(const QStringList &files, Node *context) const override;
+ AddNewInformation addNewInformation(const Utils::FilePaths &files, Node *context) const override;
QVariant data(Utils::Id role) const override;
bool setData(Utils::Id role, const QVariant &value) const override;
diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp
index 9276345d22..7f8b5fac3d 100644
--- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp
@@ -496,13 +496,9 @@ void QmakePriFile::setIncludedInExactParse(bool b)
m_includedInExactParse = b;
}
-bool QmakePriFile::canAddSubProject(const QString &proFilePath) const
+bool QmakePriFile::canAddSubProject(const FilePath &proFilePath) const
{
- QFileInfo fi(proFilePath);
- if (fi.suffix() == QLatin1String("pro")
- || fi.suffix() == QLatin1String("pri"))
- return true;
- return false;
+ return proFilePath.suffix() == "pro" || proFilePath.suffix() == "pri";
}
static FilePath simplifyProFilePath(const FilePath &proFilePath)
@@ -517,11 +513,11 @@ static FilePath simplifyProFilePath(const FilePath &proFilePath)
return proFilePath;
}
-bool QmakePriFile::addSubProject(const QString &proFile)
+bool QmakePriFile::addSubProject(const FilePath &proFile)
{
FilePaths uniqueProFilePaths;
- if (!m_recursiveEnumerateFiles.contains(FilePath::fromString(proFile)))
- uniqueProFilePaths.append(simplifyProFilePath(FilePath::fromString(proFile)));
+ if (!m_recursiveEnumerateFiles.contains(proFile))
+ uniqueProFilePaths.append(simplifyProFilePath(proFile));
FilePaths failedFiles;
changeFiles(QLatin1String(Constants::PROFILE_MIMETYPE), uniqueProFilePaths, &failedFiles, AddToProFile);
@@ -529,10 +525,10 @@ bool QmakePriFile::addSubProject(const QString &proFile)
return failedFiles.isEmpty();
}
-bool QmakePriFile::removeSubProjects(const QString &proFilePath)
+bool QmakePriFile::removeSubProjects(const FilePath &proFilePath)
{
FilePaths failedOriginalFiles;
- changeFiles(QLatin1String(Constants::PROFILE_MIMETYPE), {FilePath::fromString(proFilePath)}, &failedOriginalFiles, RemoveFromProFile);
+ changeFiles(QLatin1String(Constants::PROFILE_MIMETYPE), {proFilePath}, &failedOriginalFiles, RemoveFromProFile);
FilePaths simplifiedProFiles = Utils::transform(failedOriginalFiles, &simplifyProFilePath);
diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.h b/src/plugins/qmakeprojectmanager/qmakeparsernodes.h
index 836c04e589..f03d748209 100644
--- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.h
+++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.h
@@ -157,10 +157,10 @@ public:
void update(const Internal::QmakePriFileEvalResult &result);
- bool canAddSubProject(const QString &proFilePath) const;
+ bool canAddSubProject(const Utils::FilePath &proFilePath) const;
- bool addSubProject(const QString &proFile);
- bool removeSubProjects(const QString &proFilePath);
+ bool addSubProject(const Utils::FilePath &proFile);
+ bool removeSubProjects(const Utils::FilePath &proFilePath);
bool addFiles(const Utils::FilePaths &filePaths, Utils::FilePaths *notAdded = nullptr);
bool removeFiles(const Utils::FilePaths &filePaths, Utils::FilePaths *notRemoved = nullptr);
diff --git a/src/plugins/resourceeditor/resourcenode.cpp b/src/plugins/resourceeditor/resourcenode.cpp
index e2d051960f..3a6f7993ab 100644
--- a/src/plugins/resourceeditor/resourcenode.cpp
+++ b/src/plugins/resourceeditor/resourcenode.cpp
@@ -119,7 +119,7 @@ static int getPriorityFromContextNode(const ProjectExplorer::Node *resourceNode,
return -1;
}
-static bool hasPriority(const QStringList &files)
+static bool hasPriority(const FilePaths &files)
{
if (files.isEmpty())
return false;
@@ -446,7 +446,7 @@ bool ResourceTopLevelNode::removeNonExistingFiles()
return true;
}
-FolderNode::AddNewInformation ResourceTopLevelNode::addNewInformation(const QStringList &files, Node *context) const
+FolderNode::AddNewInformation ResourceTopLevelNode::addNewInformation(const FilePaths &files, Node *context) const
{
QString name = QCoreApplication::translate("ResourceTopLevelNode", "%1 Prefix: %2")
.arg(filePath().fileName())
@@ -587,7 +587,7 @@ bool ResourceFolderNode::renamePrefix(const QString &prefix, const QString &lang
return true;
}
-FolderNode::AddNewInformation ResourceFolderNode::addNewInformation(const QStringList &files, Node *context) const
+FolderNode::AddNewInformation ResourceFolderNode::addNewInformation(const FilePaths &files, Node *context) const
{
QString name = QCoreApplication::translate("ResourceTopLevelNode", "%1 Prefix: %2")
.arg(m_topLevelNode->filePath().fileName())
diff --git a/src/plugins/resourceeditor/resourcenode.h b/src/plugins/resourceeditor/resourcenode.h
index 3a140d46b2..a992e267dc 100644
--- a/src/plugins/resourceeditor/resourcenode.h
+++ b/src/plugins/resourceeditor/resourcenode.h
@@ -49,7 +49,7 @@ public:
bool addPrefix(const QString &prefix, const QString &lang);
bool removePrefix(const QString &prefix, const QString &lang);
- AddNewInformation addNewInformation(const QStringList &files, Node *context) const override;
+ AddNewInformation addNewInformation(const Utils::FilePaths &files, Node *context) const override;
bool showInSimpleTree() const override;
bool removeNonExistingFiles();
@@ -78,7 +78,7 @@ public:
bool renamePrefix(const QString &prefix, const QString &lang);
- AddNewInformation addNewInformation(const QStringList &files, Node *context) const override;
+ AddNewInformation addNewInformation(const Utils::FilePaths &files, Node *context) const override;
QString prefix() const;
QString lang() const;