From bb6847e3ecd7db40f3b009ccccb2019c86c327f6 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 29 Sep 2022 14:29:10 +0200 Subject: [PATCH] QbsProjectManager: Proliferate the use of FilePath Also use path() instead of toString(). While this doesn't change anything as long as there is no remotely running QbsSession, path() would be the better choice then. Change-Id: Ief98536b34fe615f6b0be03cb3072df7b69f293b Reviewed-by: Christian Kandeler --- src/plugins/qbsprojectmanager/qbsproject.cpp | 2 +- .../qbsprojectmanager/qbsprojectparser.cpp | 18 ++++++++---------- .../qbsprojectmanager/qbsprojectparser.h | 12 ++++++------ 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index 979d5efed6f..60fe82b56e5 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -616,7 +616,7 @@ void QbsBuildSystem::parseCurrentBuildConfiguration() ->expand(QbsSettings::defaultInstallDirTemplate())); } Environment env = m_buildConfiguration->environment(); - QString dir = m_buildConfiguration->buildDirectory().toString(); + FilePath dir = m_buildConfiguration->buildDirectory(); m_guard = guardParsingRun(); diff --git a/src/plugins/qbsprojectmanager/qbsprojectparser.cpp b/src/plugins/qbsprojectmanager/qbsprojectparser.cpp index 5e8886713a1..2ab317c13ff 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectparser.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectparser.cpp @@ -16,15 +16,14 @@ using namespace Utils; -namespace QbsProjectManager { -namespace Internal { +namespace QbsProjectManager::Internal { // -------------------------------------------------------------------- // QbsProjectParser: // -------------------------------------------------------------------- QbsProjectParser::QbsProjectParser(QbsBuildSystem *buildSystem, QFutureInterface *fi) - : m_projectFilePath(buildSystem->project()->projectFilePath().toString()), + : m_projectFilePath(buildSystem->project()->projectFilePath()), m_session(buildSystem->session()), m_fi(fi) { @@ -40,8 +39,8 @@ QbsProjectParser::~QbsProjectParser() m_fi = nullptr; // we do not own m_fi, do not delete } -void QbsProjectParser::parse(const QVariantMap &config, const Environment &env, const QString &dir, - const QString &configName) +void QbsProjectParser::parse(const QVariantMap &config, const Environment &env, + const FilePath &dir, const QString &configName) { QTC_ASSERT(m_session, return); QTC_ASSERT(!dir.isEmpty(), return); @@ -61,10 +60,10 @@ void QbsProjectParser::parse(const QVariantMap &config, const Environment &env, // People don't like it when files are created as a side effect of opening a project, // so do not store the build graph if the build directory does not exist yet. - request.insert("dry-run", !QFileInfo::exists(dir)); + request.insert("dry-run", !dir.exists()); - request.insert("build-root", dir); - request.insert("project-file-path", m_projectFilePath); + request.insert("build-root", dir.path()); + request.insert("project-file-path", m_projectFilePath.path()); request.insert("override-build-graph-data", true); static const auto envToJson = [](const Environment &env) { QJsonObject envObj; @@ -108,5 +107,4 @@ void QbsProjectParser::cancel() m_session->cancelCurrentJob(); } -} // namespace Internal -} // namespace QbsProjectManager +} // QbsProjectManager::Internal diff --git a/src/plugins/qbsprojectmanager/qbsprojectparser.h b/src/plugins/qbsprojectmanager/qbsprojectparser.h index 531324a9fa3..568e663e13b 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectparser.h +++ b/src/plugins/qbsprojectmanager/qbsprojectparser.h @@ -11,8 +11,7 @@ #include #include -namespace QbsProjectManager { -namespace Internal { +namespace QbsProjectManager::Internal { class QbsBuildSystem; @@ -24,7 +23,9 @@ public: QbsProjectParser(QbsBuildSystem *buildSystem, QFutureInterface *fi); ~QbsProjectParser() override; - void parse(const QVariantMap &config, const Utils::Environment &env, const QString &dir, + void parse(const QVariantMap &config, + const Utils::Environment &env, + const Utils::FilePath &dir, const QString &configName); void cancel(); Utils::Environment environment() const { return m_environment; } @@ -38,7 +39,7 @@ signals: private: Utils::Environment m_environment; - const QString m_projectFilePath; + const Utils::FilePath m_projectFilePath; QbsSession * const m_session; ErrorInfo m_error; QJsonObject m_projectData; @@ -46,5 +47,4 @@ private: QFutureInterface *m_fi = nullptr; }; -} // namespace Internal -} // namespace QbsProjectManager +} // QbsProjectManager::Internal