Skip to content

fix(gui): tighten GuardedSlider member types, extract EQ formatter + linger constant (#2987)#3012

Merged
ten9876 merged 1 commit into
mainfrom
auto/issue-2987-dragvaluepopup-polish
May 23, 2026
Merged

fix(gui): tighten GuardedSlider member types, extract EQ formatter + linger constant (#2987)#3012
ten9876 merged 1 commit into
mainfrom
auto/issue-2987-dragvaluepopup-polish

Conversation

@ten9876

@ten9876 ten9876 commented May 23, 2026

Copy link
Copy Markdown
Collaborator

Closes #2987. Three polish items from the PR #2944 (DragValuePopup) review.

1. Tighten slider member types

TxApplet and PhoneApplet declared their sliders as QSlider* for historical reasons but constructed them as GuardedSlider, forcing static_cast<GuardedSlider*>(...)->setDragValueFormatter(...) at every call site. Member type is now GuardedSlider* so the formatter calls resolve directly:

  • TxApplet.{h,cpp}: m_rfPowerSlider, m_tunePowerSlider
  • PhoneApplet.{h,cpp}: m_amCarrierSlider, m_voxLevelSlider, m_dexpSlider

Forward declarations in the headers go in the global namespace where GuardedSlider actually lives, not under namespace AetherSDR. (First attempt had them inside the namespace, which silently created an ODR-incompatible second type — caught by the compiler.)

2. Extract dbWithSignText helper in EqApplet.cpp

The EQ band sliders' drag-popup formatter was an inline lambda; other applets use file-scope free functions for the same pattern. Lifted to a named helper for consistency:

static QString dbWithSignText(int v)
{
    return QStringLiteral("%1%2 dB")
        .arg(v > 0 ? QStringLiteral("+") : QString())
        .arg(v);
}

3. Name the DragValuePopup linger duration

The 450 ms "memory cue" was baked into the default-argument literal in DragValuePopup.h. Promoted to kDefaultLingerMs constexpr with a comment recording the testing rationale so the value is findable without spelunking PR #2944's body.

Test plan

  • Builds clean
  • Verify drag-popup readouts still appear correctly on RF Power, Tune Pwr, AM Carrier, VOX Level, DEXP, EQ bands (no behavior change expected — pure type/constant refactor)

🤖 Generated with Claude Code

…linger constant (#2987)

Three polish items from the PR #2944 (DragValuePopup) review.

1. Tighten slider member types where construction is GuardedSlider.

   TxApplet and PhoneApplet declared m_rfPowerSlider / m_tunePowerSlider
   / m_amCarrierSlider / m_voxLevelSlider / m_dexpSlider as QSlider*
   despite constructing them as GuardedSlider, forcing awkward
   static_cast<GuardedSlider*>(...)->setDragValueFormatter(...) calls
   at the use site.  Member type is now GuardedSlider* so the
   formatter calls and any other GuardedSlider-specific API resolves
   directly.  Forward declarations in the headers go in the global
   namespace where GuardedSlider actually lives, not under
   namespace AetherSDR (this was the build error during the first
   attempt — silent ODR-incompatible duplicate type).

2. Extract dbWithSignText helper in EqApplet.cpp.

   The EQ band sliders' drag-popup formatter was an inline lambda;
   other applets use file-scope free functions (wattsText,
   percentText, panText) for the same pattern.  Pull the lambda out
   to match.

3. Name the DragValuePopup linger duration.

   The 450 ms 'memory cue' that lingers after slider release was
   baked into the default-argument literal in DragValuePopup.h.
   Promote to kDefaultLingerMs constexpr with a comment recording
   the testing rationale (250 ms too fleeting, 750 ms felt sluggish)
   so the value is findable without spelunking PR #2944's body.

Closes #2987.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ten9876 ten9876 requested a review from jensenpat as a code owner May 23, 2026 18:36
@ten9876 ten9876 enabled auto-merge (squash) May 23, 2026 18:36

@aethersdr-agent aethersdr-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice, focused polish PR — the three items are independent, low-risk, and each one improves the code. Thanks @ten9876!

A few observations:

Correctness

  • Forward-decl placement looks right: GuardedSlider lives in the global namespace (src/gui/GuardedSlider.h:32), so the class GuardedSlider; lines in both headers correctly sit outside namespace AetherSDR. Good catch on the first-attempt ODR trap noted in the PR description.
  • dbWithSignText is byte-identical to the lambda it replaces and matches the wattsText / percentText / panText shape in sibling files.

Worth a follow-up (not blockers)

  1. RxApplet has the exact same pattern this PR is cleaning up — m_afSlider and m_panSlider are declared QSlider* in RxApplet.h:241-242 but constructed as GuardedSlider and then static-cast for setDragValueFormatter (RxApplet.cpp:773, :796). Easy to roll into a follow-up for consistency, or extend this PR if you want a clean sweep.
  2. m_voxDelaySlider in PhoneApplet is also constructed as GuardedSlider (PhoneApplet.cpp:198) but stays typed as QSlider*. No immediate effect since it has no formatter, but if we're standardizing the member type, this one is conceptually in the same bucket.
  3. Minor: after this change TxApplet.h no longer references QSlider directly, so the class QSlider; forward decl is now unused. Harmless; skip if you prefer not to expand the diff.

LGTM aside from the suggested follow-up on RxApplet. The test-plan checkbox for manual drag-popup verification is still unchecked — worth ticking that off (or flagging a tester) before merge since the formatter/type plumbing is what's being moved around.


🤖 aethersdr-agent · cost: $4.3300 · model: claude-opus-4-7

@ten9876 ten9876 merged commit 937ed40 into main May 23, 2026
5 checks passed
@ten9876 ten9876 deleted the auto/issue-2987-dragvaluepopup-polish branch May 23, 2026 19:12
G6PWY-Chris pushed a commit to G6PWY-Chris/AetherSDR that referenced this pull request Jun 22, 2026
…linger constant (aethersdr#2987) (aethersdr#3012)

Closes aethersdr#2987. Three polish items from the PR aethersdr#2944 (DragValuePopup)
review.

## 1. Tighten slider member types

`TxApplet` and `PhoneApplet` declared their sliders as `QSlider*` for
historical reasons but constructed them as `GuardedSlider`, forcing
`static_cast<GuardedSlider*>(...)->setDragValueFormatter(...)` at every
call site. Member type is now `GuardedSlider*` so the formatter calls
resolve directly:

- `TxApplet.{h,cpp}`: `m_rfPowerSlider`, `m_tunePowerSlider`
- `PhoneApplet.{h,cpp}`: `m_amCarrierSlider`, `m_voxLevelSlider`,
`m_dexpSlider`

Forward declarations in the headers go in the global namespace where
`GuardedSlider` actually lives, not under `namespace AetherSDR`. (First
attempt had them inside the namespace, which silently created an
ODR-incompatible second type — caught by the compiler.)

## 2. Extract `dbWithSignText` helper in EqApplet.cpp

The EQ band sliders' drag-popup formatter was an inline lambda; other
applets use file-scope free functions for the same pattern. Lifted to a
named helper for consistency:

```cpp
static QString dbWithSignText(int v)
{
    return QStringLiteral("%1%2 dB")
        .arg(v > 0 ? QStringLiteral("+") : QString())
        .arg(v);
}
```

## 3. Name the DragValuePopup linger duration

The 450 ms "memory cue" was baked into the default-argument literal in
`DragValuePopup.h`. Promoted to `kDefaultLingerMs` constexpr with a
comment recording the testing rationale so the value is findable without
spelunking PR aethersdr#2944's body.

## Test plan

- [x] Builds clean
- [ ] Verify drag-popup readouts still appear correctly on RF Power,
Tune Pwr, AM Carrier, VOX Level, DEXP, EQ bands (no behavior change
expected — pure type/constant refactor)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

DragValuePopup polish: tighten slider member types + extract constants

1 participant