From 92a4c0d38a007f778893f7b971f747e1a803eac3 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 18 Jun 2020 00:04:17 +0300 Subject: VCS: Pass links to the correct VCS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current implementation requires each VCS to connect to the referenceClicked signal. Only Git does it, but this is conceptually wrong. If other VCSs would connect to the same signal, all of them will act upon clicking a link, which can result in multiple editors, most of them are likely to be invalid anyway. By default executes vcsDescribe. Can be extended or modified by subclasses. Change-Id: Ib953009efd77446a4b2963f0aa8a2f3f3d26509f Reviewed-by: Artur Shepilko Reviewed-by: André Hartmann --- src/libs/utils/outputformatter.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/libs/utils/outputformatter.cpp') diff --git a/src/libs/utils/outputformatter.cpp b/src/libs/utils/outputformatter.cpp index 31ed810012..355fcb24ab 100644 --- a/src/libs/utils/outputformatter.cpp +++ b/src/libs/utils/outputformatter.cpp @@ -489,20 +489,26 @@ void OutputFormatter::dumpIncompleteLine(const QString &line, OutputFormat forma d->incompleteLine.second = format; } +bool OutputFormatter::handleFileLink(const QString &href) +{ + if (!OutputLineParser::isLinkTarget(href)) + return false; + FilePath filePath; + int line; + int column; + OutputLineParser::parseLinkTarget(href, filePath, line, column); + QTC_ASSERT(!filePath.isEmpty(), return false); + emit openInEditorRequested(filePath, line, column); + return true; +} + void OutputFormatter::handleLink(const QString &href) { QTC_ASSERT(!href.isEmpty(), return); // We can handle absolute file paths ourselves. Other types of references are forwarded // to the line parsers. - if (OutputLineParser::isLinkTarget(href)) { - FilePath filePath; - int line; - int column; - OutputLineParser::parseLinkTarget(href, filePath, line, column); - QTC_ASSERT(!filePath.isEmpty(), return); - emit openInEditorRequested(filePath, line, column); + if (handleFileLink(href)) return; - } for (OutputLineParser * const f : qAsConst(d->lineParsers)) { if (f->handleLink(href)) return; -- cgit v1.2.3