diff --git a/components/BriefCenterDisplay.qml b/components/BriefCenterDisplay.qml index 4b79a48c8..f6383b614 100644 --- a/components/BriefCenterDisplay.qml +++ b/components/BriefCenterDisplay.qml @@ -89,14 +89,12 @@ Column { value: Global.system.battery.voltage } - QuantityLabel { - readonly property bool unitAmps: (Global.systemSettings.electricalQuantity === VenusOS.Units_Amp && !isNaN(Global.system.battery.current)) - || (!isNaN(Global.system.battery.current) && isNaN(Global.system.battery.power)) + ElectricalQuantityLabel { + sourceType: VenusOS.ElectricalQuantity_Source_Dc + dataObject: Global.system.battery valueColor: Theme.color_briefPage_battery_value_text_color unitColor: Theme.color_briefPage_battery_unit_text_color font.pixelSize: Theme.font_briefPage_battery_voltage_pixelSize - value: unitAmps ? Global.system.battery.current : Global.system.battery.power - unit: unitAmps ? VenusOS.Units_Amp : VenusOS.Units_Watt } } diff --git a/components/ElectricalQuantityLabel.qml b/components/ElectricalQuantityLabel.qml index d3a403fa9..eff67b65a 100644 --- a/components/ElectricalQuantityLabel.qml +++ b/components/ElectricalQuantityLabel.qml @@ -6,20 +6,39 @@ import QtQuick import Victron.VenusOS +/* + Shows a quantity in Amps or Watts depending on the user-preferred display mode, according to + Global.systemSettings.electricalPowerDisplay: + + - PreferWatts: show dataObject.power in Watts. + - PreferAmps: if dataObject.current is valid, show it in Amps, otherwise show dataObject.power + in Watts. + - Mixed: if 'sourceType' is ElectricalQuantity_Source_Dc, and dataObject.current is valid, show + it in Amps. Otherwise, show dataObject.power in Watts. +*/ QuantityLabel { id: root + property int sourceType: VenusOS.ElectricalQuantity_Source_Any + + // An object with 'power' and 'current' values. When showing in Amps, the current is displayed, + // otherwise the power is displayed. property var dataObject - property bool acInputMode + readonly property bool _dataObjectValid: dataObject !== null && dataObject !== undefined - readonly property bool _unitAmps: Global.systemSettings.electricalQuantity === VenusOS.Units_Amp && _dataObjectValid && !isNaN(dataObject.current) + readonly property bool _unitAmps: (Global.systemSettings.electricalPowerDisplay === VenusOS.ElectricalPowerDisplay_PreferAmps + || (Global.systemSettings.electricalPowerDisplay === VenusOS.ElectricalPowerDisplay_Mixed + && sourceType === VenusOS.ElectricalQuantity_Source_Dc)) + && _dataObjectValid + && !isNaN(dataObject.current) readonly property real _value: !_dataObjectValid ? NaN : _unitAmps ? dataObject.current : dataObject.power // For AC inputs, the AcInputDirectionIcon should be present to indicate when power is negative, // so just show the absolute value without a minus sign. - value: acInputMode ? Math.abs(_value) // will return NaN if _value is NaN. + value: sourceType === VenusOS.ElectricalQuantity_Source_AcInputOnly + ? Math.abs(_value) // will return NaN if _value is NaN. : _value unit: _unitAmps ? VenusOS.Units_Amp : VenusOS.Units_Watt diff --git a/components/ObjectAcConnection.qml b/components/ObjectAcConnection.qml index c8a9ced43..59fa3651b 100644 --- a/components/ObjectAcConnection.qml +++ b/components/ObjectAcConnection.qml @@ -53,8 +53,6 @@ QtObject { readonly property bool singlePhaseCurrentValid: _phaseCount.value === 1 && currentL1.valid // multi-phase systems don't have a total current readonly property real current: singlePhaseCurrentValid && currentL1.value !== undefined ? currentL1.value : NaN - readonly property int preferredUnit: Global.systemSettings.electricalQuantity === VenusOS.Units_Amp && singlePhaseCurrentValid ? VenusOS.Units_Amp : VenusOS.Units_Watt - readonly property real preferredQuantity: preferredUnit === VenusOS.Units_Amp ? current : power readonly property PhaseModel phases: PhaseModel { id: _phases diff --git a/components/ThreePhaseDisplay.qml b/components/ThreePhaseDisplay.qml index f46291304..355c1ca66 100644 --- a/components/ThreePhaseDisplay.qml +++ b/components/ThreePhaseDisplay.qml @@ -76,6 +76,7 @@ Flow { y: root.widgetSize <= VenusOS.OverviewWidget_Size_S ? phaseLabel.height + Theme.geometry_three_phase_column_spacing : 0 + sourceType: VenusOS.ElectricalQuantity_Source_Ac dataObject: QtObject { readonly property real power: phaseDelegate.power readonly property real current: phaseDelegate.current diff --git a/components/widgets/AcInputWidget.qml b/components/widgets/AcInputWidget.qml index f5c766565..deb5f2f20 100644 --- a/components/widgets/AcInputWidget.qml +++ b/components/widgets/AcInputWidget.qml @@ -16,9 +16,9 @@ AcWidget { title: !!inputInfo ? Global.acInputs.sourceToText(inputInfo.source) : "" icon.source: !!inputInfo ? Global.acInputs.sourceIcon(inputInfo.source) : "" rightPadding: sideGaugeLoader.active ? Theme.geometry_overviewPage_widget_sideGauge_margins : 0 + quantityLabel.sourceType: VenusOS.ElectricalQuantity_Source_AcInputOnly quantityLabel.dataObject: inputOperational ? input : null quantityLabel.leftPadding: acInputDirectionIcon.visible ? (acInputDirectionIcon.width + Theme.geometry_acInputDirectionIcon_rightMargin) : 0 - quantityLabel.acInputMode: true phaseCount: inputOperational ? input.phases.count : 0 enabled: !!inputInfo extraContentLoader.sourceComponent: ThreePhaseDisplay { diff --git a/components/widgets/AcWidget.qml b/components/widgets/AcWidget.qml index 94c36877e..b0b4232c5 100644 --- a/components/widgets/AcWidget.qml +++ b/components/widgets/AcWidget.qml @@ -24,6 +24,7 @@ OverviewWidget { } } + quantityLabel.sourceType: VenusOS.ElectricalQuantity_Source_Ac quantityLabel.visible: !!quantityLabel.dataObject preferredSize: phaseCount > 1 ? VenusOS.OverviewWidget_PreferredSize_PreferLarge : VenusOS.OverviewWidget_PreferredSize_Any diff --git a/components/widgets/DcInputWidget.qml b/components/widgets/DcInputWidget.qml index 68e4a3c3e..cc6a8bf36 100644 --- a/components/widgets/DcInputWidget.qml +++ b/components/widgets/DcInputWidget.qml @@ -16,6 +16,7 @@ OverviewWidget { : "/pages/settings/devicelist/dc-in/PageDcMeter.qml" title: VenusOS.dcMeter_typeToText(inputType) + quantityLabel.sourceType: VenusOS.ElectricalQuantity_Source_Dc quantityLabel.dataObject: QtObject { readonly property real power: inputDeviceModel.totalPower readonly property real current: inputDeviceModel.totalCurrent diff --git a/components/widgets/DcLoadsWidget.qml b/components/widgets/DcLoadsWidget.qml index c8119c582..996535cc2 100644 --- a/components/widgets/DcLoadsWidget.qml +++ b/components/widgets/DcLoadsWidget.qml @@ -15,6 +15,7 @@ OverviewWidget { type: VenusOS.OverviewWidget_Type_DcLoads enabled: systemLoadDevices.count > 1 || nonSystemLoadDevices.count > 0 + quantityLabel.sourceType: VenusOS.ElectricalQuantity_Source_Dc quantityLabel.dataObject: Global.system.dc onClicked: { diff --git a/components/widgets/EvcsWidget.qml b/components/widgets/EvcsWidget.qml index 57610f1bd..ccfd9a1ca 100644 --- a/components/widgets/EvcsWidget.qml +++ b/components/widgets/EvcsWidget.qml @@ -25,6 +25,7 @@ OverviewWidget { type: VenusOS.OverviewWidget_Type_Evcs preferredSize: VenusOS.OverviewWidget_PreferredSize_LargeOnly enabled: true + quantityLabel.sourceType: VenusOS.ElectricalQuantity_Source_Ac quantityLabel.dataObject: Global.evChargers extraContentChildren: [ @@ -54,7 +55,7 @@ OverviewWidget { width: parent.width - ElectricalQuantityLabel { + QuantityLabel { height: chargingTimeLabel.height // use normal label height, instead of default baseline calculation value: energyItem.value ?? NaN valueColor: unitColor diff --git a/data/System.qml b/data/System.qml index 2ca00bddd..829f6fc96 100644 --- a/data/System.qml +++ b/data/System.qml @@ -38,8 +38,6 @@ QtObject { readonly property real current: currentValid ? power / voltage : NaN readonly property real voltage: _dcBatteryVoltage.valid ? _dcBatteryVoltage.value : NaN readonly property real maximumPower: _maximumDcPower.valid ? _maximumDcPower.value : NaN - readonly property int preferredUnit: Global.systemSettings.electricalQuantity === VenusOS.Units_Amp && currentValid ? VenusOS.Units_Amp : VenusOS.Units_Watt - readonly property real preferredQuantity: preferredUnit === VenusOS.Units_Amp ? current : power readonly property VeQuickItem _dcSystemPower: VeQuickItem { uid: root.serviceUid + "/Dc/System/Power" diff --git a/data/SystemSettings.qml b/data/SystemSettings.qml index 23b5942ca..ee4406527 100644 --- a/data/SystemSettings.qml +++ b/data/SystemSettings.qml @@ -16,7 +16,7 @@ QtObject { // It's hard to skip onboarding without touch, so disable onboarding if touch is disabled. && _touchEnabled.valid && _touchEnabled.value !== 0 - property int electricalQuantity: VenusOS.Units_None + property int electricalPowerDisplay: VenusOS.ElectricalPowerDisplay_PreferWatts property int temperatureUnit: VenusOS.Units_None property string temperatureUnitSuffix property int volumeUnit: VenusOS.Units_None @@ -71,14 +71,17 @@ QtObject { return accessLevel.valid && accessLevel.value >= level } - function setElectricalQuantity(value) { + function setElectricalPowerDisplay(value) { switch (value) { - case VenusOS.Units_Watt: + case VenusOS.ElectricalPowerDisplay_PreferWatts: _electricalQuantity.setValue(_electricalQuantity.ve_watt) break - case VenusOS.Units_Amp: + case VenusOS.ElectricalPowerDisplay_PreferAmps: _electricalQuantity.setValue(_electricalQuantity.ve_amp) break + case VenusOS.ElectricalPowerDisplay_Mixed: + _electricalQuantity.setValue(_electricalQuantity.ve_mixed) + break default: console.warn("setElectricalQuantity() unknown value:", value) break @@ -339,19 +342,23 @@ QtObject { property VeQuickItem _electricalQuantity: VeQuickItem { readonly property int ve_watt: 0 readonly property int ve_amp: 1 + readonly property int ve_mixed: 2 uid: root.serviceUid + "/Settings/Gui/ElectricalPowerIndicator" onValueChanged: { switch (value) { case ve_watt: - root.electricalQuantity = VenusOS.Units_Watt + root.electricalPowerDisplay = VenusOS.ElectricalPowerDisplay_PreferWatts break case ve_amp: - root.electricalQuantity = VenusOS.Units_Amp + root.electricalPowerDisplay = VenusOS.ElectricalPowerDisplay_PreferAmps + break + case ve_mixed: + root.electricalPowerDisplay = VenusOS.ElectricalPowerDisplay_Mixed break default: console.warn("Cannot load electrical quantity,", uid, "has unsupported value:", value, "default to watts") - root.electricalQuantity = VenusOS.Units_Watt + root.electricalPowerDisplay = VenusOS.ElectricalPowerDisplay_PreferWatts break } } diff --git a/data/mock/MockShortcuts.qml b/data/mock/MockShortcuts.qml index af1ed81a1..8fecd3cb1 100644 --- a/data/mock/MockShortcuts.qml +++ b/data/mock/MockShortcuts.qml @@ -261,10 +261,12 @@ QtObject { } // Change the system unit - Global.systemSettings.setElectricalQuantity( - Global.systemSettings.electricalQuantity === VenusOS.Units_Watt - ? VenusOS.Units_Amp - : VenusOS.Units_Watt) + Global.systemSettings.setElectricalPowerDisplay( + Global.systemSettings.electricalPowerDisplay === VenusOS.ElectricalPowerDisplay_PreferWatts + ? VenusOS.ElectricalPowerDisplay_PreferAmps + : Global.systemSettings.electricalPowerDisplay === VenusOS.ElectricalPowerDisplay_PreferAmps + ? VenusOS.ElectricalPowerDisplay_Mixed + : VenusOS.ElectricalPowerDisplay_PreferWatts) Global.systemSettings.setTemperatureUnit( Global.systemSettings.temperatureUnit === VenusOS.Units_Temperature_Celsius ? VenusOS.Units_Temperature_Fahrenheit @@ -287,9 +289,9 @@ QtObject { : VenusOS.Units_Speed_KilometresPerHour) pageConfigTitle.text = "Units: " - + (Global.systemSettings.electricalQuantity === VenusOS.Units_Watt - ? "Watts" - : "Amps") + " | " + + (Global.systemSettings.electricalPowerDisplay === VenusOS.ElectricalPowerDisplay_PreferWatts ? "Watts" + : Global.systemSettings.electricalPowerDisplay === VenusOS.ElectricalPowerDisplay_PreferAmps ? "Amps" + : "Mixed") + " | " + (Global.systemSettings.temperatureUnit === VenusOS.Units_Temperature_Celsius ? "Celsius" : "Fahrenheit") + " | " diff --git a/pages/BriefPage.qml b/pages/BriefPage.qml index c76fc849a..191ed6f4d 100644 --- a/pages/BriefPage.qml +++ b/pages/BriefPage.qml @@ -170,8 +170,8 @@ SwipeViewPage { icon.source: Global.acInputs.sourceIcon(Global.acInputs.highlightedInput?.source ?? Global.acInputs.findValidSource()) leftPadding: root._gaugeLabelMargin - root._gaugeArcMargin opacity: root._gaugeLabelOpacity + quantityLabel.sourceType: VenusOS.ElectricalQuantity_Source_AcInputOnly quantityLabel.dataObject: Global.acInputs.highlightedInput - quantityLabel.acInputMode: true } } onStatusChanged: if (status === Loader.Error) console.warn("Unable to load AC input edge") @@ -211,6 +211,7 @@ SwipeViewPage { : VenusOS.dcMeter_iconForMultipleTypes() leftPadding: root._gaugeLabelMargin - root._gaugeArcMargin opacity: root._gaugeLabelOpacity + quantityLabel.sourceType: VenusOS.ElectricalQuantity_Source_Dc quantityLabel.dataObject: Global.dcInputs } @@ -250,6 +251,7 @@ SwipeViewPage { icon.source: "qrc:/images/solaryield.svg" leftPadding: root._gaugeLabelMargin - root._gaugeArcMargin opacity: root._gaugeLabelOpacity + quantityLabel.sourceType: VenusOS.ElectricalQuantity_Source_Any quantityLabel.dataObject: Global.system.solar } } @@ -297,6 +299,7 @@ SwipeViewPage { icon.source: dcLoadGauge.active ? "qrc:/images/acloads.svg" : "qrc:/images/consumption.svg" rightPadding: root._gaugeLabelMargin - root._gaugeArcMargin opacity: root._gaugeLabelOpacity + quantityLabel.sourceType: VenusOS.ElectricalQuantity_Source_Ac quantityLabel.dataObject: Global.system.load.ac } } @@ -330,6 +333,7 @@ SwipeViewPage { icon.source: "qrc:/images/dcloads.svg" rightPadding: root._gaugeLabelMargin - root._gaugeArcMargin opacity: root._gaugeLabelOpacity + quantityLabel.sourceType: VenusOS.ElectricalQuantity_Source_Dc quantityLabel.dataObject: Global.system.dc } diff --git a/pages/BriefSidePanel.qml b/pages/BriefSidePanel.qml index 1b5826a08..183ff5e67 100644 --- a/pages/BriefSidePanel.qml +++ b/pages/BriefSidePanel.qml @@ -40,9 +40,9 @@ ColumnLayout { icon.source: "qrc:/images/generator.svg" loadersActive: generatorInput && generatorInput.operational && Global.generators.model.firstObject visible: loadersActive + quantityLabel.sourceType: VenusOS.ElectricalQuantity_Source_AcInputOnly quantityLabel.dataObject: generatorInput quantityLabel.leftPadding: generatorDirectionIcon.visible ? (generatorDirectionIcon.width + Theme.geometry_acInputDirectionIcon_rightMargin) : 0 - quantityLabel.acInputMode: true sideComponent: Item { width: generatorLabel.width height: generatorLabel.height @@ -83,9 +83,9 @@ ColumnLayout { title: loadersActive ? Global.acInputs.sourceToText(nonGeneratorInput.source) : "" icon.source: loadersActive ? Global.acInputs.sourceIcon(nonGeneratorInput.source) : "" + quantityLabel.sourceType: VenusOS.ElectricalQuantity_Source_AcInputOnly quantityLabel.dataObject: nonGeneratorInput quantityLabel.leftPadding: acInputDirectionIcon.visible ? (acInputDirectionIcon.width + Theme.geometry_acInputDirectionIcon_rightMargin) : 0 - quantityLabel.acInputMode: true loadersActive: nonGeneratorInput && nonGeneratorInput.operational visible: loadersActive @@ -217,6 +217,7 @@ exported power v 0.4 | / : VenusOS.dcMeter_iconForMultipleTypes() loadersActive: Global.dcInputs.model.count > 0 visible: loadersActive + quantityLabel.sourceType: VenusOS.ElectricalQuantity_Source_Dc quantityLabel.dataObject: Global.dcInputs sideComponent: LoadGraph { animationEnabled: root.animationEnabled @@ -256,6 +257,7 @@ exported power v 0.4 | / //% "AC Loads" title: qsTrId("brief_ac_loads") icon.source: "qrc:/images/acloads.svg" + quantityLabel.sourceType: VenusOS.ElectricalQuantity_Source_Ac quantityLabel.dataObject: Global.system.load.ac loadersActive: true sideComponent: LoadGraph { @@ -285,6 +287,7 @@ exported power v 0.4 | / icon.source: "qrc:/images/dcloads.svg" loadersActive: Global.system.dc.hasPower visible: loadersActive + quantityLabel.sourceType: VenusOS.ElectricalQuantity_Source_Dc quantityLabel.dataObject: Global.system.dc sideComponent: LoadGraph { animationEnabled: root.animationEnabled diff --git a/pages/boat/ConsumptionGauge.qml b/pages/boat/ConsumptionGauge.qml index 1e23916e5..b128373b2 100644 --- a/pages/boat/ConsumptionGauge.qml +++ b/pages/boat/ConsumptionGauge.qml @@ -29,11 +29,11 @@ Column { QuantityLabelIconRow { id: motorDriveLoad + sourceType: VenusOS.ElectricalQuantity_Source_Dc + dataObject: root.motorDrive.dcConsumption.scalar font.pixelSize: root._pixelSize - value: root.motorDrive.dcConsumption.scalar.valid ? root.motorDrive.dcConsumption.scalar.value : NaN - unit: root.motorDrive.dcConsumption.scalarUnit icon.source: "qrc:/images/icon_propeller.svg" - visible: root.gps.valid && root.motorDrive.dcConsumption.scalar && root.motorDrive.dcConsumption.scalar.valid + visible: root.gps.valid && !isNaN(value) } QuantityLabelIconRow { @@ -42,8 +42,8 @@ Column { anchors.right: parent.right font.pixelSize: root._pixelSize height: font.pixelSize - value: Global.system.load.ac.preferredQuantity - unit: Global.system.load.ac.preferredUnit + sourceType: VenusOS.ElectricalQuantity_Source_Ac + dataObject: Global.system.load.ac icon.source: "qrc:/images/acloads.svg" icon.width: Theme.geometry_widgetHeader_icon_size visible: !motorDriveLoad.visible // && !isNaN(value) once #2159 is resolved @@ -55,8 +55,8 @@ Column { anchors.right: parent.right font.pixelSize: root._pixelSize height: font.pixelSize - value: Global.system.dc.preferredQuantity - unit: Global.system.dc.preferredUnit + sourceType: VenusOS.ElectricalQuantity_Source_Dc + dataObject: Global.system.dc icon.source: "qrc:/images/dcloads.svg" icon.width: Theme.geometry_widgetHeader_icon_size visible: !motorDriveLoad.visible && !isNaN(value) diff --git a/pages/boat/MotorDrive.qml b/pages/boat/MotorDrive.qml index 37b03d6c1..dea378da8 100644 --- a/pages/boat/MotorDrive.qml +++ b/pages/boat/MotorDrive.qml @@ -12,15 +12,18 @@ QtObject { readonly property string serviceUid: _motorDriveServices.firstUid readonly property QtObject dcConsumption: QtObject { - // we no longer support max current, so any ArcGauges (such as the BoatPage center gauge) always shows power, regardless of Global.systemSettings.electricalQuantity + // we no longer support max current, so any ArcGauges (such as the BoatPage center gauge) + // always shows power, regardless of Global.systemSettings.electricalPowerDisplay readonly property VeQuickItemsQuotient quotient: root.power // we can show current in the consumption gauge - readonly property VeQuickItem scalar: Global.systemSettings.electricalQuantity === VenusOS.Units_Amp ? _scalarCurrent : root.power._numerator - readonly property int scalarUnit: Global.systemSettings.electricalQuantity + readonly property QtObject scalar: QtObject { + readonly property real power: root.power._numerator.value ?? NaN + readonly property real current: _scalarCurrent.value ?? NaN - readonly property VeQuickItem _scalarCurrent: VeQuickItem { - uid: root.serviceUid ? BackendConnection.serviceUidForType("system") + "/MotorDrive/Current" : "" + readonly property VeQuickItem _scalarCurrent: VeQuickItem { + uid: root.serviceUid ? BackendConnection.serviceUidForType("system") + "/MotorDrive/Current" : "" + } } } diff --git a/pages/boat/QuantityLabelIconRow.qml b/pages/boat/QuantityLabelIconRow.qml index feb87ce78..b9a7afb12 100644 --- a/pages/boat/QuantityLabelIconRow.qml +++ b/pages/boat/QuantityLabelIconRow.qml @@ -10,14 +10,15 @@ import QtQuick.Controls.impl as CP Row { id: root + property alias sourceType: label.sourceType + property alias dataObject: label.dataObject property alias value: label.value - property alias unit: label.unit property alias icon: icon property alias font: label.font spacing: Theme.geometry_boatPage_row_spacing - QuantityLabel { + ElectricalQuantityLabel { id: label anchors.verticalCenter: parent.verticalCenter diff --git a/pages/settings/PageSettingsDisplayUnits.qml b/pages/settings/PageSettingsDisplayUnits.qml index 0c8eadfb2..3ab86e966 100644 --- a/pages/settings/PageSettingsDisplayUnits.qml +++ b/pages/settings/PageSettingsDisplayUnits.qml @@ -41,19 +41,21 @@ Page { writeAccessLevel: VenusOS.User_AccessType_User optionModel: [ //% "Power (Watts)" - { display: qsTrId("settings_units_watts"), value: VenusOS.Units_Watt }, + { display: qsTrId("settings_units_watts"), value: VenusOS.ElectricalPowerDisplay_PreferWatts }, { //% "Current (Amps)" display: qsTrId("settings_units_amps"), - value: VenusOS.Units_Amp, + value: VenusOS.ElectricalPowerDisplay_PreferAmps, //% "Note: If current cannot be displayed (for example, when showing a total for combined AC and DC sources) then power will be shown instead." caption: qsTrId("settings_units_amps_exceptions"), }, + //% "Mixed (AC in Watts, DC in Amps)" + { display: qsTrId("settings_units_mixed"), value: VenusOS.ElectricalPowerDisplay_Mixed }, ] - currentIndex: Global.systemSettings.electricalQuantity === VenusOS.Units_Amp ? 1 : 0 + currentIndex: Global.systemSettings.electricalPowerDisplay onOptionClicked: function(index) { - Global.systemSettings.setElectricalQuantity(optionModel[index].value) + Global.systemSettings.setElectricalPowerDisplay(optionModel[index].value) } } diff --git a/src/enums.h b/src/enums.h index 0cc864fee..f6f65c1a3 100644 --- a/src/enums.h +++ b/src/enums.h @@ -911,6 +911,21 @@ class Enums : public QObject }; Q_ENUM(MicrogridMode) + enum ElectricalPowerDisplay { + ElectricalPowerDisplay_PreferWatts, + ElectricalPowerDisplay_PreferAmps, + ElectricalPowerDisplay_Mixed, + }; + Q_ENUM(ElectricalPowerDisplay) + + enum ElectricalQuantity_Source { + ElectricalQuantity_Source_Any, + ElectricalQuantity_Source_Ac, + ElectricalQuantity_Source_AcInputOnly, + ElectricalQuantity_Source_Dc, + }; + Q_ENUM(ElectricalQuantity_Source) + Q_INVOKABLE QString battery_modeToText(Battery_Mode mode) const; Q_INVOKABLE Battery_Mode battery_modeFromPower(qreal power) const; Q_INVOKABLE QString battery_iconFromMode(Battery_Mode mode) const;