forked from qt-creator/qt-creator
Make ASSERT information clickable
* Make information raised by Qt assert clickable. Task-number: QTCREATORBUG-2175 Reviewed-by: Olivier Goffart
This commit is contained in:
@@ -43,10 +43,9 @@ QtOutputFormatter::QtOutputFormatter(Qt4Project *project)
|
|||||||
: OutputFormatter()
|
: OutputFormatter()
|
||||||
, m_qmlError(QLatin1String("(file:///.+:\\d+:\\d+):"))
|
, m_qmlError(QLatin1String("(file:///.+:\\d+:\\d+):"))
|
||||||
, m_qtError(QLatin1String("Object::.*in (.*:\\d+)"))
|
, m_qtError(QLatin1String("Object::.*in (.*:\\d+)"))
|
||||||
|
, m_qtAssert(QLatin1String("^ASSERT: .* in file (.+, line \\d+)$"))
|
||||||
, m_project(project)
|
, m_project(project)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkResult QtOutputFormatter::matchLine(const QString &line) const
|
LinkResult QtOutputFormatter::matchLine(const QString &line) const
|
||||||
@@ -62,6 +61,10 @@ LinkResult QtOutputFormatter::matchLine(const QString &line) const
|
|||||||
lr.href = m_qtError.cap(1);
|
lr.href = m_qtError.cap(1);
|
||||||
lr.start = m_qtError.pos(1);
|
lr.start = m_qtError.pos(1);
|
||||||
lr.end = lr.start + lr.href.length();
|
lr.end = lr.start + lr.href.length();
|
||||||
|
} else if (m_qtAssert.indexIn(line) != -1) {
|
||||||
|
lr.href = m_qtAssert.cap(1);
|
||||||
|
lr.start = m_qtAssert.pos(1);
|
||||||
|
lr.end = lr.start + lr.href.length();
|
||||||
}
|
}
|
||||||
return lr;
|
return lr;
|
||||||
}
|
}
|
||||||
@@ -160,10 +163,22 @@ void QtOutputFormatter::handleLink(const QString &href)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString fileName;
|
||||||
|
int line = -1;
|
||||||
|
|
||||||
QRegExp qtErrorLink(QLatin1String("^(.*):(\\d+)$"));
|
QRegExp qtErrorLink(QLatin1String("^(.*):(\\d+)$"));
|
||||||
if (qtErrorLink.indexIn(href) != 1) {
|
if (qtErrorLink.indexIn(href) != -1) {
|
||||||
QString fileName = qtErrorLink.cap(1);
|
fileName = qtErrorLink.cap(1);
|
||||||
const int line = qtErrorLink.cap(2).toInt();
|
line = qtErrorLink.cap(2).toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
QRegExp qtAssertLink(QLatin1String("^(.+), line (\\d+)$"));
|
||||||
|
if (qtAssertLink.indexIn(href) != -1) {
|
||||||
|
fileName = qtAssertLink.cap(1);
|
||||||
|
line = qtAssertLink.cap(2).toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fileName.isEmpty()) {
|
||||||
QFileInfo fi(fileName);
|
QFileInfo fi(fileName);
|
||||||
if (fi.isRelative()) {
|
if (fi.isRelative()) {
|
||||||
// Yeah fileName is relative, no suprise
|
// Yeah fileName is relative, no suprise
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ private:
|
|||||||
|
|
||||||
QRegExp m_qmlError;
|
QRegExp m_qmlError;
|
||||||
QRegExp m_qtError;
|
QRegExp m_qtError;
|
||||||
|
QRegExp m_qtAssert;
|
||||||
QWeakPointer<Qt4Project> m_project;
|
QWeakPointer<Qt4Project> m_project;
|
||||||
QTextCharFormat m_linkFormat;
|
QTextCharFormat m_linkFormat;
|
||||||
QString m_lastLine;
|
QString m_lastLine;
|
||||||
|
|||||||
Reference in New Issue
Block a user