| 3026 | // ── S-Meter bar (custom paint) ──────────────────────────────────────────────── |
| 3027 | |
| 3028 | void VfoWidget::paintEvent(QPaintEvent* event) |
| 3029 | { |
| 3030 | Q_UNUSED(event); |
| 3031 | |
| 3032 | QPainter p(this); |
| 3033 | p.setRenderHint(QPainter::Antialiasing, true); |
| 3034 | |
| 3035 | // Opaque dark background so passband shading doesn't bleed through |
| 3036 | p.setPen(Qt::NoPen); |
| 3037 | p.setBrush(QColor(0x0a, 0x0a, 0x14)); |
| 3038 | p.drawRoundedRect(rect().adjusted(0, 0, -1, -1), 3, 3); |
| 3039 | |
| 3040 | // Subtle white overlay for depth |
| 3041 | p.setPen(QColor(255, 255, 255, 13)); |
| 3042 | p.setBrush(QColor(255, 255, 255, 13)); |
| 3043 | p.drawRoundedRect(rect().adjusted(0, 0, -1, -1), 3, 3); |
| 3044 | |
| 3045 | if (m_collapsed) { |
| 3046 | // ── Collapsed mode: draw slice badge and TX badge via painter ────── |
| 3047 | const int badgeSize = 20; |
| 3048 | const int margin = (width() - badgeSize) / 2; |
| 3049 | int yPos = 4; |
| 3050 | |
| 3051 | // Slice letter badge |
| 3052 | int sliceId = m_slice ? m_slice->sliceId() : 0; |
| 3053 | QRect badgeRect(margin, yPos, badgeSize, badgeSize); |
| 3054 | const QString rl = m_slice ? m_slice->letter() : QString(); |
| 3055 | const int colourIdx = SliceLabel::displayColorIndex(sliceId, rl); |
| 3056 | p.setBrush(SliceColorManager::instance().activeColor(colourIdx)); |
| 3057 | p.setPen(Qt::NoPen); |
| 3058 | p.drawRoundedRect(badgeRect, 3, 3); |
| 3059 | |
| 3060 | QFont badgeFont = p.font(); |
| 3061 | badgeFont.setPixelSize(11); |
| 3062 | badgeFont.setBold(true); |
| 3063 | p.setFont(badgeFont); |
| 3064 | p.setPen(QColor(0, 0, 0)); |
| 3065 | // Display follows the SliceLetterDisplay AppSettings option |
| 3066 | // (#2606): "Global" → plain global letter; "RadioIndexed" → the |
| 3067 | // per-client letter with a global-slice-id subscript. |
| 3068 | const QString radioLetter = m_slice ? m_slice->letter() : QString(); |
| 3069 | SliceLabel::drawSliceBadge(p, badgeRect, sliceId, radioLetter); |
| 3070 | |
| 3071 | yPos += badgeSize + 2; |
| 3072 | |
| 3073 | // TX badge |
| 3074 | bool isTx = m_slice && m_slice->isTxSlice(); |
| 3075 | QRect txRect(margin, yPos, badgeSize, 16); |
| 3076 | p.setPen(Qt::NoPen); |
| 3077 | p.setBrush(isTx ? QColor(0xcc, 0x00, 0x00) : QColor(0x40, 0x40, 0x40)); |
| 3078 | p.drawRoundedRect(txRect, 2, 2); |
| 3079 | |
| 3080 | QFont txFont = p.font(); |
| 3081 | txFont.setPixelSize(10); |
| 3082 | txFont.setBold(true); |
| 3083 | p.setFont(txFont); |
| 3084 | p.setPen(isTx ? QColor(0xff, 0xff, 0xff) : QColor(0x80, 0x80, 0x80)); |
| 3085 | p.drawText(txRect, Qt::AlignCenter, "TX"); |
nothing calls this directly
no test coverage detected