-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Code Review: Remote ID Toolbar Indicator
Full code review of RemoteIDIndicator.qml and RemoteIDIndicatorPage.qml.
Bugs
-
Null dereference on
showIndicator(RemoteIDIndicator.qml:15)
showIndicator: remoteIDManager.available— whenactiveVehicleis null,remoteIDManageris null, and accessing.availableproduces a QML warning. Should be:showIndicator: remoteIDManager ? remoteIDManager.available : false
-
remoteIDStateis not reactive (RemoteIDIndicator.qml:26)
property int remoteIDState: getRemoteIDState()— calls the function once at initialization. QML won't re-evaluate whencommsFlag,armFlag, etc. change because imperative function calls don't create bindings on the properties read inside the function. -
Undefined
remoteIDManagerreference (RemoteIDIndicatorPage.qml:324)
labelText: remoteIDManager.armStatusError— there is noremoteIDManagerproperty in this file. Will produce a runtime ReferenceError. Should be:labelText: _activeVehicle ? _activeVehicle.remoteIDManager.armStatusError : ""
-
Operator ID visibility — unqualified enum reference (
RemoteIDIndicatorPage.qml:193)
_regionOperation == RemoteIDIndicatorPage.EU— should beRemoteIDIndicatorPage.RegionOperation.EUfor consistency with the fully qualified form used elsewhere.
Cleanup
-
Redundant
breakafterreturn(RemoteIDIndicator.qml:50,53,56,59)
EachcaseingetRidColor()hasreturn ... break. Thebreakis unreachable. -
Typo in id:
basicIDFlagIge(RemoteIDIndicatorPage.qml:159)
Should bebasicIDFlagImage. -
Duplicated
RegionOperationenum
Defined in bothRemoteIDIndicator.qmlandRemoteIDIndicatorPage.qml. Should be in one place. -
Unused enums (
RemoteIDIndicatorPage.qml:41-49)
ClassificationTypeis never referenced.LocationTypeis only used once in theConnectionshandler. -
visible: trueis redundant (RemoteIDIndicatorPage.qml:237,248)
BothemergencyDeclareLabelandemergencyButtonspecify the default value. -
Redundant null checks on flag properties (both files)
activeVehicle && remoteIDManager ?— ifremoteIDManageris non-null,activeVehicleis necessarily non-null. Could simplify with a localremoteIDManagerproperty in the indicator page too.
Design Improvements
-
Emergency button — fragile source string comparison (
RemoteIDIndicatorPage.qml:258-273)
Timer and press-and-hold toggle the image by comparingemergencyButton.sourceagainst path strings. Use a boolean state property instead. -
Emergency button — no visual press feedback
User must press-and-hold for 800ms/3000ms with no indication the press is being registered until the hold completes. -
Expanded panel
Connectionsuses deprecated signal syntax (RemoteIDIndicatorPage.qml:300)
onRawValueChanged— Qt6 prefers function syntax. -
Expanded panel side-effects in
Connections(RemoteIDIndicatorPage.qml:302-308)
ChangingsendOperatorIdFact.rawValueandlocationTypeFact.valuein response to region changes is business logic that should live in C++, not in a UI indicator panel.