fix(wave): persist WaveApplet drawer collapsed state across restarts#2827
Conversation
…(#XXXX)
After double-clicking the Waveform applet to hide the View/Zoom/FPS/Window
controls, restarting AetherSDR would re-open the drawer and restore the
taller expanded size — ignoring both the collapsed state and the compacted
height the user had arranged.
────────────────────────────────────────────────────────────────────────────
Root cause
────────────────────────────────────────────────────────────────────────────
`WaveApplet::WaveApplet()` ended with a hardcoded `setSettingsExpanded(true)`
regardless of any saved state. Additionally, `setSettingsExpanded()` never
wrote the new state to `AppSettings`, so there was nothing to restore even
if the read-side had been wired up.
The compact height is fully derived from `sizeHint()` / `minimumSizeHint()`,
which already account for drawer visibility — so no separate height key is
needed. Restoring the drawer state at startup is sufficient to restore the
correct size.
────────────────────────────────────────────────────────────────────────────
Fix
────────────────────────────────────────────────────────────────────────────
`setSettingsExpanded()`: write `WaveApplet_DrawerExpanded` ("True"/"False")
to `AppSettings` and call `save()` whenever the drawer is toggled.
Constructor: read `WaveApplet_DrawerExpanded` (default "True" so existing
users whose setting file predates this fix start expanded as before) and
pass the result to `setSettingsExpanded()` instead of the hardcoded `true`.
────────────────────────────────────────────────────────────────────────────
Files changed
────────────────────────────────────────────────────────────────────────────
src/gui/WaveApplet.cpp
— setSettingsExpanded(): save WaveApplet_DrawerExpanded on every toggle
— WaveApplet(): read saved drawer state instead of hardcoding expanded
────────────────────────────────────────────────────────────────────────────
Testing notes
────────────────────────────────────────────────────────────────────────────
1. Open AetherSDR; confirm the Waveform applet starts with controls visible.
2. Double-click the applet body to collapse the drawer.
3. Resize the applet to the desired compact height.
4. Restart AetherSDR.
5. Expected: drawer remains hidden; applet height matches the collapsed size.
6. Re-expand with another double-click; restart again.
7. Expected: drawer is open on next launch.
|
@AetherClaude thoughts on this particular PR? |
|
Confirmed the diagnosis by reading
The rest of the applet already uses the Suggested patch: // In WaveApplet::WaveApplet(...), replace the hardcoded expand near line 171:
const bool drawerExpanded = AppSettings::instance()
.value("WaveApplet_DrawerExpanded", "True").toString()
.compare("True", Qt::CaseInsensitive) == 0;
setSettingsExpanded(drawerExpanded);
setMinimumHeight(minimumSizeHint().height());
// In WaveApplet::setSettingsExpanded(bool expanded), persist on every change:
void WaveApplet::setSettingsExpanded(bool expanded)
{
if (!m_settingsDrawer)
return;
const bool currentlyExpanded = !m_settingsDrawer->isHidden();
if (currentlyExpanded == expanded)
return;
m_settingsDrawer->setVisible(expanded);
setMinimumHeight(minimumSizeHint().height());
updateGeometry();
adjustSize();
if (auto* p = parentWidget())
p->updateGeometry();
auto& settings = AppSettings::instance();
settings.setValue("WaveApplet_DrawerExpanded",
expanded ? QStringLiteral("True") : QStringLiteral("False"));
settings.save();
}Two small notes:
A maintainer can authorize the orchestrator to land this fix by adding the 73, Jeremy KK7GWY & Claude (AI dev partner) |
|
@AetherClaude label applied for your takeover. |
|
Re-read
One small wrinkle worth calling out: on a fresh construction the drawer's Proposed patch: // src/gui/WaveApplet.cpp — replace the hardcoded expand near line 171:
const bool drawerExpanded = AppSettings::instance()
.value("WaveApplet_DrawerExpanded", "True").toString()
.compare("True", Qt::CaseInsensitive) == 0;
setSettingsExpanded(drawerExpanded);
setMinimumHeight(minimumSizeHint().height());
// src/gui/WaveApplet.cpp — persist in setSettingsExpanded():
void WaveApplet::setSettingsExpanded(bool expanded)
{
if (!m_settingsDrawer)
return;
const bool currentlyExpanded = !m_settingsDrawer->isHidden();
if (currentlyExpanded == expanded)
return;
m_settingsDrawer->setVisible(expanded);
setMinimumHeight(minimumSizeHint().height());
updateGeometry();
adjustSize();
if (auto* p = parentWidget())
p->updateGeometry();
auto& settings = AppSettings::instance();
settings.setValue("WaveApplet_DrawerExpanded",
expanded ? QStringLiteral("True") : QStringLiteral("False"));
settings.save();
}Two notes:
The 73, Jeremy KK7GWY & Claude (AI dev partner) |
There was a problem hiding this comment.
Looks good — small, well-scoped fix that does exactly what the description claims.
Verified:
- Uses
AppSettingswith the established"True"/"False"string convention (matchesTciApplet.cpp:195,VfoWidget.cpp:2131, etc.). - Default of
"True"preserves prior behavior for existing users whose settings predate this fix. - The save happens behind the early-return guard in
setSettingsExpanded()(line 339-340), so toggling to the same state is a no-op — no spurious writes. - Relying on
sizeHint()/minimumSizeHint()to derive the compact height is correct here (lines 180-196 already key offm_settingsDrawer->isHidden()), so a separate height key is genuinely unnecessary. - No null deref risk —
setSettingsExpanded()already guardsm_settingsDrawer, andAppSettings::instance()is the standard singleton accessor used throughout.
Thanks @chibondking — nicely diagnosed (the asymmetric read/write was a real gap) and the patch stays inside WaveApplet.cpp with no header churn.
jensenpat
left a comment
There was a problem hiding this comment.
Risks: None significant. Doesn't touch slice 0 RX flow, threading, or protocol. Pure UI persistence. save() on every toggle is fine — toggling the drawer is a user-initiated rare event, not a hot path.
…ethersdr#2827) After double-clicking the Waveform applet to hide the View/Zoom/FPS/Window controls, restarting AetherSDR would re-open the drawer and restore the taller expanded size — ignoring both the collapsed state and the compacted height the user had arranged. ──────────────────────────────────────────────────────────────────────────── Root cause ──────────────────────────────────────────────────────────────────────────── `WaveApplet::WaveApplet()` ended with a hardcoded `setSettingsExpanded(true)` regardless of any saved state. Additionally, `setSettingsExpanded()` never wrote the new state to `AppSettings`, so there was nothing to restore even if the read-side had been wired up. The compact height is fully derived from `sizeHint()` / `minimumSizeHint()`, which already account for drawer visibility — so no separate height key is needed. Restoring the drawer state at startup is sufficient to restore the correct size. ──────────────────────────────────────────────────────────────────────────── Fix ──────────────────────────────────────────────────────────────────────────── `setSettingsExpanded()`: write `WaveApplet_DrawerExpanded` ("True"/"False") to `AppSettings` and call `save()` whenever the drawer is toggled. Constructor: read `WaveApplet_DrawerExpanded` (default "True" so existing users whose setting file predates this fix start expanded as before) and pass the result to `setSettingsExpanded()` instead of the hardcoded `true`. ──────────────────────────────────────────────────────────────────────────── Files changed ──────────────────────────────────────────────────────────────────────────── src/gui/WaveApplet.cpp — setSettingsExpanded(): save WaveApplet_DrawerExpanded on every toggle — WaveApplet(): read saved drawer state instead of hardcoding expanded ──────────────────────────────────────────────────────────────────────────── Testing notes ──────────────────────────────────────────────────────────────────────────── 1. Open AetherSDR; confirm the Waveform applet starts with controls visible. 2. Double-click the applet body to collapse the drawer. 3. Resize the applet to the desired compact height. 4. Restart AetherSDR. 5. Expected: drawer remains hidden; applet height matches the collapsed size. 6. Re-expand with another double-click; restart again. 7. Expected: drawer is open on next launch.
After double-clicking the Waveform applet to hide the View/Zoom/FPS/Window controls, restarting AetherSDR would re-open the drawer and restore the taller expanded size — ignoring both the collapsed state and the compacted height the user had arranged.
──────────────────────────────────────────────────────────────────────────── Root cause
────────────────────────────────────────────────────────────────────────────
WaveApplet::WaveApplet()ended with a hardcodedsetSettingsExpanded(true)regardless of any saved state. Additionally,setSettingsExpanded()never wrote the new state toAppSettings, so there was nothing to restore even if the read-side had been wired up.The compact height is fully derived from
sizeHint()/minimumSizeHint(), which already account for drawer visibility — so no separate height key is needed. Restoring the drawer state at startup is sufficient to restore the correct size.──────────────────────────────────────────────────────────────────────────── Fix
────────────────────────────────────────────────────────────────────────────
setSettingsExpanded(): writeWaveApplet_DrawerExpanded("True"/"False") toAppSettingsand callsave()whenever the drawer is toggled.Constructor: read
WaveApplet_DrawerExpanded(default "True" so existing users whose setting file predates this fix start expanded as before) and pass the result tosetSettingsExpanded()instead of the hardcodedtrue.──────────────────────────────────────────────────────────────────────────── Files changed
──────────────────────────────────────────────────────────────────────────── src/gui/WaveApplet.cpp
— setSettingsExpanded(): save WaveApplet_DrawerExpanded on every toggle
— WaveApplet(): read saved drawer state instead of hardcoding expanded
──────────────────────────────────────────────────────────────────────────── Testing notes
────────────────────────────────────────────────────────────────────────────