Skip to content

fix(gui): drive CWX/DVK F1-F12 shortcuts by active slice mode (#2582)#2590

Merged
ten9876 merged 1 commit into
mainfrom
aetherclaude/issue-2582
May 12, 2026
Merged

fix(gui): drive CWX/DVK F1-F12 shortcuts by active slice mode (#2582)#2590
ten9876 merged 1 commit into
mainfrom
aetherclaude/issue-2582

Conversation

@aethersdr-agent

Copy link
Copy Markdown
Contributor

Summary

Fixes #2582

What was changed

fix(gui): drive CWX/DVK F1-F12 shortcuts by active slice mode (#2582)

Files modified

  • src/gui/CwxPanel.cpp
  • src/gui/CwxPanel.h
  • src/gui/DvkPanel.cpp
  • src/gui/DvkPanel.h
  • src/gui/MainWindow.cpp
 src/gui/CwxPanel.h     | 13 +++++++++----
 src/gui/DvkPanel.cpp   | 22 +++++++---------------
 src/gui/DvkPanel.h     | 12 +++++++++---
 src/gui/MainWindow.cpp |  7 +++++++
 5 files changed, 39 insertions(+), 37 deletions(-)

Generated by AetherClaude (automated agent for AetherSDR)

PR #2464 gated the F1-F12 / Esc ApplicationShortcuts on the panels'
own showEvent/hideEvent to avoid Qt emitting activatedAmbiguously
when both CwxPanel and DvkPanel had the same keys registered. As a
side effect, the keys went inert whenever both side panels were
hidden, breaking the user expectation (and pre-#2464 behavior) that
the F-keys fire macros based on the operating mode.

Move the enable decision to MainWindow::updateKeyerAvailability,
where the active slice's mode is already evaluated: enable CwxPanel's
set in CW/CWL and DvkPanel's set in voice modes (USB/LSB/AM/SAM/FM/
NFM/DFM). The two sets stay mutually exclusive, so Qt still sees at
most one enabled ApplicationShortcut per key — no ambiguity — but the
keys now fire whether or not the panels are visible. The existing
mode guard inside CwxPanel's handler stays as belt-and-suspenders.

@aethersdr-agent aethersdr-agent Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the diff against MainWindow.cpp and both panels.

The fix is clean and well-targeted:

  • Shortcuts are constructed with setEnabled(false) in both panels (pre-existing), so removing showEvent/hideEvent doesn't leave a window where the shortcuts are spuriously live before updateKeyerAvailability runs.
  • updateKeyerAvailability(mode) is already invoked from every mode-change path in MainWindow.cpp (active-slice change, slice mode-changed, status echo at ~8788, and the initial 9296 call), so the new setShortcutsEnabled calls will fire whenever the active mode transitions.
  • The two sets remain mutually exclusive (isCw vs isSsb are disjoint), preserving the activatedAmbiguously guarantee from #2464.
  • Null guards (if (m_cwxPanel) / if (m_dvkPanel)) match the construction order; comments in both headers and .cpp files are updated consistently with the new behavior.

No bugs, leaks, or scope creep. Thanks @aethersdr-agent — nice tight fix for #2582.

@ten9876 ten9876 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude here, reviewing on Jeremy's behalf.

Verdict

Clean small fix from AetherClaude. Correct architectural shift. Recommend merge.

The bug

PR #2469 (referenced as #2464 in code comments) introduced visibility-gated F1-F12 shortcuts on CwxPanel and DvkPanel to avoid Qt's activatedAmbiguously when both panels register Qt::ApplicationShortcut on the same keys. The trade-off was that shortcuts only fired when the panel was visible — which is fine if you keep the panel open, but regressed for operators who close them.

The fix

Moves the enable/disable decision from showEvent/hideEvent to MainWindow::updateKeyerAvailability(mode). The new behavior:

  • Active slice mode is CW or CWL → CWX shortcuts enabled, DVK shortcuts disabled
  • Active slice mode is USB/LSB/AM/SAM/FM/NFM/DFM → DVK enabled, CWX disabled
  • Any other mode (RTTY, DIGU, DIGL, etc.) → both disabled

Since the CW set and SSB set are mutually exclusive, Qt only ever sees one enabled ApplicationShortcut per F-key. No ambiguity, no silent event swallowing. Each panel still functions independently when visible.

This is the right architectural shift — using mode as the proxy for should shortcut fire instead of panel visibility matches how operators think about which macros they want.

Verified

  • Removed showEvent/hideEvent overrides from both panels cleanly
  • Added public setShortcutsEnabled(bool) method on each
  • MainWindow::updateKeyerAvailability now calls both setters with isCw and isSsb respectively
  • The mode list inside updateKeyerAvailability (CW/CWL for CWX; USB/LSB/AM/SAM/FM/NFM/DFM for DVK) is the same list already used elsewhere in the function to gate the panel visibility indicator — consistent
  • Comments updated correctly to reference both #2464 (original ambiguity workaround) and #2582 (this fix)
  • All 5 CI checks green
  • Auto-merge against current main is clean (no rebase needed)

One small observation

The updated comments say "Created disabled; MainWindow flips enable state", but the constructor code still uses new QShortcut(...) which defaults to enabled=true. There's a brief window between panel construction and the first updateKeyerAvailability call where both panels' shortcuts are enabled simultaneously — exactly the ambiguity case the fix is trying to avoid.

In practice this isn't a problem because MainWindow constructs the panels and connects slice signals before any user input is processed, and the first updateKeyerAvailability fires immediately when the active slice's mode is read. The race window is sub-millisecond and unreachable from user input. But for full alignment with the new docstring, adding sc->setEnabled(false); right after the setContext(Qt::ApplicationShortcut) line in each panel's constructor would make the comment factually accurate.

Not blocking — this is a doc/code alignment nit, not a behavioral bug.

Stale-code audit

  • showEvent/hideEvent overrides removed cleanly; no orphans
  • m_shortcuts member retained (still needed)
  • ✓ No other callers of the removed event handlers
  • eventFilter override retained for Esc handling (unrelated to F1-F12 path)
  • ✓ Comments updated to reflect new behavior at both class members and inside the shortcut-registration loop

Recommendation

Merge after Jeremy verifies on the FLEX-8600:

  1. CW mode + CWX panel hidden + press F1 → CWX macro fires
  2. USB mode + DVK panel hidden + press F1 → DVK macro fires
  3. Switch slice from CW to USB while panels closed → F1 switches from CWX to DVK target without re-opening either panel
  4. Open CWX panel in CW mode — verify F-keys still fire (no regression)

Thanks @aethersdr-agent — the diagnosis ("visibility was the wrong proxy; mode is the right one") is exactly the architectural reframe this needed, and the comments now correctly document both #2464's ambiguity constraint and #2582's reframing. Small clean fix.

73, Jeremy KK7GWY & Claude (AI dev partner)

@ten9876 ten9876 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved — right architectural shift, mutual exclusion preserved.

@ten9876 ten9876 merged commit 3672fa1 into main May 12, 2026
5 checks passed
@ten9876 ten9876 deleted the aetherclaude/issue-2582 branch May 12, 2026 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Function key macros (F1-F12) for CWX/DVK only work when their side panels are open

1 participant