| 362 | } |
| 363 | |
| 364 | void RC28MappingDialog::refreshDeviceInfo() |
| 365 | { |
| 366 | if (!m_encoder) return; |
| 367 | |
| 368 | const bool connected = m_encoder->isOpen(); |
| 369 | |
| 370 | if (!connected && m_encoder->isBlockedByMultiple()) { |
| 371 | // Guard against the narrow race where the ext-ctrl thread has already |
| 372 | // cleared m_blockedDeviceName but hasn't yet stored the false flag — |
| 373 | // an empty name would produce garbled dialog text. Fall through to the |
| 374 | // "not connected" state; the queued connectionChanged signal corrects it. |
| 375 | const QString blocked = m_encoder->blockedDeviceName(); |
| 376 | if (!blocked.isEmpty()) { |
| 377 | onMultipleDevicesDetected(blocked); |
| 378 | return; |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | m_statusDot->setStyleSheet( |
| 383 | connected ? "color:#00c070; font-size:14px;" |
| 384 | : "color:#4060a0; font-size:14px;"); |
| 385 | if (connected) |
| 386 | m_knownDeviceName = m_encoder->deviceName(); |
| 387 | m_statusLabel->setText(connected ? m_knownDeviceName : "Not connected"); |
| 388 | m_statusLabel->setStyleSheet( |
| 389 | connected ? "color:#c8d8e8; font-size:11px;" : kDimStyle); |
| 390 | |
| 391 | if (connected) { |
| 392 | m_vidPidLabel->setText( |
| 393 | QString("0x%1 : 0x%2") |
| 394 | .arg(m_encoder->vendorId(), 4, 16, QChar('0')) |
| 395 | .arg(m_encoder->productId(), 4, 16, QChar('0'))); |
| 396 | m_pathLabel->setText( |
| 397 | m_encoder->devicePath().isEmpty() ? "–" : m_encoder->devicePath()); |
| 398 | m_serialLabel->setText( |
| 399 | m_encoder->serialNumber().isEmpty() ? "(none)" : m_encoder->serialNumber()); |
| 400 | const uint16_t rel = m_encoder->releaseNumber(); |
| 401 | m_firmwareLabel->setText( |
| 402 | rel ? QString("%1.%2%3") |
| 403 | .arg((rel >> 8) & 0xFF) |
| 404 | .arg((rel >> 4) & 0x0F) |
| 405 | .arg(rel & 0x0F) |
| 406 | : "–"); |
| 407 | } else { |
| 408 | for (QLabel* l : {m_vidPidLabel, m_pathLabel, m_serialLabel, m_firmwareLabel}) |
| 409 | l->setText("–"); |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | // ── Slots ───────────────────────────────────────────────────────────────────── |
| 414 |
nothing calls this directly
no test coverage detected