FlightModesComponentSummary.qml 2.44 KB
Newer Older
1 2
import QtQuick          2.3
import QtQuick.Controls 1.2
3

Don Gagne's avatar
Don Gagne committed
4 5 6 7 8
import QGroundControl.FactSystem    1.0
import QGroundControl.FactControls  1.0
import QGroundControl.Controls      1.0
import QGroundControl.Palette       1.0
import QGroundControl.ScreenTools   1.0
9

10
Item {
11
    anchors.fill:   parent
12

13
    FactPanelController { id: controller; }
Don Gagne's avatar
Don Gagne committed
14

Don Gagne's avatar
Don Gagne committed
15 16 17
    property Fact _nullFact
    property Fact _rcMapFltmode:    controller.parameterExists(-1, "RC_MAP_FLTMODE") ? controller.getParameterFact(-1, "RC_MAP_FLTMODE") : _nullFact
    property Fact _rcMapModeSw:     controller.getParameterFact(-1, "RC_MAP_MODE_SW")
18
    property bool _simpleMode:      _rcMapFltmode.value > 0 || _rcMapModeSw.value === 0
19

Don Gagne's avatar
Don Gagne committed
20
    Loader {
21
        anchors.fill:       parent
Don Gagne's avatar
Don Gagne committed
22 23
        sourceComponent:    _simpleMode ? simple : advanced
    }
24

Don Gagne's avatar
Don Gagne committed
25 26 27 28
    Component {
        id: simple
        Column {
            VehicleSummaryRow {
29
                labelText: qsTr("Mode switch")
30
                valueText: _rcMapFltmode.value === 0 ? qsTr("Setup required") : _rcMapFltmode.enumStringValue
Don Gagne's avatar
Don Gagne committed
31 32 33 34
            }
            Repeater {
                model: 6
                VehicleSummaryRow {
35
                    labelText: qsTr("Flight Mode %1 ").arg(index + 1)
Don Gagne's avatar
Don Gagne committed
36 37 38
                    valueText: controller.getParameterFact(-1, "COM_FLTMODE" + (index + 1)).enumStringValue
                }
            }
39
        }
Don Gagne's avatar
Don Gagne committed
40 41 42 43 44 45 46 47 48
    }

    Component {
        id: advanced
        Column {
            property Fact posCtlSwFact: controller.getParameterFact(-1, "RC_MAP_POSCTL_SW")
            property Fact loiterSwFact: controller.getParameterFact(-1, "RC_MAP_LOITER_SW")
            property Fact returnSwFact: controller.getParameterFact(-1, "RC_MAP_RETURN_SW")
            VehicleSummaryRow {
49
                labelText: qsTr("Mode switch")
50
                valueText: _rcMapModeSw.value === 0 ? qsTr("Setup required") : _rcMapModeSw.valueString
Don Gagne's avatar
Don Gagne committed
51 52
            }
            VehicleSummaryRow {
53
                labelText: qsTr("Position Ctl switch")
54
                valueText: posCtlSwFact.value === 0 ? qsTr("Disabled") : posCtlSwFact.valueString
Don Gagne's avatar
Don Gagne committed
55 56
            }
            VehicleSummaryRow {
57
                labelText: qsTr("Loiter switch")
58
                valueText: loiterSwFact.value === 0 ? qsTr("Disabled") : loiterSwFact.valueString
Don Gagne's avatar
Don Gagne committed
59 60
            }
            VehicleSummaryRow {
61
                labelText: qsTr("Return switch")
62
                valueText: returnSwFact.value === 0 ? qsTr("Disabled") : returnSwFact.valueString
Don Gagne's avatar
Don Gagne committed
63
            }
64
        }
65 66
    }
}