diff options
author | Daniel Teske <[email protected]> | 2015-06-12 15:36:04 +0200 |
---|---|---|
committer | Daniel Teske <[email protected]> | 2015-06-25 09:41:26 +0000 |
commit | aff02184d45c10da6c3de3c6523fac7646e922b2 (patch) | |
tree | be7bff9417e99b5f74a0bd998eadaf6d0877af26 /src/plugins/android/androidrunner.cpp | |
parent | 1b0e5d787a3bc2d5916c85f9d9f7d01a5a6c75ee (diff) |
Android M: Support new logcat output
Change-Id: I64ae6493b45b3f1cac82e7f5e1ae77ec3b910bc9
Task-number: QTCREATORBUG-14534
Reviewed-by: BogDan Vatra <[email protected]>
Reviewed-by: Daniel Teske <[email protected]>
Diffstat (limited to 'src/plugins/android/androidrunner.cpp')
-rw-r--r-- | src/plugins/android/androidrunner.cpp | 57 |
1 files changed, 43 insertions, 14 deletions
diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp index d833578a795..6409db30f87 100644 --- a/src/plugins/android/androidrunner.cpp +++ b/src/plugins/android/androidrunner.cpp @@ -209,6 +209,21 @@ AndroidRunner::AndroidRunner(QObject *parent, } } } + + m_logCatRegExp = QRegExp(QLatin1String("[0-9\\-]*" // date + "\\s+" + "[0-9\\-:.]*"// time + "\\s*" + "(\\d*)" // pid 1. capture + "\\s+" + "\\d*" // unknown + "\\s+" + "(\\w)" // message type 2. capture + "\\s+" + "(.*): " // source 3. capture + "(.*)" // message 4. capture + "[\\n\\r]*" + )); } AndroidRunner::~AndroidRunner() @@ -526,21 +541,35 @@ void AndroidRunner::logcatProcess(const QByteArray &text, QByteArray &buffer, bo buffer.clear(); } - QByteArray pid(QString::fromLatin1("%1):").arg(m_processPID).toLatin1()); - foreach (QByteArray line, lines) { - if (!line.contains(pid)) + QString pidString = QString::number(m_processPID); + foreach (const QByteArray &msg, lines) { + const QString line = QString::fromUtf8(msg).trimmed(); + if (!line.contains(pidString)) continue; - if (line.endsWith('\r')) - line.chop(1); - line.append('\n'); - if (onlyError || line.startsWith("F/") - || line.startsWith("E/") - || line.startsWith("D/Qt") - || line.startsWith("W/")) - emit remoteErrorOutput(line); - else - emit remoteOutput(line); - + if (m_logCatRegExp.exactMatch(line)) { + // Android M + if (m_logCatRegExp.cap(1) == pidString) { + const QString &messagetype = m_logCatRegExp.cap(2); + QString output = line.mid(m_logCatRegExp.pos(2)); + + if (onlyError + || messagetype == QLatin1String("F") + || messagetype == QLatin1String("E") + || messagetype == QLatin1String("W") + || messagetype == QLatin1String("D")) + emit remoteErrorOutput(output); + else + emit remoteOutput(output); + } + } else { + if (onlyError || line.startsWith(_("F/")) + || line.startsWith(_("E/")) + || line.startsWith(_("D/Qt")) + || line.startsWith(_("W/"))) + emit remoteErrorOutput(line); + else + emit remoteOutput(line); + } } } |