| 415 | } |
| 416 | |
| 417 | void TxApplet::setTransmitModel(TransmitModel* model) |
| 418 | { |
| 419 | if (m_model == model) return; |
| 420 | m_model = model; |
| 421 | if (!m_model) return; |
| 422 | |
| 423 | // Transmit state changes → update sliders, tune button |
| 424 | connect(m_model, &TransmitModel::stateChanged, this, &TxApplet::syncFromModel); |
| 425 | |
| 426 | // Tune state → red button |
| 427 | connect(m_model, &TransmitModel::tuneChanged, this, [this](bool tuning) { |
| 428 | if (tuning) { |
| 429 | AetherSDR::ThemeManager::instance().applyStyleSheet(m_tuneBtn, "QPushButton { background: #cc2222; border: 1px solid {{color.accent.danger}}; " |
| 430 | "border-radius: 3px; color: {{color.text.primary}}; font-size: 10px; font-weight: bold; " |
| 431 | "padding: 2px; }"); |
| 432 | m_tuneBtn->setText("TUNING..."); |
| 433 | } else { |
| 434 | AetherSDR::ThemeManager::instance().applyStyleSheet(m_tuneBtn, "QPushButton { background: {{color.background.2}}; border: 1px solid {{color.background.2}}; " |
| 435 | "border-radius: 3px; color: {{color.text.primary}}; font-size: 10px; font-weight: bold; " |
| 436 | "padding: 2px; }" |
| 437 | "QPushButton:hover { background: {{color.background.1}}; }"); |
| 438 | m_tuneBtn->setText("TUNE"); |
| 439 | } |
| 440 | }); |
| 441 | |
| 442 | // MOX / transmit state → red button |
| 443 | connect(m_model, &TransmitModel::moxChanged, this, [this](bool tx) { |
| 444 | m_updatingFromModel = true; |
| 445 | m_moxBtn->setChecked(tx); |
| 446 | // Both branches go through applyStyleSheet so the tracked template |
| 447 | // matches the current visual state — otherwise a Theme Editor change |
| 448 | // mid-transmit would re-resolve the stale idle template over the red. |
| 449 | // Active red stays literal (byte-identical to the prior appearance). |
| 450 | if (tx) { |
| 451 | AetherSDR::ThemeManager::instance().applyStyleSheet(m_moxBtn, |
| 452 | "QPushButton { background: #cc2222; border: 1px solid #ff4444; " |
| 453 | "border-radius: 3px; color: #ffffff; font-size: 10px; font-weight: bold; " |
| 454 | "padding: 2px; }"); |
| 455 | } else { |
| 456 | AetherSDR::ThemeManager::instance().applyStyleSheet(m_moxBtn, kMoxIdleStyle); |
| 457 | } |
| 458 | m_updatingFromModel = false; |
| 459 | }); |
| 460 | |
| 461 | // ATU state changes → indicators |
| 462 | connect(m_model, &TransmitModel::atuStateChanged, this, &TxApplet::syncAtuIndicators); |
| 463 | |
| 464 | // APD button + indicators |
| 465 | connect(m_apdBtn, &QPushButton::toggled, this, [this](bool on) { |
| 466 | if (!m_updatingFromModel && m_model) |
| 467 | m_model->setApdEnabled(on); |
| 468 | }); |
| 469 | connect(m_model, &TransmitModel::apdStateChanged, this, [this] { |
| 470 | m_updatingFromModel = true; |
| 471 | m_apdBtn->setChecked(m_model->apdEnabled()); |
| 472 | m_updatingFromModel = false; |
| 473 | syncAtuIndicators(); // also refreshes APD indicators |
| 474 | }); |
no test coverage detected