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

Method dispatchHidAction

src/gui/MainWindow_Controllers.cpp:890–1119  ·  view source on GitHub ↗

Dispatch a resolved HID action name and optionally log it to the mapping dialog if it is open. Called for both F1/F2 hold (from the timer) and short-press (on release). (#3323)

Source from the content-addressed store, hash-verified

888// dialog if it is open. Called for both F1/F2 hold (from the timer) and
889// short-press (on release). (#3323)
890void MainWindow::dispatchHidAction(const QString& actionName,
891 const QString& gestureLabel)
892{
893 if (m_rc28MappingDialog && m_hidEncoder->isRC28Compatible())
894 m_rc28MappingDialog->appendButtonEvent(gestureLabel, actionName);
895
896 if (actionName == "StepCycle" || actionName == "StepUp") {
897 if (auto* rx = m_appletPanel->rxApplet()) rx->cycleStepUp();
898 if (auto* s = activeSlice()) {
899 if (auto* sw = spectrumForSlice(s))
900 triggerTMate2Overlay(TMate2Overlay::Speed, sw->stepSize());
901 }
902 } else if (actionName == "StepDown") {
903 if (auto* rx = m_appletPanel->rxApplet()) rx->cycleStepDown();
904 if (auto* s = activeSlice()) {
905 if (auto* sw = spectrumForSlice(s))
906 triggerTMate2Overlay(TMate2Overlay::Speed, sw->stepSize());
907 }
908 } else if (actionName == "ToggleRit") {
909 if (auto* s = activeSlice()) {
910 s->setRit(!s->ritOn(), s->ritFreq());
911 triggerTMate2Overlay(TMate2Overlay::Rit, s->ritOn() ? s->ritFreq() : 0);
912 }
913 } else if (actionName == "ToggleXit") {
914 if (auto* s = activeSlice()) s->setXit(!s->xitOn(), s->xitFreq());
915 } else if (actionName == "ClearRit") {
916 if (auto* s = activeSlice()) {
917 s->setRit(s->ritOn(), 0);
918 triggerTMate2Overlay(TMate2Overlay::Rit, 0);
919 }
920 } else if (actionName == "ClearXit") {
921 if (auto* s = activeSlice()) s->setXit(s->xitOn(), 0);
922 } else if (actionName == "ToggleMox") {
923 const bool next = !m_radioModel.transmitModel().isTransmitting();
924 m_radioModel.setTransmit(next);
925 } else if (actionName == "ToggleTune") {
926 const bool next = !m_radioModel.transmitModel().isTuning();
927 if (!next)
928 m_radioModel.transmitModel().stopTune();
929 else
930 m_radioModel.transmitModel().startTune();
931#ifdef HAVE_HIDAPI
932 triggerTMate2TextOverlay(next ? QStringLiteral("TUNE ON")
933 : QStringLiteral("TUNE OFF"));
934#endif
935 } else if (actionName == "ToggleMute") {
936 if (m_audio) {
937 const bool next = !m_audio->isMuted();
938 m_audio->setMuted(next);
939#ifdef HAVE_HIDAPI
940 triggerTMate2TextOverlay(next ? QStringLiteral("MUTE ON")
941 : QStringLiteral("MUTE OFF"));
942#endif
943 }
944 } else if (actionName == "ToggleLock") {
945 if (auto* s = activeSlice()) {
946 const bool next = !s->isLocked();
947 s->setLocked(next);

Callers

nothing calls this directly

Calls 15

sizeFunction · 0.85
isRC28CompatibleMethod · 0.80
appendButtonEventMethod · 0.80
rxAppletMethod · 0.80
cycleStepUpMethod · 0.80
stepSizeMethod · 0.80
cycleStepDownMethod · 0.80
setRitMethod · 0.80
ritOnMethod · 0.80
ritFreqMethod · 0.80
setXitMethod · 0.80
xitOnMethod · 0.80

Tested by

no test coverage detected