| 1641 | } |
| 1642 | |
| 1643 | void NetworkDiagnosticsDialog::appendTciMessage(const QString& direction, |
| 1644 | const QString& text) |
| 1645 | { |
| 1646 | if (!m_tciLogTable || m_tciMonitorPaused) |
| 1647 | return; |
| 1648 | |
| 1649 | const QString stamp = |
| 1650 | QTime::currentTime().toString(QStringLiteral("HH:mm:ss.zzz")); |
| 1651 | const bool rx = (direction == QLatin1String("rx")); |
| 1652 | const QString dirTag = rx ? QStringLiteral("▶ ") // ▶ |
| 1653 | : QStringLiteral("◀ "); // ◀ |
| 1654 | |
| 1655 | // One row per semicolon-delimited command so colour + suppression work |
| 1656 | // per command, exactly like the standalone monitor. |
| 1657 | const QStringList cmds = text.split(QLatin1Char(';'), Qt::SkipEmptyParts); |
| 1658 | for (const QString& raw : cmds) { |
| 1659 | const QString cmd = raw.trimmed(); |
| 1660 | if (cmd.isEmpty()) |
| 1661 | continue; |
| 1662 | const QString prefix = tciCmdOf(cmd); |
| 1663 | if (m_tciSuppressed.contains(prefix)) |
| 1664 | continue; |
| 1665 | |
| 1666 | constexpr int kMaxRows = 20000; // rolling window, bound memory |
| 1667 | if (m_tciLogTable->rowCount() >= kMaxRows) |
| 1668 | m_tciLogTable->removeRow(0); |
| 1669 | |
| 1670 | const int row = m_tciLogTable->rowCount(); |
| 1671 | m_tciLogTable->insertRow(row); |
| 1672 | const QColor colour(tciLineColor(cmd)); |
| 1673 | |
| 1674 | auto* tItem = new QTableWidgetItem(stamp); |
| 1675 | tItem->setForeground(QColor(QStringLiteral("#6b8099"))); |
| 1676 | auto* cItem = new QTableWidgetItem(dirTag + prefix); |
| 1677 | cItem->setForeground(rx ? QColor(QStringLiteral("#9cff00")) |
| 1678 | : QColor(QStringLiteral("#7c9cff"))); |
| 1679 | auto* mItem = new QTableWidgetItem(cmd); |
| 1680 | mItem->setForeground(colour); |
| 1681 | m_tciLogTable->setItem(row, 0, tItem); |
| 1682 | m_tciLogTable->setItem(row, 1, cItem); |
| 1683 | m_tciLogTable->setItem(row, 2, mItem); |
| 1684 | } |
| 1685 | m_tciLogTable->scrollToBottom(); |
| 1686 | } |
| 1687 | |
| 1688 | void NetworkDiagnosticsDialog::onTciLogContextMenu(const QPoint& pos) |
| 1689 | { |