| 394 | } |
| 395 | |
| 396 | void MainWindow::handleFlexControlButton(int button, int action) |
| 397 | { |
| 398 | // Knob press while a wheel function is active returns to frequency mode (#1354). |
| 399 | if (button == 4 && action == 0 && m_flexWheelMode != FlexWheelMode::Frequency) { |
| 400 | m_flexWheelMode = FlexWheelMode::Frequency; |
| 401 | setFlexControlHardwareIndicator(0); |
| 402 | syncFlexControlDialog(); |
| 403 | return; |
| 404 | } |
| 405 | |
| 406 | const QString actionName = flexControlButtonAction(button, action); |
| 407 | FlexWheelMode requestedWheelMode = FlexWheelMode::Frequency; |
| 408 | const bool actionControlsWheel = flexWheelModeForAction(actionName, requestedWheelMode); |
| 409 | if (button >= 1 && button <= 3 && action == 0 && !actionControlsWheel) { |
| 410 | m_flexWheelMode = FlexWheelMode::Frequency; |
| 411 | setFlexControlHardwareIndicator(0); |
| 412 | } |
| 413 | |
| 414 | if (actionName == "StepUp") { |
| 415 | if (auto* rx = m_appletPanel->rxApplet()) rx->cycleStepUp(); |
| 416 | } else if (actionName == "StepDown") { |
| 417 | if (auto* rx = m_appletPanel->rxApplet()) rx->cycleStepDown(); |
| 418 | } else if (actionName == "ToggleMox") { |
| 419 | m_radioModel.setTransmit(!m_radioModel.transmitModel().isTransmitting()); |
| 420 | } else if (actionName == "ToggleTune") { |
| 421 | if (m_radioModel.transmitModel().isTuning()) |
| 422 | m_radioModel.transmitModel().stopTune(); |
| 423 | else |
| 424 | m_radioModel.transmitModel().startTune(); |
| 425 | } else if (actionName == "ToggleMute") { |
| 426 | if (m_audio) m_audio->setMuted(!m_audio->isMuted()); |
| 427 | } else if (actionName == "ToggleLock") { |
| 428 | if (auto* s = activeSlice()) s->setLocked(!s->isLocked()); |
| 429 | } else if (actionName == "ClearRit") { |
| 430 | if (auto* s = activeSlice()) s->setRit(s->ritOn(), 0); |
| 431 | } else if (actionName == "ClearXit") { |
| 432 | if (auto* s = activeSlice()) s->setXit(s->xitOn(), 0); |
| 433 | } else if (actionName == "ToggleApf") { |
| 434 | if (auto* s = activeSlice()) s->setApf(!s->apfOn()); |
| 435 | } else if (actionName == "BandZoom") { |
| 436 | auto* s = activeSlice(); |
| 437 | if (!s) return; |
| 438 | const QString panId = !s->panId().isEmpty() |
| 439 | ? s->panId() |
| 440 | : (m_panStack ? m_panStack->activePanId() : m_radioModel.panId()); |
| 441 | if (panId.isEmpty()) return; |
| 442 | m_flexVirtualBandZoomOn = !m_flexVirtualBandZoomOn; |
| 443 | m_radioModel.sendCommand(QString("display pan set %1 band_zoom=%2") |
| 444 | .arg(panId).arg(m_flexVirtualBandZoomOn ? 1 : 0)); |
| 445 | } else if (actionName == "SegmentZoom") { |
| 446 | auto* s = activeSlice(); |
| 447 | if (!s) return; |
| 448 | const QString panId = !s->panId().isEmpty() |
| 449 | ? s->panId() |
| 450 | : (m_panStack ? m_panStack->activePanId() : m_radioModel.panId()); |
| 451 | if (panId.isEmpty()) return; |
| 452 | m_flexVirtualSegmentZoomOn = !m_flexVirtualSegmentZoomOn; |
| 453 | m_radioModel.sendCommand(QString("display pan set %1 segment_zoom=%2") |
nothing calls this directly
no test coverage detected