Skip to content

Add collapsible slice receiver flags#1166

Merged
ten9876 merged 1 commit into
aethersdr:mainfrom
rfoust:feature/collapsible-slice-flag
Apr 11, 2026
Merged

Add collapsible slice receiver flags#1166
ten9876 merged 1 commit into
aethersdr:mainfrom
rfoust:feature/collapsible-slice-flag

Conversation

@rfoust

@rfoust rfoust commented Apr 11, 2026

Copy link
Copy Markdown
Collaborator

Clicking the slice letter badge (A/B/C/etc) toggles the VFO flag between full and collapsed modes. Collapsed mode shows only the slice letter, TX indicator, and frequency — saving screen space when multiple slices are active.

Features

  • Click slice letter to collapse/expand the flag
  • Collapsed display: painted slice badge, TX indicator, and floating frequency label
  • TX toggle works in collapsed mode (click TX badge area)
  • Scroll-to-tune works in collapsed mode
  • Persistence: collapsed state saved per-slice via AppSettings
  • Mouse event isolation: all child widgets get WA_TransparentForMouseEvents when collapsed to prevent phantom clicks on hidden buttons
  • 8-slice support: extended slice letter table from A–D to A–H

Changes

  • VfoWidget.h: Added collapsed state, setCollapsed()/isCollapsed(), mouseReleaseEvent() override, collapsed freq label, hidden-widget tracking set
  • VfoWidget.cpp: Collapse/expand toggle logic, collapsed-mode painting, per-slice persistence, deferred toggle via QTimer::singleShot to avoid mouse event leaks

Testing

  • Tested with 1–4 slices: collapse, expand, TX toggle, scroll-to-tune, persistence across reconnects
  • Verified no phantom slice creation on expand (was a tricky mouse event delivery bug)

Clicking the slice letter badge (A/B/C/etc) toggles the VFO flag between
full and collapsed modes. Collapsed mode shows only the slice letter, TX
indicator, and frequency — saving screen space when multiple slices are
active.

Features:
- Click slice letter to collapse/expand the flag
- Collapsed state shows painted slice badge, TX indicator, and floating
  frequency label
- TX toggle works in collapsed mode (click TX badge area)
- Scroll-to-tune works in collapsed mode
- Collapsed state persists per-slice via AppSettings
- All child widgets set WA_TransparentForMouseEvents when collapsed to
  prevent phantom clicks on hidden buttons
- Extended slice letter table from A-D to A-H for 8-slice support
Copilot AI review requested due to automatic review settings April 11, 2026 03:40
@rfoust rfoust requested a review from ten9876 as a code owner April 11, 2026 03:40

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 collapsible “slice flag” mode to VfoWidget to reduce on-screen space usage when multiple slices are active, while keeping key interactions (TX toggle and scroll-to-tune) available in the collapsed state.

Changes:

  • Introduces collapsed/expanded state handling in VfoWidget, including persistence via AppSettings.
  • Implements collapsed-mode painting (slice badge + TX badge) and a floating frequency label.
  • Extends slice letter display mapping from A–D to A–H.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/gui/VfoWidget.h Adds collapsed-state API/state and tracking for widgets hidden during collapse.
src/gui/VfoWidget.cpp Implements collapse/expand behavior, collapsed painting + interactions, persistence, and positioning for the floating frequency label.
Comments suppressed due to low confidence (1)

src/gui/VfoWidget.cpp:2595

  • Expanded-mode slice badge color uses kSliceColors[id] only when id < kSliceColorCount (4), so slices E–H will not get a consistent per-slice color even though letters now support 8. Align with SliceColors.h’s documented sliceId % 4 indexing so colors cycle instead of falling back.
    const char letters[] = "ABCDEFGH";
    int id = m_slice->sliceId();
    m_sliceBadge->setText(QString(QChar(id >= 0 && id < 8 ? letters[id] : '?')));
    // Color-code the slice badge to match the spectrum overlay colors
    const char* badgeColor = (id >= 0 && id < kSliceColorCount)
        ? kSliceColors[id].hexActive : "#0070c0";
    m_sliceBadge->setStyleSheet(

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

Comment thread src/gui/VfoWidget.h
bool m_lastOnLeft{true};
float m_signalDbm{-130.0f};
bool m_collapsed{false};
bool m_collapseToggled{false}; // guard: absorb release after toggle

Copilot AI Apr 11, 2026

Copy link

Choose a reason for hiding this comment

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

m_collapseToggled is declared but never read or written anywhere in the implementation, so it’s dead state (and will likely trigger unused-field warnings). Either remove this member or implement the intended guard logic in the mouse handlers so the variable is meaningful.

Suggested change
bool m_collapseToggled{false}; // guard: absorb release after toggle

Copilot uses AI. Check for mistakes.
Comment thread src/gui/VfoWidget.cpp
Comment on lines +248 to +249
// Click anywhere else on collapsed widget → expand (deferred)
QTimer::singleShot(0, this, [this] { setCollapsed(false); });

Copilot AI Apr 11, 2026

Copy link

Choose a reason for hiding this comment

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

In collapsed mode, the widget expands on any mouse button because this path isn’t gated on Qt::LeftButton. This makes right/middle clicks (e.g., context-menu clicks) unexpectedly expand the flag. Restrict the expand toggle to the intended button(s).

Suggested change
// Click anywhere else on collapsed widget → expand (deferred)
QTimer::singleShot(0, this, [this] { setCollapsed(false); });
// Left-click anywhere else on collapsed widget → expand (deferred)
if (ev->button() == Qt::LeftButton) {
QTimer::singleShot(0, this, [this] { setCollapsed(false); });
}

Copilot uses AI. Check for mistakes.
Comment thread src/gui/VfoWidget.cpp
Comment on lines +2003 to +2004
const char* badgeColor = (sliceId >= 0 && sliceId < kSliceColorCount)
? kSliceColors[sliceId].hexActive : "#0070c0";

Copilot AI Apr 11, 2026

Copy link

Choose a reason for hiding this comment

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

Collapsed-mode badge coloring only uses kSliceColors[sliceId] when sliceId < kSliceColorCount, but kSliceColorCount is 4 (and SliceColors.h documents indexing by sliceId % 4). With 8-slice letters enabled, sliceIds 4–7 will fall back to the default color instead of cycling the defined colors. Use modulo (and keep the bounds check) so colors remain consistent for higher sliceIds.

Suggested change
const char* badgeColor = (sliceId >= 0 && sliceId < kSliceColorCount)
? kSliceColors[sliceId].hexActive : "#0070c0";
const char* badgeColor = (sliceId >= 0 && kSliceColorCount > 0)
? kSliceColors[sliceId % kSliceColorCount].hexActive : "#0070c0";

Copilot uses AI. Check for mistakes.
Comment thread src/gui/VfoWidget.cpp
// Keep collapsed frequency label in sync
if (m_collapsed && m_collapsedFreqLabel) {
m_collapsedFreqLabel->setText(freqText);
m_collapsedFreqLabel->adjustSize();

Copilot AI Apr 11, 2026

Copy link

Choose a reason for hiding this comment

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

When collapsed, updateFreqLabel() updates and adjustSize()s the floating frequency label but doesn’t reposition it afterward. If the text width changes (e.g., MHz digit count), the label can drift and overlap/leave an incorrect gap relative to the collapsed flag until the next updatePosition() call. Recompute/move the label after resizing so it stays correctly anchored to the flag.

Suggested change
m_collapsedFreqLabel->adjustSize();
m_collapsedFreqLabel->adjustSize();
updatePosition();

Copilot uses AI. Check for mistakes.
@rfoust

rfoust commented Apr 11, 2026

Copy link
Copy Markdown
Collaborator Author

I snuck in the 8-slice letter support in this one. It kept showing question marks '?' for some slices for me.

@ten9876 ten9876 merged commit bdd4265 into aethersdr:main Apr 11, 2026
8 of 9 checks passed
@rfoust rfoust deleted the feature/collapsible-slice-flag branch April 11, 2026 05:01
@aethersdr-agent aethersdr-agent Bot mentioned this pull request Apr 13, 2026
2 tasks
@aethersdr-agent aethersdr-agent Bot mentioned this pull request May 2, 2026
2 tasks
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