[shortcuts] Add RF Gain and AGC-T shortcut actions#2710
Conversation
Co-authored-by: Codex <noreply@openai.com>
There was a problem hiding this comment.
Thanks @jensenpat — this looks good to me.
The RF Gain handler mirrors the existing overlay-menu handler at src/gui/MainWindow.cpp:10904 exactly (setPanRfGain → sw->setRfGain → overlayMenu->setRfGain → AppSettings::setValue("DisplayRfGain") → save()), so the antenna/pan restore path at line 2427 picks the value up correctly. Pointer guards on pan, sw, and menu are all in place, and std::max(1, pan->rfGainStep()) is a sensible defense against an unpopulated step.
The AGC-T handlers match the surrounding pattern (activeSlice() guard, clamp to the existing 0–100 model range), and autoRepeat=true on all four matches the tune/CW shortcuts that also want hold-to-step behavior.
One minor observation, not blocking: if the radio hasn't yet reported rf_gain_low/rf_gain_high (both default 0), std::clamp will pin to 0 on every press until the limits arrive. Probably acceptable as a fail-quiet, but if you want to suppress the no-op write you could early-return when rfGainLow() >= rfGainHigh().
Closes #1908 as advertised. Nice job keeping the diff tight and the default key bindings empty.
The original streamdeck-tune-step commit (3233762) was authored on top of a pre-#2710 main and inadvertently removed the 45 lines that PR #2710 added to MainWindow.cpp (stepActivePanRfGain lambda + four registerAction calls for rf_gain_up / rf_gain_down / agct_up / agct_down). Restore MainWindow.cpp to match origin/main so the Stream Deck plugin change can land without silently reverting the RF Gain / AGC-T shortcut feature. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Adds four assignable keyboard shortcut actions for issue #1908:
The actions ship without default key bindings so operators can assign their own shortcuts from Configure Shortcuts.
Details
RF Gain shortcuts step the active panadapter RF gain using the radio-provided range and step size, clamp to the available RF gain limits, update the spectrum overlay immediately, and persist
DisplayRfGainthroughAppSettingsso antenna/pan changes retain the selected value.AGC-T shortcuts operate on the active slice only, stepping AGC threshold by 5 units and clamping through the existing 0-100 AGC threshold behavior.
Closes #1908.
Validation
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfocmake --build build -j22ctest --test-dir build -j22 --output-on-failure(8/8 passed)👨🏼💻 Generated with OpenAI Codex (GPT-5.5 Pro 4/23) and tested by @jensenpat