aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/outputformatter.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2020-06-18 00:04:17 +0300
committerOrgad Shaneh <orgads@gmail.com>2020-06-21 06:47:20 +0000
commit92a4c0d38a007f778893f7b971f747e1a803eac3 (patch)
tree86f1a65f2200154141b80a4d3026c8dc3f358099 /src/libs/utils/outputformatter.cpp
parentcb0b8556c81437dc02ca3abd9cca26ef44ad6c28 (diff)
VCS: Pass links to the correct VCS
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 <artur.shepilko@nomadbyte.com> Reviewed-by: André Hartmann <aha_1980@gmx.de>
Diffstat (limited to 'src/libs/utils/outputformatter.cpp')
-rw-r--r--src/libs/utils/outputformatter.cpp22
1 files changed, 14 insertions, 8 deletions
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;