MissionSettingsEditor.qml 9.81 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
import QtQuick          2.5
import QtQuick.Controls 1.2
import QtQuick.Layouts  1.2

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

// Editor for Mission Settings
Rectangle {
    id:                 valuesRect
    width:              availableWidth
    height:             deferedload.status == Loader.Ready ? (visible ? deferedload.item.height : 0) : 0
    color:              qgcPal.windowShadeDark
    visible:            missionItem.isCurrentItem
    radius:             _radius

    Loader {
        id:              deferedload
        active:          valuesRect.visible
        asynchronous:    true
        anchors.margins: _margin
        anchors.left:    valuesRect.left
        anchors.right:   valuesRect.right
        anchors.top:     valuesRect.top

        sourceComponent: Component {
            Item {
                id:                 valuesItem
                height:             valuesColumn.height + (_margin * 2)

                property var    _missionVehicle:            missionController.vehicle
                property bool   _offlineEditing:            _missionVehicle.isOfflineEditingVehicle
                property bool   _showOfflineEditingCombos:  _offlineEditing && _noMissionItemsAdded
                property bool   _showCruiseSpeed:           !_missionVehicle.multiRotor
                property bool   _showHoverSpeed:            _missionVehicle.multiRotor || missionController.vehicle.vtol
Gus Grubba's avatar
Gus Grubba committed
40
                property bool   _multipleFirmware:          QGroundControl.supportedFirmwareCount > 2
41
                property real   _fieldWidth:                ScreenTools.defaultFontPixelWidth * 16
42 43 44 45 46 47 48 49 50 51 52 53 54

                readonly property string _firmwareLabel:    qsTr("Firmware:")
                readonly property string _vehicleLabel:     qsTr("Vehicle:")

                QGCPalette { id: qgcPal }

                Column {
                    id:             valuesColumn
                    anchors.left:   parent.left
                    anchors.right:  parent.right
                    anchors.top:    parent.top
                    spacing:        _margin

Gus Grubba's avatar
Gus Grubba committed
55 56
                    QGCLabel {
                        text: qsTr("Planned Home Position")
57
                        color: qgcPal.buttonHighlight
Gus Grubba's avatar
Gus Grubba committed
58
                    }
59 60 61 62 63 64 65 66 67 68

                    Rectangle {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        height:         1
                        color:          qgcPal.text
                    }

                    Repeater {
                        model: missionItem.textFieldFacts
69 70 71 72 73
                        RowLayout {
                            anchors.left:   parent.left
                            anchors.right:  parent.right
                            spacing:        _margin
                            QGCLabel { text: object.name; Layout.fillWidth: true }
74
                            FactTextField {
75 76 77 78
                                Layout.preferredWidth:  _fieldWidth
                                showUnits:  true
                                fact:       object
                                visible:    !_root.readOnly
79 80
                            }
                            FactLabel {
81 82 83
                                Layout.preferredWidth:  _fieldWidth
                                fact:       object
                                visible:    _root.readOnly
84 85 86 87 88 89 90 91
                            }
                        }
                    }

                    QGCLabel {
                        width:          parent.width
                        wrapMode:       Text.WordWrap
                        font.pointSize: ScreenTools.smallFontPointSize
Gus Grubba's avatar
Gus Grubba committed
92 93
                        text:           qsTr("Actual position set by vehicle at flight time.")
                        horizontalAlignment: Text.AlignHCenter
94 95
                    }

Gus Grubba's avatar
Gus Grubba committed
96
                    QGCLabel {
97 98
                        text:           qsTr("Vehicle Info")
                        color:          qgcPal.buttonHighlight
Gus Grubba's avatar
Gus Grubba committed
99 100
                        visible:        _multipleFirmware
                    }
101 102 103 104 105 106

                    Rectangle {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        height:         1
                        color:          qgcPal.text
Gus Grubba's avatar
Gus Grubba committed
107
                        visible:        _multipleFirmware
108 109 110 111 112 113 114 115
                    }

                    GridLayout {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        columnSpacing:  ScreenTools.defaultFontPixelWidth
                        rowSpacing:     columnSpacing
                        columns:        2
Gus Grubba's avatar
Gus Grubba committed
116
                        visible:        _multipleFirmware
117 118 119 120

                        QGCLabel {
                            text:       _firmwareLabel
                            visible:    _showOfflineEditingCombos
121
                            Layout.fillWidth: true
122 123 124 125 126
                        }
                        FactComboBox {
                            fact:               QGroundControl.offlineEditingFirmwareType
                            indexModel:         false
                            visible:            _showOfflineEditingCombos
127
                            Layout.preferredWidth:  _fieldWidth
128 129 130 131 132
                        }

                        QGCLabel {
                            text:       _firmwareLabel
                            visible:    !_showOfflineEditingCombos
133
                            Layout.fillWidth: true
134 135 136 137
                        }
                        QGCLabel {
                            text:       _missionVehicle.firmwareTypeString
                            visible:    !_showOfflineEditingCombos
138
                            Layout.preferredWidth:  _fieldWidth
139 140 141 142 143
                        }

                        QGCLabel {
                            text:       _vehicleLabel
                            visible:    _showOfflineEditingCombos
144
                            Layout.fillWidth: true
145 146 147 148 149 150
                        }
                        FactComboBox {
                            id:                 offlineVehicleCombo
                            fact:               QGroundControl.offlineEditingVehicleType
                            indexModel:         false
                            visible:            _showOfflineEditingCombos
151
                            Layout.preferredWidth:  _fieldWidth
152 153 154 155 156
                        }

                        QGCLabel {
                            text:       _vehicleLabel
                            visible:    !_showOfflineEditingCombos
157
                            Layout.fillWidth: true
158 159 160 161
                        }
                        QGCLabel {
                            text:       _missionVehicle.vehicleTypeString
                            visible:    !_showOfflineEditingCombos
162
                            Layout.preferredWidth:  _fieldWidth
163
                        }
164

165 166 167 168
                        QGCLabel {
                            Layout.row: 2
                            text:       qsTr("Cruise speed:")
                            visible:    _showCruiseSpeed
169
                            Layout.fillWidth: true
170 171 172 173
                        }
                        FactTextField {
                            fact:               QGroundControl.offlineEditingCruiseSpeed
                            visible:            _showCruiseSpeed
174
                            Layout.preferredWidth:  _fieldWidth
175 176 177 178 179 180
                        }

                        QGCLabel {
                            Layout.row: 3
                            text:       qsTr("Hover speed:")
                            visible:    _showHoverSpeed
181
                            Layout.fillWidth: true
182 183 184 185
                        }
                        FactTextField {
                            fact:               QGroundControl.offlineEditingHoverSpeed
                            visible:            _showHoverSpeed
186
                            Layout.preferredWidth:  _fieldWidth
187 188 189
                        }
                    } // GridLayout

190 191 192 193 194 195 196 197 198 199 200 201
                    RowLayout {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        spacing:        _margin
                        visible:        !_multipleFirmware
                        QGCLabel { text: qsTr("Hover speed:"); Layout.fillWidth: true }
                        FactTextField {
                            Layout.preferredWidth:  _fieldWidth
                            fact:       QGroundControl.offlineEditingHoverSpeed
                        }
                    }

202 203 204 205
                    QGCLabel {
                        width:          parent.width
                        wrapMode:       Text.WordWrap
                        font.pointSize: ScreenTools.smallFontPointSize
206 207
                        text:           qsTr("Speeds are only used for time calculations. Actual vehicle speed will not be affected.")
                        horizontalAlignment: Text.AlignHCenter
Gus Grubba's avatar
Gus Grubba committed
208 209 210 211 212 213 214
                    }

                    Rectangle {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        height:         1
                        color:          qgcPal.text
215
                    }
Gus Grubba's avatar
Gus Grubba committed
216 217

                    QGCButton {
218
                        width:      parent.width * 0.9
Gus Grubba's avatar
Gus Grubba committed
219 220 221 222 223
                        text:       qsTr("Set Home To Map Center")
                        onClicked:  editorRoot.moveHomeToMapCenter()
                        anchors.horizontalCenter: parent.horizontalCenter
                    }

224 225 226 227 228
                } // Column
            } // Item
        } // Component
    } // Loader
} // Rectangle