forked from qt-creator/qt-creator
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>
This commit is contained in:
committed by
Orgad Shaneh
parent
cb0b8556c8
commit
92a4c0d38a
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user