6import QGroundControl.FactControls
7import QGroundControl.Controls
10 implicitWidth: mainLayout.implicitWidth
11 implicitHeight: mainLayout.implicitHeight
12 width: parent.width // grows when Loader is wider than implicitWidth
14 property string _naString: qsTr("N/A")
16 FactPanelController { id: controller; }
18 property int _indexedBatteryParamCount: {
20 while (controller.parameterExists(-1, "BAT" + batteryIndex + "_SOURCE")) {
23 return batteryIndex - 1
32 model: _indexedBatteryParamCount
35 Layout.fillWidth: true
36 sourceComponent: batterySummaryComponent
38 property int batteryIndex: index + 1
39 property bool showBatteryIndex: _indexedBatteryParamCount > 1
45 id: batterySummaryComponent
51 property var _controller: controller
52 property int _batteryIndex: batteryIndex
56 controller: _controller
57 batteryIndex: _batteryIndex
61 labelText: showBatteryIndex ? qsTr("Battery %1 Source").arg(batteryIndex) : qsTr("Battery Source")
62 valueText: battParams.battSource.enumStringValue
66 labelText: showBatteryIndex ? qsTr("Battery %1 Full").arg(batteryIndex) : qsTr("Battery Full")
67 valueText: battParams.battHighVoltAvailable ? battParams.battHighVolt.valueString + " " + battParams.battHighVolt.units : _naString
71 labelText: showBatteryIndex ? qsTr("Battery %1 Empty").arg(batteryIndex) : qsTr("Battery Empty")
72 valueText: battParams.battLowVoltAvailable ? battParams.battLowVolt.valueString + " " + battParams.battLowVolt.units : _naString
76 labelText: showBatteryIndex ? qsTr("Battery %1 Number of Cells").arg(batteryIndex) : qsTr("Number of Cells")
77 valueText: battParams.battNumCellsAvailable ? battParams.battNumCells.valueString : _naString