Skip to content

Refactor: extract wireDaxIqRouting() helper to collapse DAX IQ wiring duplication #2530

Description

@nigelfenton

Follow-up to #2524.

That PR introduced a second copy of ~50 lines of DAX IQ stream-status / connect() wiring in MainWindow() (outside the audio-bridge gate, for Windows / non-PipeWire Linux), mirroring the original block inside MainWindow::startDax() (MainWindow.cpp:13231–13281).

The duplication was the minimum-risk fix for the immediate bug (#2524 was a "fix things, don't refactor" change), but as the reviewer noted, it carries a real drift risk:

Any future change to the IQ-side wiring (an extra connect, a log line, a refactor of streamStatusBelongsToUs, etc.) now has to be applied in both places, and a desync would re-create exactly this class of bug — silent on one platform, working on another.

Proposed change

Extract a private member function on MainWindow:

private:
    // Wire the DAX IQ status-handler / VITA-49 routing / applet enable-disable
    // signals.  Independent of the audio bridge — safe to call on every
    // platform, but typically called once from each branch of the
    // platform-specific DAX startup paths.
    void wireDaxIqRouting();

Called from:

  • The new ctor-time block on !Q_OS_MAC && !HAVE_PIPEWIRE platforms (where the audio bridge isn't available)
  • Inside startDax() on Q_OS_MAC || HAVE_PIPEWIRE platforms (replacing the inline copy)

Both call sites would shrink to one line, the duplication collapses, and any future tweak to the wiring lands in one place.

Out of scope

  • No behaviour change beyond what Fix DAX IQ silently broken on Windows / non-PipeWire Linux #2524 already delivers.
  • The compile-time gating around who calls the helper stays as-is — the helper itself is platform-agnostic, but on Mac/PipeWire it's still called lazily on DAX-audio-toggle (existing startDax() semantics) rather than at construction. Preserving that lazy behaviour on those platforms is intentional.

Risk

Low. Pure code motion — same connect() calls, same lambda bodies, same gating decisions. Easy to verify by running the same three-platform build matrix that #2524 used.

73, Nigel G0JKN & Claude (AI dev partner)

Metadata

Metadata

Assignees

No one assigned

    Labels

    GUIUser interfaceVITA-49VITA-49 UDP streaming: FFT, waterfall, audio, metersaudioAudio engine and streamingenhancementImprovement to existing featuregood first issueGood for newcomersmaintainer-reviewRequires maintainer review before any action is taken

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions