[ux] Fix CWX Live toggle and Send action#2122
Conversation
There was a problem hiding this comment.
Thanks for the contribution, @jensenpat — the Live toggle fix and the Send-click behavior are solid improvements that match what operators expect from SmartSDR.
Overall: Looks good. The logic is clean, the test coverage is focused and useful, and the scope is tight. A few observations:
Things I like
- Live toggle via
clicked(bool on)— simple and correct. The old code always forced live-on; passing the toggled state through tosetLive(on)is the right fix. - Send-while-live safety — checking
wasLivebefore callingsendBuffer()avoids double-sending text that was already keyed character-by-character. Good edge case handling. QSignalBlockerinsetModel()andliveChanged— prevents re-entrant toggling when syncing UI state from the model. This is the right pattern.- Test harness — the
cwx_panel_testexercises the key scenarios (toggle off, send-when-not-live, enter-key, no-duplicate-send-while-live, setup-exits-live). Practical and readable.
Minor items (non-blocking)
-
m_sendBtnis no longer checkable — the PR removessetCheckable(true)andsetChecked(true)from the Send button, which is correct since it's now an action button rather than a mode toggle. Just worth noting that any external code checkingm_sendBtn->isChecked()would break, but I don't see any such callers in the codebase. -
sendBuffer()null safety — thesendBuffer()path already guards on!m_model, so the Send-click lambda's call tosendBuffer()when!wasLiveis safe. Good. -
Test doesn't use CTest/QTest — the test uses a custom
report()harness rather than QTest or CTest integration. This is fine for a focused panel test, and it matches the existingcw_sidetone_testpattern in the CMakeLists. If the project moves toward CTest registration in the future, these could be wrapped, but that's not a concern for this PR. -
CMakeLists scope — the new test target links
CwxPanel.cppandCwxModel.cppdirectly rather than linking against a shared library. This matches howcw_sidetone_testandmeter_model_testare already set up, so it's consistent with project conventions.
No blocking issues found. Nice work matching the SmartSDR Windows behavior here.
Community-driven release. WAVE Phase 2 visualization (#2124), DAX-aware TCI multi-stream routing for FlexRadio firmware 4.2.18 (#2140), TCXO frequency-offset calibration (#2119), VFO marker tri-state UX (#2141), v4.2.18 discovery beacon parsing (#2138). Bug fixes from the community: r8b heap corruption (#2114, NF0T), serial PTT triple-fix (#2125, chibondking), slice-audio mute on band change (#2128, jensenpat), CWX Live toggle (#2122, jensenpat), connect-radio dialog polish (#2121, jensenpat). Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Summary
Livebutton a true toggle so operators can turn live keying back off.Sendbutton submit the current input when Live is off, matching the existing Enter key behavior.Sendexit Live without duplicate-sending text that may already have been keyed character-by-character.cwx_panel_testharness covering Live toggling, Send-click submission, Enter submission, and Live exit safety.Root Cause
The CWX bottom bar treated
Send,Live, andSetupas mutually exclusive mode buttons. ClickingLivealways forced the model into live mode, so a second click could not turn it off. TheSendbutton only selected send mode instead of sending the current buffer, while Enter already sent the buffer from the input event path.Testing
cmake --build build -- -j10./build/cwx_panel_test👨🏼💻 Generated with OpenAI Codex (GPT-5.5 Pro 4/23) and tested by @jensenpat