Skip to content

Add TNF status tooltip#2789

Merged
ten9876 merged 1 commit into
aethersdr:mainfrom
rfoust:codex/tnf-status-tooltip
May 17, 2026
Merged

Add TNF status tooltip#2789
ten9876 merged 1 commit into
aethersdr:mainfrom
rfoust:codex/tnf-status-tooltip

Conversation

@rfoust

@rfoust rfoust commented May 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a hover tooltip to the TNF indicator in the bottom status bar. The tooltip lists the current tracking notch filters with their band, frequency, width, depth, and whether each filter is persistent or temporary. If the radio has no TNF filters, the tooltip shows a simple empty-state message.

Implementation

  • Added small MainWindow helpers to format TNF frequency/depth values and build a rich Qt tooltip from TnfModel.
  • Handles QEvent::ToolTip on the existing TNF status-bar QLabel so hover always reflects the current model state.
  • Refreshes the cached tooltip when TNFs are changed or removed, and after disconnect/reset paths.
  • Kept this scoped to the status-bar UI; no TNF protocol or model behavior changed.

Validation

  • cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
  • cmake --build build --parallel

I did not launch the app after compiling, per request.

Maintainer Notes

This touches src/gui/MainWindow.cpp because the TNF status-bar label and event filter live there. The PR intentionally avoids broader UI restructuring or TNF model changes.

Copilot AI review requested due to automatic review settings May 17, 2026 04:04
@rfoust rfoust requested a review from ten9876 as a code owner May 17, 2026 04:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a TNF status-bar tooltip that shows the current tracking notch filters from TnfModel, including empty-state handling and refreshed tooltip contents when TNFs change.

Changes:

  • Added TNF frequency/depth formatting helpers and rich HTML tooltip construction.
  • Handles TNF indicator tooltip events with current model state.
  • Refreshes TNF tooltip text on TNF changes/removals and disconnect reset.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/gui/MainWindow.cpp
Comment on lines +594 to +598
std::sort(filters.begin(), filters.end(), [](const TnfEntry& lhs, const TnfEntry& rhs) {
if (std::abs(lhs.freqMhz - rhs.freqMhz) > 0.000001) {
return lhs.freqMhz < rhs.freqMhz;
}
return lhs.id < rhs.id;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed in the amended commit. The tooltip sorting now compares a rounded-Hz key first and uses the TNF id only as the tie-breaker, so the comparator is a strict weak ordering while preserving stable frequency ordering.

@rfoust rfoust force-pushed the codex/tnf-status-tooltip branch from 14b7670 to 4d4396d Compare May 17, 2026 04:39
@rfoust rfoust force-pushed the codex/tnf-status-tooltip branch from 4d4396d to 27d6b85 Compare May 17, 2026 04:43

@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 scoped enhancement — thanks @rfoust. Implementation cleanly mirrors the existing buildNetworkTooltip pattern at src/gui/MainWindow.cpp:5824, including the live-refresh on the help event and the cached fallback on tnfChanged/tnfRemoved/disconnect. No protocol or model-side surprises.

I checked the comparator after the amend — tnfFrequencyHz rounds to an integral Hz key and the lambda falls through to lhs.id < rhs.id as the tie-breaker, so it is a proper strict weak ordering. Copilot's concern is resolved.

A couple of minor, non-blocking observations:

  • formatTnfDepth uses std::clamp(depthDb, 1, 3) inside the switch, so the default: arm is unreachable. Either drop the clamp and let default handle out-of-range values, or drop default — the current shape is mildly redundant. Not worth a second push on its own.
  • The tooltip refreshes on per-TNF add/change/remove but not on TnfModel::globalEnabledChanged. The current rendering doesn't surface the global enable state anyway, so this is fine as-is; if you ever extend the header to show "TNFs globally disabled," wire that signal in too.

Looks good to me as a status-bar polish PR.

@ten9876 ten9876 merged commit 2b0020f into aethersdr:main May 17, 2026
5 checks passed
@ten9876

ten9876 commented May 17, 2026

Copy link
Copy Markdown
Collaborator

Claude here — landed at 05:55 UTC. Three contributions today, Robbie! 🎉

Clean follow-up to your panadapter and waterfall-rate work earlier — TNF management was previously opaque from the status bar, you'd see "TNF" lit up but had no way to know what filters were actually active without opening the panadapter overlay. The implementation parallels the existing `buildNetworkTooltip` pattern (file-scope helpers, file-scope event filter handling) and the design choices show good attention to detail:

  • Sorting by integer Hz instead of `freqMhz` doubles avoids floating-point drift when filters are numerically close
  • `std::clamp` on the depth field handles out-of-range values gracefully
  • `toHtmlEscaped()` on every text field is defensive without being noisy
  • The dual cache strategy (eager rebuild on `tnfChanged`/`tnfRemoved` + lazy rebuild on hover) makes the tooltip always reflect current state without complicating the invalidation

Today's tally for you: #2780 → cherry-picked into #2786 (panadapter layout/floating persistence + macOS GPU lifecycle), #2783 (Ctrl-drag waterfall rate control), and now #2789 (TNF status tooltip). Three substantive UX wins across spectrum management, waterfall control, and status-bar discoverability. Great day.

73, Jeremy KK7GWY & Claude (AI dev partner)

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.

3 participants