Skip to content

Issue #91 — LEDSpicerUI layout bugs — changes made#94

Merged
meduzapat merged 1 commit into
developmentfrom
task_91-Restrictor-only_(devic
Jul 4, 2026
Merged

Issue #91 — LEDSpicerUI layout bugs — changes made#94
meduzapat merged 1 commit into
developmentfrom
task_91-Restrictor-only_(devic

Conversation

@meduzapat

Copy link
Copy Markdown
Owner

Task-Url: #91

Bug fixes:

  • Random colors list no longer carries over stale entries between project loads (boxRandomColors is now wiped unconditionally before repopulating).
  • Settings > General tab: Switch/Label order swapped to match the rest of the app (Label first, then Switch), and labels given expand=True so all switches align flush-right within their row.
  • Removed 3 dead .clear() calls in readConfigFile (redundant with load()'s own internal clear).
  • Removed a stale, contentless TODO comment in DialogLinkEditor.cpp.
  • Re-selecting the already-open project now offers a real revert (discard
    unsaved changes + reload from disk) instead of just an info message, when the project is dirty.

Save-time "All" group optimization:

  • ConfigFile::save() now omits the "All" group from the saved file when it exactly matches the default device order (position-for-position), since the daemon auto-builds it identically in that case.
  • Strip elements are expanded into their children (not the unlinkable parent) when building that comparison, matching daemon behavior.
  • xmlSection() gained an allowEmpty parameter so <layout>'s defaultProfile/defaultProject attributes still get written even when the groups body ends up empty after "All" is omitted.

Code quality / review follow-ups:

  • Moved ProjectFile.hpp / Storage/Element.hpp includes into ConfigFile.hpp (header carries the deps, not the .cpp).
  • Multi-line comments in ConfigFile.cpp switched from stacked // to /* */.
  • Extracted the strip-expansion and order-comparison logic out of save() into two named, testable static methods: expandDeviceElements() and matchesDeviceOrder().

Tests:

  • Added 7 unit tests covering both extracted helpers: plain element order, strip-parent exclusion (children only, correct position), mixed plain+strip sequencing, and matching cases for matchesDeviceOrder (identical, reordered, size mismatch, strip children reordered).
  • Added tests/mocks/MockDevice.hpp (reusable minimal Parent stand-in for a device), matching the existing MockData/MockBasicData conventions.
  • Verified with a deliberate negative control (temporarily broke matchesDeviceOrder) to confirm the new tests actually catch the regression they're meant to catch, not passing vacuously.

Investigated, found not to be bugs:

  • "Default profile not selected after loading" — confirmed to be expected behavior in Local Mode, where projects share one physical ledspicer.conf file (not a defect).
  • Cascade delete on Element removal (dependency system correctly purges stale Group links, including in "All", when devices are wiped) — verified correct, no dangling pointers.

Task-Url: #91

Bug fixes:
- Random colors list no longer carries over stale entries between
project loads (boxRandomColors is now wiped unconditionally before
repopulating).
- Settings > General tab: Switch/Label order swapped to match the rest
of the app (Label first, then Switch), and labels given expand=True so
all switches align flush-right within their row.
- Removed 3 dead `.clear()` calls in readConfigFile (redundant with
load()'s own internal clear).
- Removed a stale, contentless TODO comment in DialogLinkEditor.cpp.
- Re-selecting the already-open project now offers a real revert
(discard
  unsaved changes + reload from disk) instead of just an info message,
when the project is dirty.

Save-time "All" group optimization:
- ConfigFile::save() now omits the "All" group from the saved file when
it exactly matches the default device order (position-for-position),
since the daemon auto-builds it identically in that case.
- Strip elements are expanded into their children (not the unlinkable
parent) when building that comparison, matching daemon behavior.
- xmlSection() gained an `allowEmpty` parameter so `<layout>`'s
defaultProfile/defaultProject attributes still get written even when the
groups body ends up empty after "All" is omitted.

Code quality / review follow-ups:
- Moved ProjectFile.hpp / Storage/Element.hpp includes into
ConfigFile.hpp (header carries the deps, not the .cpp).
- Multi-line comments in ConfigFile.cpp switched from stacked `//` to
`/* */`.
- Extracted the strip-expansion and order-comparison logic out of save()
into two named, testable static methods: expandDeviceElements() and
matchesDeviceOrder().

Tests:
- Added 7 unit tests covering both extracted helpers: plain element
order, strip-parent exclusion (children only, correct position), mixed
plain+strip sequencing, and matching cases for matchesDeviceOrder
(identical, reordered, size mismatch, strip children reordered).
- Added tests/mocks/MockDevice.hpp (reusable minimal Parent stand-in for
a device), matching the existing MockData/MockBasicData conventions.
- Verified with a deliberate negative control (temporarily broke
matchesDeviceOrder) to confirm the new tests actually catch the
regression they're meant to catch, not passing vacuously.

Investigated, found not to be bugs:
- "Default profile not selected after loading" — confirmed to be
expected behavior in Local Mode, where projects share one physical
ledspicer.conf file (not a defect).
- Cascade delete on Element removal (dependency system correctly purges
stale Group links, including in "All", when devices are wiped) —
verified correct, no dangling pointers.
@meduzapat meduzapat self-assigned this Jul 4, 2026
@meduzapat meduzapat added bug Something isn't working enhancement New feature or request labels Jul 4, 2026
@meduzapat meduzapat merged commit 78c3632 into development Jul 4, 2026
1 check passed
@meduzapat meduzapat deleted the task_91-Restrictor-only_(devic branch July 4, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant