From b3bc499ebd506f7ce4fc4de243830e07fedd8428 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 12 Jan 2023 14:12:20 +0100 Subject: [PATCH] QtSupport: Some FilePathification in the OutputParser Change-Id: I618bb47608593b5a60636c5e740f4d19e68e4f5a Reviewed-by: Marcus Tillmanns --- src/plugins/qtsupport/qtoutputformatter.cpp | 24 ++++++++++----------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/plugins/qtsupport/qtoutputformatter.cpp b/src/plugins/qtsupport/qtoutputformatter.cpp index 5025b0cf865..d7aeda828e5 100644 --- a/src/plugins/qtsupport/qtoutputformatter.cpp +++ b/src/plugins/qtsupport/qtoutputformatter.cpp @@ -29,8 +29,7 @@ using namespace ProjectExplorer; using namespace Utils; -namespace QtSupport { -namespace Internal { +namespace QtSupport::Internal { class QtOutputFormatterPrivate { @@ -65,10 +64,10 @@ public: ~QtOutputLineParser() override; protected: - virtual void openEditor(const QString &fileName, int line, int column = -1); + virtual void openEditor(const FilePath &filePath, int line, int column = -1); private: - Result handleLine(const QString &text, Utils::OutputFormat format) override; + Result handleLine(const QString &text, OutputFormat format) override; bool handleLink(const QString &href) override; void updateProjectFileList(); @@ -148,7 +147,7 @@ bool QtOutputLineParser::handleLink(const QString &href) const QRegularExpressionMatch qmlLineColumnMatch = qmlLineColumnLink.match(href); const auto getFileToOpen = [this](const QUrl &fileUrl) { - return chooseFileFromList(d->projectFinder.findFile(fileUrl)).toString(); + return chooseFileFromList(d->projectFinder.findFile(fileUrl)); }; if (qmlLineColumnMatch.hasMatch()) { const QUrl fileUrl = QUrl(qmlLineColumnMatch.captured(1)); @@ -198,16 +197,16 @@ bool QtOutputLineParser::handleLink(const QString &href) } if (!fileName.isEmpty()) { - fileName = getFileToOpen(QUrl::fromLocalFile(fileName)); - openEditor(fileName, line); + const FilePath filePath = getFileToOpen(QUrl::fromLocalFile(fileName)); + openEditor(filePath, line); return true; } return false; } -void QtOutputLineParser::openEditor(const QString &fileName, int line, int column) +void QtOutputLineParser::openEditor(const FilePath &filePath, int line, int column) { - Core::EditorManager::openEditorAt({FilePath::fromString(fileName), line, column}); + Core::EditorManager::openEditorAt({filePath, line, column}); } void QtOutputLineParser::updateProjectFileList() @@ -227,8 +226,7 @@ QtOutputFormatterFactory::QtOutputFormatterFactory() }); } -} // namespace Internal -} // namespace QtSupport +} // QtSupport::Internal // Unit tests: @@ -252,9 +250,9 @@ public: { } - void openEditor(const QString &fileName, int line, int column = -1) + void openEditor(const FilePath &filePath, int line, int column = -1) override { - this->fileName = fileName; + this->fileName = filePath.toString(); this->line = line; this->column = column; }