MultiVehicleList.qml 6.75 KB
Newer Older
1 2
/****************************************************************************
 *
Gus Grubba's avatar
Gus Grubba committed
3
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8 9
 *
 * 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
Item {
22 23 24 25 26
    property real   _margin:            ScreenTools.defaultFontPixelWidth / 2
    property real   _widgetHeight:      ScreenTools.defaultFontPixelHeight * 3
    property color  _textColor:         "black"
    property real   _rectOpacity:       0.8
    property var    _guidedController:  mainWindow.guidedControllerFlyView
27

28
    QGCPalette { id: qgcPal }
29

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

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

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

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

            Row {
61
                spacing:            _margin
62 63

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

                QGCButton {
Gus Grubba's avatar
Gus Grubba committed
69
                    text:       "Start Mission"
70
                    onClicked:  _guidedController.confirmAction(_guidedController.actionMVStartMission)
71 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

    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 {
109
                    Layout.fillWidth:       true
110 111 112

                    QGCLabel {
                        Layout.alignment:   Qt.AlignTop
Gus Grubba's avatar
Gus Grubba committed
113
                        text:               _vehicle ? _vehicle.id : ""
114 115 116 117 118 119 120 121
                        color:              _textColor
                    }

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

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

                        QGCLabel {
129
                            Layout.alignment:           Qt.AlignHCenter
Gus Grubba's avatar
Gus Grubba committed
130
                            text:                       _vehicle && _vehicle.armed ? qsTr("Armed") : qsTr("Disarmed")
131 132 133 134 135 136
                            color:                      _textColor
                        }
                    }

                    QGCCompassWidget {
                        size:       _widgetHeight
137
                        usedByMultipleVehicleList: true
138 139 140 141 142 143 144 145 146 147 148 149 150 151
                        vehicle:    _vehicle
                    }

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

                Row {
                    spacing: ScreenTools.defaultFontPixelWidth

                    QGCButton {
                        text:       "Arm"
Gus Grubba's avatar
Gus Grubba committed
152
                        visible:    _vehicle && !_vehicle.armed
153 154 155 156 157
                        onClicked:  _vehicle.armed = true
                    }

                    QGCButton {
                        text:       "Start Mission"
Gus Grubba's avatar
Gus Grubba committed
158
                        visible:    _vehicle && _vehicle.armed && _vehicle.flightMode !== _vehicle.missionFlightMode
159 160 161 162 163
                        onClicked:  _vehicle.startMission()
                    }

                    QGCButton {
                        text:       "Pause"
Gus Grubba's avatar
Gus Grubba committed
164
                        visible:    _vehicle && _vehicle.armed && _vehicle.pauseVehicleSupported
165 166 167 168 169
                        onClicked:  _vehicle.pauseVehicle()
                    }

                    QGCButton {
                        text:       "RTL"
Gus Grubba's avatar
Gus Grubba committed
170
                        visible:    _vehicle && _vehicle.armed && _vehicle.flightMode !== _vehicle.rtlFlightMode
171 172 173 174 175
                        onClicked:  _vehicle.flightMode = _vehicle.rtlFlightMode
                    }

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