| 484 | } |
| 485 | |
| 486 | void LogView::messages_refresh() |
| 487 | { |
| 488 | rdcstr contents; |
| 489 | RENDERDOC_GetLogFileContents(prevOffset, contents); |
| 490 | |
| 491 | if(contents.empty()) |
| 492 | return; |
| 493 | |
| 494 | // look at all new lines since the last one we saw |
| 495 | QStringList lines = QString(contents).split(QRegularExpression(lit("[\r\n]"))); |
| 496 | prevOffset += contents.size(); |
| 497 | |
| 498 | QString r = |
| 499 | lit("^" // start of the line |
| 500 | "([A-Z][A-Z][A-Z][A-Z]) " // project |
| 501 | "([0-9]+): " // PID |
| 502 | "\\[([0-9][0-9]):([0-9][0-9]):([0-9][0-9])\\] " // timestamp |
| 503 | "\\s*([^(]+)\\(\\s*([0-9]+)\\) - " // filename.ext( line) |
| 504 | "([A-Za-z]+)\\s+- " // type |
| 505 | "(.*)"); |
| 506 | |
| 507 | QRegularExpression logRegex(r); |
| 508 | |
| 509 | int prevCount = m_Messages.count(); |
| 510 | |
| 511 | for(const QString &line : lines) |
| 512 | { |
| 513 | QRegularExpressionMatch match = logRegex.match(line); |
| 514 | |
| 515 | if(match.hasMatch()) |
| 516 | { |
| 517 | LogMessage msg; |
| 518 | msg.Source = match.captured(1); |
| 519 | |
| 520 | if(msg.Source == lit("ADRD")) |
| 521 | msg.Source = tr("Android"); |
| 522 | else if(msg.Source == lit("QTRD")) |
| 523 | msg.Source = tr("UI"); |
| 524 | else if(msg.Source == lit("RDOC")) |
| 525 | msg.Source = tr("Core"); |
| 526 | |
| 527 | msg.PID = match.captured(2).toUInt(); |
| 528 | msg.Timestamp = |
| 529 | QTime(match.captured(3).toUInt(), match.captured(4).toUInt(), match.captured(5).toUInt()); |
| 530 | msg.Location = QFormatStr("%1(%2)").arg(match.captured(6)).arg(match.captured(7)); |
| 531 | msg.Type = (LogType)logTypeStrings.indexOf(match.captured(8)); |
| 532 | msg.Message = match.captured(9).trimmed(); |
| 533 | |
| 534 | m_Messages.push_back(msg); |
| 535 | |
| 536 | if(!m_PIDs.contains(msg.PID)) |
| 537 | { |
| 538 | m_PIDs.append(msg.PID); |
| 539 | QStandardItem *item = new QStandardItem(QString::number(msg.PID)); |
| 540 | item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); |
| 541 | item->setData(Qt::Checked, Qt::CheckStateRole); |
| 542 | m_PIDModel->appendRow(item); |
| 543 | } |
nothing calls this directly
no test coverage detected