Skip to content

Split DIGI applet into separate CAT / DAX / TCI / IQ applets #1627

@ten9876

Description

@ten9876

Goal

Split the single CatApplet (shown as [DIGI] button in the applet panel) into four independent applets — [CAT], [DAX], [TCI], [IQ] — each with the standard applet affordances:

  • Drag-handle title bar matching other applets
  • Pop-out / re-dock via FloatingAppletWindow
  • Reorder via drag in the applet stack
  • Toggle button in the top button bar (row 2)

Current architecture

src/gui/CatApplet.cpp (674 lines) contains four stacked sections:

  • CAT Control (lines 78–196) — rigctld TCP port/status/enable + PTY device list + Flex Serial
  • TCI Server (lines 197–361) — port, client count, enable toggle
  • DAX — per-channel RX level meters/sliders, TX meter/slider, enable
  • DAX IQ (lines 362–430) — IQ channel dropdown + enable

Registered at AppletPanel.cpp:650-651 as the sole "DIGI" entry in btnRow2. Registration framework (makeEntry) already supports title bar + wrapper + button + persistence.

Target file layout

New files:

  • src/gui/CatControlApplet.{h,cpp} — CAT Control section (rigctld + PTY + Flex Serial)
  • src/gui/DaxApplet.{h,cpp} — DAX section (RX meters, TX meter, enable)
  • src/gui/TciApplet.{h,cpp} — TCI section (redesigned to mirror DAX framework)
  • src/gui/DaxIqApplet.{h,cpp} — DAX IQ section

Delete src/gui/CatApplet.{h,cpp} after migration.

TCI applet redesign (mirrors DAX framework)

Current TCI section is just port + clients + enable. Target design matches the DAX applet's visual pattern:

TCI Server
RX1: [meter──slider]
RX2: [meter──slider]
RX3: [meter──slider]
RX4: [meter──slider]
TX:  [meter──slider]
Port: [50001]  Clients: N   [Enable]

Each meter uses MeterSlider (same widget DAX uses). The slider positions per-channel gain (new concept — TCI doesn't currently gate per-channel). Four TCI RX channels map to DAX channels 1-4 routed to TCI clients. TX meter reflects WSJT-X's TCI TX audio level.

New backing needed:

  • TciServer gains per-channel gain slots (QHash<int, float> m_rxChannelGain) applied in onDaxAudioReady before resampling.
  • TX gain already exists (m_txGain from DaxTxGain setting) — rename setting to TciTxGain for clarity, migrate from old key. (Separate from DAX bridge's own gain so toggling DAX doesn't surprise TCI users.)
  • Per-channel RMS/peak already available in the DAX ready signal; just route to the per-channel meter.

Step-by-step

Phase 1 — Scaffolding (zero behavior change)

  1. Create CatControlApplet.{h,cpp} by copying the CAT Control section's buildUI + wiring from CatApplet lines 78-196. Public API:
    • void setRigctlServers(RigctlServer**, int count)
    • void setRigctlPtys(RigctlPty**, int count)
    • signal void tcpEnabledChanged(bool) / ptyEnabledChanged(bool)
  2. Create DaxApplet.{h,cpp} copying DAX section. Public API:
    • void setDaxRxLevel(int channel, float rms) / setDaxTxLevel(float rms)
    • signal void daxTxGainChanged(float) / daxEnabledChanged(bool)
  3. Create TciApplet.{h,cpp} — new design. Public API:
    • void setTciServer(TciServer*)
    • void setTciEnabled(bool) / updateTciStatus()
    • void setTciRxLevel(int channel, float rms) (NEW)
    • void setTciTxLevel(float rms) (NEW)
    • signal void tciEnabledChanged(bool) / tciRxGainChanged(int ch, float) / tciTxGainChanged(float)
  4. Create DaxIqApplet.{h,cpp} copying DAX IQ section. Public API:
    • void syncDaxIqChannel(int channel) / setDaxIqEnabled(bool) / setDaxIqLevel(int channel, float rms)

Phase 2 — Registration

  1. In AppletPanel.cpp:650-651, replace the single DIGI entry with four:

    m_catControlApplet = new CatControlApplet;
    m_appletOrder.append(makeEntry("CAT", "CAT Control", m_catControlApplet, false, btnRow2, btnLayout2));
    
    m_daxApplet = new DaxApplet;
    m_appletOrder.append(makeEntry("DAX", "DAX Audio", m_daxApplet, false, btnRow2, btnLayout2));
    
    m_tciApplet = new TciApplet;
    m_appletOrder.append(makeEntry("TCI", "TCI Server", m_tciApplet, false, btnRow2, btnLayout2));
    
    m_daxIqApplet = new DaxIqApplet;
    m_appletOrder.append(makeEntry("IQ", "DAX IQ", m_daxIqApplet, false, btnRow2, btnLayout2));
  2. Update kDefaultOrder: replace "DIGI" with "CAT", "DAX", "TCI", "IQ" in the right slot.

  3. Remove CatApplet forward decl + member from AppletPanel.{h,cpp}. Add four new forward decls + members + accessors (catControlApplet(), daxApplet(), tciApplet(), daxIqApplet()).

Phase 3 — MainWindow wiring

  1. Every place MainWindow calls m_appletPanel->catApplet()->setXxx() needs splitting. Grep shows ~8 call sites — replace each with the matching applet accessor.
  2. Audit signals: daxEnabledChanged, tciEnabledChanged, daxTxGainChanged, etc. — rewire from the correct new applet.

Phase 4 — Per-channel TCI gain (new feature backing)

  1. TciServer::setRxChannelGain(int channel, float gain) — stores in m_rxChannelGain.
  2. In onDaxAudioReady, multiply the incoming DAX audio by the gain for that channel before accumulation.
  3. Emit per-channel RMS level via a new signal tciRxLevel(int channel, float rms) → TCI applet's meter.
  4. Rename DaxTxGainTciTxGain in TciServer (was reused from DAX setting by [tci] Fix TCI TX timing for WSJT-X #1624). Keep DAX's setting for the DAX bridge. Migrate stored value on first load to avoid user surprise.

Phase 5 — Settings migration

  1. Old Applet_DIGI visibility key → migrate to Applet_CAT (and leave the others at default off). On first run after upgrade, if user had DIGI visible, enable all four; if they had it hidden, all four stay hidden.
  2. Old DaxTxGain continues to drive the DAX bridge (unchanged). New TciTxGain defaults to same value on first load.

Phase 6 — Cleanup

  1. Delete CatApplet.{h,cpp}.
  2. Update CMakeLists.txt — remove CatApplet, add the four new sources.
  3. Update includes across the codebase.

Risk areas

  • Existing single DAX/TCI control coupling — the enable toggle for CAT currently controls both rigctld (TCP) and PTY. Splitting requires that the new CatControlApplet retains that dual-responsibility.
  • Layout height — four separate applets with their own title bars will consume more vertical space than the combined DIGI applet. Recommend default all four hidden (user opts in from the button bar) matching the current DIGI default.
  • DaxTxGain rename — any user depending on the shared setting between DAX bridge and TCI will see a one-time behavior change. Migration code preserves the value but splits it into two independent settings going forward.
  • Signal wiring churn — every connection in MainWindow that used m_appletPanel->catApplet() needs a source update. Mechanical but easy to miss one.
  • Button bar row 2 crowding — btnRow2 currently has ~5 buttons (LCK, DIGI, MTR, AG, plus…). Adding 3 more may overflow. Verify visual layout.

Effort estimate

  • Phase 1 scaffolding: 45 min
  • Phase 2 registration: 15 min
  • Phase 3 wiring: 30 min
  • Phase 4 TCI per-channel gain: 45 min
  • Phase 5 migration: 15 min
  • Phase 6 cleanup: 15 min
  • Total: ~2.5 hrs plus a test pass on CAT connections, DAX audio, TCI multi-channel, DAX IQ each independently.

Commit strategy

One commit per phase for clean history and easy bisect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting-responseWaiting for reporter to provide additional informationenhancementImprovement to existing feature

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions