MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / handleFlexControlButton

Method handleFlexControlButton

src/gui/MainWindow_Controllers.cpp:396–524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394}
395
396void 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")

Callers

nothing calls this directly

Calls 15

flexControlButtonActionFunction · 0.85
flexWheelModeForActionFunction · 0.85
rxAppletMethod · 0.80
cycleStepUpMethod · 0.80
cycleStepDownMethod · 0.80
setTransmitMethod · 0.80
isTransmittingMethod · 0.80
stopTuneMethod · 0.80
startTuneMethod · 0.80
setMutedMethod · 0.80
isMutedMethod · 0.80
setRitMethod · 0.80

Tested by

no test coverage detected