MultiVehicleList.qml 6.58 KB
Newer Older
1 2 3 4 5 6 7 8 9
/****************************************************************************
 *
 *   (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.
 *
 ****************************************************************************/

10 11 12
import QtQuick          2.3
import QtQuick.Controls 1.2
import QtQuick.Layouts  1.2
13 14 15 16 17 18 19 20

import QGroundControl               1.0
import QGroundControl.ScreenTools   1.0
import QGroundControl.Controls      1.0
import QGroundControl.Palette       1.0
import QGroundControl.Vehicle       1.0
import QGroundControl.FlightMap     1.0

21 22
Item {
    property var guidedActionsController
23

24 25 26 27
    property real   _margin:        ScreenTools.defaultFontPixelWidth / 2
    property real   _widgetHeight:  ScreenTools.defaultFontPixelHeight * 3
    property color  _textColor:     "black"
    property real   _rectOpacity:   0.8
28

29
    QGCPalette { id: qgcPal }
30

31
    Rectangle {
32 33 34 35 36 37 38
        id:             mvCommands
        anchors.left:   parent.left
        anchors.right:  parent.right
        height:         mvCommandsColumn.height + (_margin *2)
        color:          qgcPal.missionItemEditor
        opacity:        _rectOpacity
        radius:         _margin
39

40 41 42 43
        DeadMouseArea {
            anchors.fill: parent
        }

44
        Column {
45
            id:                 mvCommandsColumn
46
            anchors.margins:    _margin
47
            anchors.top:        parent.top
48 49 50 51
            anchors.left:       parent.left
            anchors.right:      parent.right
            spacing:            _margin

52
            QGCLabel {
53 54
                anchors.left:   parent.left
                anchors.right:  parent.right
55 56 57 58
                text:           qsTr("The following commands will be applied to all vehicles")
                color:          _textColor
                wrapMode:       Text.WordWrap
                font.pointSize: ScreenTools.smallFontPointSize
59 60 61
            }

            Row {
62
                spacing:            _margin
63 64

                QGCButton {
65 66
                    text:       "Pause"
                    onClicked:  guidedActionsController.confirmAction(guidedActionsController.actionMVPause)
67 68 69
                }

                QGCButton {
70 71
                    text:       "Start Mision"
                    onClicked:  guidedActionsController.confirmAction(guidedActionsController.actionMVStartMission)
72 73 74 75
                }
            }
        }
    }
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109

    QGCListView {
        id:                 missionItemEditorListView
        anchors.left:       parent.left
        anchors.right:      parent.right
        anchors.topMargin:  _margin
        anchors.top:        mvCommands.bottom
        anchors.bottom:     parent.bottom
        spacing:            ScreenTools.defaultFontPixelHeight / 2
        orientation:        ListView.Vertical
        model:              QGroundControl.multiVehicleManager.vehicles
        cacheBuffer:        _cacheBuffer < 0 ? 0 : _cacheBuffer
        clip:               true

        property real _cacheBuffer:     height * 2

        delegate: Rectangle {
            width:      parent.width
            height:     innerColumn.y + innerColumn.height + _margin
            color:      qgcPal.missionItemEditor
            opacity:    _rectOpacity
            radius:     _margin

            property var    _vehicle:   object

            ColumnLayout {
                id:                 innerColumn
                anchors.margins:    _margin
                anchors.top:        parent.top
                anchors.left:       parent.left
                anchors.right:      parent.left
                spacing:            _margin

                RowLayout {
110
                    Layout.fillWidth:       true
111 112 113 114 115 116 117 118 119 120 121 122

                    QGCLabel {
                        Layout.alignment:   Qt.AlignTop
                        text:               _vehicle.id
                        color:              _textColor
                    }

                    ColumnLayout {
                        Layout.alignment:   Qt.AlignCenter
                        spacing:            _margin

                        FlightModeMenu {
123
                            Layout.alignment:           Qt.AlignHCenter
124 125 126 127 128 129
                            font.pointSize:             ScreenTools.largeFontPointSize
                            color:                      _textColor
                            activeVehicle:              _vehicle
                        }

                        QGCLabel {
130
                            Layout.alignment:           Qt.AlignHCenter
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
                            text:                       _vehicle.armed ? qsTr("Armed") : qsTr("Disarmed")
                            color:                      _textColor
                        }
                    }

                    QGCCompassWidget {
                        size:       _widgetHeight
                        vehicle:    _vehicle
                    }

                    QGCAttitudeWidget {
                        size:       _widgetHeight
                        vehicle:    _vehicle
                    }
                } // RowLayout

                Row {
                    spacing: ScreenTools.defaultFontPixelWidth

                    QGCButton {
                        text:       "Arm"
                        visible:    !_vehicle.armed
                        onClicked:  _vehicle.armed = true
                    }

                    QGCButton {
                        text:       "Start Mission"
158
                        visible:    _vehicle.armed && _vehicle.flightMode !== _vehicle.missionFlightMode
159 160 161 162 163 164 165 166 167 168 169
                        onClicked:  _vehicle.startMission()
                    }

                    QGCButton {
                        text:       "Pause"
                        visible:    _vehicle.armed && _vehicle.pauseVehicleSupported
                        onClicked:  _vehicle.pauseVehicle()
                    }

                    QGCButton {
                        text:       "RTL"
170
                        visible:    _vehicle.armed && _vehicle.flightMode !== _vehicle.rtlFlightMode
171 172 173 174 175
                        onClicked:  _vehicle.flightMode = _vehicle.rtlFlightMode
                    }

                    QGCButton {
                        text:       "Take control"
176
                        visible:    _vehicle.armed && _vehicle.flightMode !== _vehicle.takeControlFlightMode
177 178 179 180 181 182 183
                        onClicked:  _vehicle.flightMode = _vehicle.takeControlFlightMode
                    }
                } // Row
            } // ColumnLayout
        } // delegate - Rectangle
    } // QGCListView
} // Item