APMPowerComponentSummary.qml 2.45 KB
Newer Older
1 2 3 4 5 6 7 8
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
Don Gagne's avatar
Don Gagne committed
9

10 11
import QtQuick          2.3
import QtQuick.Controls 1.2
Don Gagne's avatar
Don Gagne committed
12 13 14 15 16 17 18

import QGroundControl.FactSystem    1.0
import QGroundControl.FactControls  1.0
import QGroundControl.Controls      1.0
import QGroundControl.Palette       1.0

FactPanel {
19 20 21
    id:             panel
    anchors.fill:   parent
    color:          qgcPal.windowShadeDark
Don Gagne's avatar
Don Gagne committed
22 23 24 25

    QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
    FactPanelController { id: controller; factPanel: panel }

26 27
    property Fact _batt1Monitor:            controller.getParameterFact(-1, "BATT_MONITOR")
    property Fact _batt2Monitor:            controller.getParameterFact(-1, "BATT2_MONITOR", false /* reportMissing */)
28
    property bool _batt2MonitorAvailable:   controller.parameterExists(-1, "BATT2_MONITOR")
29 30
    property bool _batt1MonitorEnabled:     _batt1Monitor.rawValue !== 0
    property bool _batt2MonitorEnabled:     _batt2MonitorAvailable && _batt2Monitor.rawValue !== 0
31

32
    property Fact _battCapacity:            controller.getParameterFact(-1, "BATT_CAPACITY", false /* reportMissing */)
33
    property Fact _batt2Capacity:           controller.getParameterFact(-1, "BATT2_CAPACITY", false /* reportMissing */)
34
    property bool _battCapacityAvailable:   controller.parameterExists(-1, "BATT_CAPACITY")
Don Gagne's avatar
Don Gagne committed
35

36 37
    Column {
        anchors.fill:       parent
Don Gagne's avatar
Don Gagne committed
38

39
        VehicleSummaryRow {
40 41
            labelText: qsTr("Batt1 monitor")
            valueText: _batt1Monitor.enumStringValue
42
        }
Don Gagne's avatar
Don Gagne committed
43

44
        VehicleSummaryRow {
45 46 47
            labelText: qsTr("Batt1 capacity")
            valueText:  _batt1MonitorEnabled ? _battCapacity.valueString + " " + _battCapacity.units : ""
            visible:    _batt1MonitorEnabled
48 49 50
        }

        VehicleSummaryRow {
51
            labelText:  qsTr("Batt2 monitor")
52 53 54 55 56
            valueText:  _batt2MonitorAvailable ? _batt2Monitor.enumStringValue : ""
            visible:    _batt2MonitorAvailable
        }

        VehicleSummaryRow {
57 58 59
            labelText:  qsTr("Batt2 capacity")
            valueText:  _batt2MonitorEnabled ? _batt2Capacity.valueString + " " + _batt2Capacity.units : ""
            visible:    _batt2MonitorEnabled
60
        }
Don Gagne's avatar
Don Gagne committed
61 62
    }
}