-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move enum-to-text functions to enums.h to allow removal of Global digitalInputs and batteries #1790
Conversation
data/common/SystemBattery.qml
Outdated
@@ -16,8 +16,9 @@ QtObject { | |||
readonly property real current: _current.isValid ? _current.value : NaN | |||
readonly property real temperature: _temperature.isValid ? _temperature.value : NaN | |||
readonly property real timeToGo: _timeToGo.isValid ? _timeToGo.value : NaN | |||
readonly property string icon: !!Global.batteries ? Global.batteries.batteryIcon(power) : "" | |||
readonly property int mode: !!Global.batteries ? Global.batteries.batteryMode(power) : -1 | |||
readonly property string icon: isNaN(power) || power === 0 ? "qrc:/images/icon_battery_24.svg" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given that you already have mode calculated below, can't you just have: icon: mode == Idle ? battery.svg : mode == Charging ? battery-charging.svg : battery-discharging.svg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah much nicer, updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nitpick, aside from that LGTM.
bc31ed1
to
c47c72a
Compare
It just provides static functions that can be moved to enums.h. Part of #1400
ae5bda1
to
6c2e886
Compare
6c2e886
to
2d66db1
Compare
No description provided.