diff options
author | Tobias Hunger <tobias.hunger@nokia.com> | 2010-08-26 15:31:14 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@nokia.com> | 2010-08-26 15:56:57 +0200 |
commit | 4da21c612eddda05fe8e89f9e03c019097b7af5a (patch) | |
tree | 4290fba71c39af816aa92aa4f8179a9c82446ea2 /src | |
parent | 2f82d775cac93401a44225c28222214abfe1bbc1 (diff) | |
download | qt-creator-4da21c612eddda05fe8e89f9e03c019097b7af5a.tar.gz |
Make ASSERT information clickable
* Make information raised by Qt assert clickable.
Task-number: QTCREATORBUG-2175
Reviewed-by: Olivier Goffart
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/qt4projectmanager/qtoutputformatter.cpp | 25 | ||||
-rw-r--r-- | src/plugins/qt4projectmanager/qtoutputformatter.h | 1 |
2 files changed, 21 insertions, 5 deletions
diff --git a/src/plugins/qt4projectmanager/qtoutputformatter.cpp b/src/plugins/qt4projectmanager/qtoutputformatter.cpp index ae2ecb1fab..859f652bb3 100644 --- a/src/plugins/qt4projectmanager/qtoutputformatter.cpp +++ b/src/plugins/qt4projectmanager/qtoutputformatter.cpp @@ -43,10 +43,9 @@ QtOutputFormatter::QtOutputFormatter(Qt4Project *project) : OutputFormatter() , m_qmlError(QLatin1String("(file:///.+:\\d+:\\d+):")) , m_qtError(QLatin1String("Object::.*in (.*:\\d+)")) + , m_qtAssert(QLatin1String("^ASSERT: .* in file (.+, line \\d+)$")) , m_project(project) - { - } 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.start = m_qtError.pos(1); 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; } @@ -160,10 +163,22 @@ void QtOutputFormatter::handleLink(const QString &href) return; } + QString fileName; + int line = -1; + QRegExp qtErrorLink(QLatin1String("^(.*):(\\d+)$")); - if (qtErrorLink.indexIn(href) != 1) { - QString fileName = qtErrorLink.cap(1); - const int line = qtErrorLink.cap(2).toInt(); + if (qtErrorLink.indexIn(href) != -1) { + fileName = qtErrorLink.cap(1); + 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); if (fi.isRelative()) { // Yeah fileName is relative, no suprise diff --git a/src/plugins/qt4projectmanager/qtoutputformatter.h b/src/plugins/qt4projectmanager/qtoutputformatter.h index 23b386d86f..9b90a0d37d 100644 --- a/src/plugins/qt4projectmanager/qtoutputformatter.h +++ b/src/plugins/qt4projectmanager/qtoutputformatter.h @@ -61,6 +61,7 @@ private: QRegExp m_qmlError; QRegExp m_qtError; + QRegExp m_qtAssert; QWeakPointer<Qt4Project> m_project; QTextCharFormat m_linkFormat; QString m_lastLine; |