refactor: unify Signals plugin (absorbs FilteredCharts)#112
Conversation
There was a problem hiding this comment.
Pull request overview
Unifies the former Signals and FilteredCharts plugins into a single, JSON-configured “Signals” chart widget with per-set/page/item editing and optional filtering.
Changes:
- Replaces the old static
SignalsView/button approach with a data-drivenSignals.qml+ChartsView.qmlrenderer. - Adds a full Fact-based editor for sets/pages/items (
SignalsMenu*,MenuSet/MenuPage/MenuItem) and filter components (running average + simple Kalman). - Introduces UI components for page tabs and color selection (
PageButton.qml,ColorChooser.qml,MenuColor.qml).
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Plugins/Tools/Signals/SignalsView.qml | Removed legacy chart view implementation. |
| src/Plugins/Tools/Signals/SignalsMenuPopup.qml | Adds pinned Fact menu popup wrapper for the sets editor. |
| src/Plugins/Tools/Signals/SignalsMenu.qml | Adds top-level sets editor that loads/saves signals.json and migrates legacy format. |
| src/Plugins/Tools/Signals/Signals.qml | Rewrites Signals root widget to render active/pinned pages and integrate the sets editor. |
| src/Plugins/Tools/Signals/REFACTOR_NOTES.md | Documents the refactor mapping and intended JSON/Fact-tree design. |
| src/Plugins/Tools/Signals/PageButton.qml | Adds per-page tab button with warning/alarm/pinned styling + tooltip. |
| src/Plugins/Tools/Signals/MenuSet.qml | Implements a set Fact that manages up to 10 pages. |
| src/Plugins/Tools/Signals/MenuPage.qml | Implements per-page Fact editor and aggregation of warning/alarm state. |
| src/Plugins/Tools/Signals/MenuItem.qml | Implements per-chart item editor and telemetry-driven value evaluation/filtering. |
| src/Plugins/Tools/Signals/MenuFilters.qml | Implements filter selection and parameter persistence per item. |
| src/Plugins/Tools/Signals/MenuColor.qml | Refactors color selection into a Fact that opens a chooser page. |
| src/Plugins/Tools/Signals/FilterRunningAvg.qml | Adds running-average filter Fact with stateful filterValue() API. |
| src/Plugins/Tools/Signals/FilterKalmanSimple.qml | Adds simple Kalman filter Fact with stateful filterValue() API. |
| src/Plugins/Tools/Signals/ColorChooser.qml | Adds palette UI page for selecting a chart color. |
| src/Plugins/Tools/Signals/ChartsView.qml | Adds the unified QtCharts renderer (replacement for SignalsView/FcChartsView). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot apply changes based on the comments in this thread |
…e header Agent-Logs-Url: https://github.com/uavos/apx-gcs/sessions/f2cf86b8-011c-44d0-8252-723f090feda1 Co-authored-by: uavinda <160358+uavinda@users.noreply.github.com>
Applied all six review comments in commit
(The duplicate-root-widget and |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| item.color = asString(source.color, "") | ||
| item.filters = normalizeFilters(source.filters) | ||
| item.warning = asString(source.warning !== undefined ? source.warning : source.warn, "") | ||
| item.save = asString(source.save, "") |
There was a problem hiding this comment.
normalizeItem() normalizes bind but does not normalize save. If a settings file contains mandala.sns.scr.foo.value (or other simple mandala variants), SignalsView will later call mandala.fact(saveTarget, true) with the un-normalized string and likely fail. Consider running normalizeBind() on source.save as well so the persisted/runtime value is consistently the bare path (e.g. sns.scr.foo).
| item.save = asString(source.save, "") | |
| item.save = normalizeBind(asString(source.save, "")) |
| MenuPage.qml | ||
| MenuSet.qml | ||
| MenuSets.qml | ||
| PageButton.qml |
There was a problem hiding this comment.
PageButton.qml is included in QRC_QML, but it is not referenced anywhere in the repo (no PageButton usages found). If it’s truly unused, removing it from the resource list (and deleting the file) will avoid shipping dead UI variants and reduce maintenance overhead.
| PageButton.qml |
| TextButton { | ||
| Layout.fillHeight: true | ||
| checkable: true | ||
| ButtonGroup.group: buttonGroup | ||
|
|
||
| property var values: [] | ||
| onActivated: signals.facts=Qt.binding(function(){return values}) | ||
|
|
||
| toolTip: getToolTip(values) | ||
|
|
||
| function getToolTip(facts) | ||
| { | ||
| var s=[] | ||
| for(var i=0;i<facts.length;++i){ | ||
| var fact=facts[i] | ||
| s.push("<font color='"+fact.opts.color+"'>"+fact.descr+"</font>") | ||
| } | ||
| return s.join("<br>") | ||
| } |
There was a problem hiding this comment.
This file appears to be an unused duplicate of SignalButton.qml (no references to MenuColor/MenuColor.qml found, and it’s not included in CMakeLists.txt resources). If it’s leftover from the refactor, consider removing it to avoid confusion about the active tab/button implementation.
| TextButton { | |
| Layout.fillHeight: true | |
| checkable: true | |
| ButtonGroup.group: buttonGroup | |
| property var values: [] | |
| onActivated: signals.facts=Qt.binding(function(){return values}) | |
| toolTip: getToolTip(values) | |
| function getToolTip(facts) | |
| { | |
| var s=[] | |
| for(var i=0;i<facts.length;++i){ | |
| var fact=facts[i] | |
| s.push("<font color='"+fact.opts.color+"'>"+fact.descr+"</font>") | |
| } | |
| return s.join("<br>") | |
| } | |
| // Compatibility wrapper: keep MenuColor as an entry point, but delegate the | |
| // actual tab/button implementation to the canonical SignalButton component. | |
| SignalButton { | |
| property var values: [] | |
| onActivated: signals.facts = Qt.binding(function() { return values }) |
| function evaluateValue(fact, bind) | ||
| { | ||
| if (fact && fact.value !== undefined) | ||
| return fact.value | ||
|
|
||
| if (!bind) | ||
| return NaN | ||
|
|
||
| try { | ||
| return eval(normalizeBindText(bind)) | ||
| } catch (error) { |
There was a problem hiding this comment.
evaluateValue() currently does eval(normalizeBindText(bind)), but normalizeBindText() strips mandala. and .value, producing paths like est.att.roll. In most of the codebase, mandala facts are accessed via mandala.<path>.value, so this will evaluate to undefined/throw and the chart will fall back to 0. Consider treating simple binds as mandala paths: resolve/caches apxContext.fleet.current.mandala.fact(path, true) in seriesState and read .value (or, at minimum, eval("mandala." + path + ".value")).
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Summary
Absorbs the
FilteredChartsplugin into theSignalsplugin, replacing the two side-by-side plugins with one unified, data-driven widget. Supersedes PR #111.What changed
Removed
src/Plugins/Tools/FilteredCharts/— entire directory deletedsrc/Plugins/Tools/Signals/SignalButton.qml— old static buttonsrc/Plugins/Tools/Signals/SignalsView.qml— replaced byChartsView.qmlFilteredChartsentry fromsrc/Plugins/Tools/CMakeLists.txtNew files in
src/Plugins/Tools/Signals/ChartsView.qmlColorChooser.qmlFilterRunningAvg.qmlfilterValue(v)/resetState()APIFilterKalmanSimple.qmlMenuFilters.qmlapplyFilters(v),resetFilterState()MenuColor.qmlMenuItem.qmlMenuPage.qmlMenuSet.qmlSignalsMenu.qmlloadSettings()/saveSettings()/buildDefaultSet()/migrateLegacy()SignalsMenuPopup.qmlPageButton.qmlModified
src/Plugins/Tools/Signals/Signals.qml— rewritten as the unified root widgetArchitecture
JSON schema (
signals.json):{ "active": { "signals": 0 }, "sets": [{ "title": "default", "pages": [{ "name": "R", "pin": false, "speed": 1.0, "items": [{ "bind": "mandala.est.att.roll.value", "title": "roll", "color": "", "filters": [], "warn": "", "alarm": "", "act": "", "save": "" }] }] }] }Legacy migration: old
{page, signalas}format is silently converted on first load.Default set: 10 pages matching the old hardcoded buttons (R/P/Y/Axy/Az/G/Pt/Ctr/RC/Usr) are generated automatically if no
signals.jsonexists.Testing
cmake --build build --target Signals— clean build, no errors (only pre-existing macOS SDK version ld warnings unrelated to this change)