* @brief Builds the definition-grid block plus tags and notes. */
| 412 | * @brief Builds the definition-grid block plus tags and notes. |
| 413 | */ |
| 414 | QString Sessions::HtmlReport::buildMetadataSection() const |
| 415 | { |
| 416 | struct Row { |
| 417 | QString label; |
| 418 | QString value; |
| 419 | }; |
| 420 | |
| 421 | const std::vector<Row> rows = { |
| 422 | // code-verify off |
| 423 | { tr("Project"), m_data.projectTitle.isEmpty() ? QStringLiteral("—") : m_data.projectTitle}, |
| 424 | // code-verify on |
| 425 | { tr("Test identifier"), QStringLiteral("#%1").arg(m_data.sessionId)}, |
| 426 | { tr("Start time"), formatDate(m_data.startedAt)}, |
| 427 | { tr("End time"), formatDate(m_data.endedAt)}, |
| 428 | { tr("Total duration"), formatDuration(m_data.durationMs)}, |
| 429 | { tr("Samples acquired"), QString::number(m_data.frameCount)}, |
| 430 | {tr("Parameters logged"), QString::number(m_data.datasets.size())}, |
| 431 | }; |
| 432 | |
| 433 | QString defs; |
| 434 | for (const auto& row : rows) { |
| 435 | defs += |
| 436 | QStringLiteral("<dt>%1</dt><dd>%2</dd>").arg(escapeHtml(row.label), escapeHtml(row.value)); |
| 437 | } |
| 438 | |
| 439 | QString tagsBlock; |
| 440 | if (!m_data.tags.isEmpty()) { |
| 441 | QString chips; |
| 442 | for (const QString& t : m_data.tags) |
| 443 | chips += QStringLiteral("<span class=\"tag\">%1</span>").arg(escapeHtml(t)); |
| 444 | |
| 445 | tagsBlock = QStringLiteral("<dt>%1</dt><dd><div class=\"tags\">%2</div></dd>") |
| 446 | .arg(escapeHtml(tr("Classification")), chips); |
| 447 | } |
| 448 | |
| 449 | QString notesBlock; |
| 450 | if (!m_data.notes.trimmed().isEmpty()) { |
| 451 | notesBlock = QStringLiteral("<div class=\"notes-label\">%1</div>" |
| 452 | "<div class=\"notes\">%2</div>") |
| 453 | .arg(escapeHtml(tr("Notes")), escapeHtml(m_data.notes)); |
| 454 | } |
| 455 | |
| 456 | return QStringLiteral("<section class=\"section\">" |
| 457 | "<h2>%1</h2>" |
| 458 | "<dl class=\"defs\">%2%3</dl>" |
| 459 | "%4" |
| 460 | "</section>") |
| 461 | .arg(escapeHtml(tr("Test Information")), defs, tagsBlock, notesBlock); |
| 462 | } |
| 463 | |
| 464 | //-------------------------------------------------------------------------------------------------- |
| 465 | // Section: measurement summary |
nothing calls this directly
no test coverage detected