MissionSettingsEditor.qml 9.85 KB
Newer Older
1
import QtQuick          2.7
2
import QtQuick.Controls 1.4
3
import QtQuick.Layouts  1.3
4

5 6 7 8 9 10 11
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
import QGroundControl.SettingsManager   1.0
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 40

// 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
41
                property bool   _multipleFirmware:          QGroundControl.supportedFirmwareCount > 2
42
                property real   _fieldWidth:                ScreenTools.defaultFontPixelWidth * 16
43 44 45 46 47 48 49 50 51 52 53 54 55

                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

56
                    QGCLabel { text: qsTr("Planned Home Position") }
57 58 59 60 61 62 63 64 65 66

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

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

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

Gus Grubba's avatar
Gus Grubba committed
94
                    QGCLabel {
95
                        text:           qsTr("Vehicle Info")
Gus Grubba's avatar
Gus Grubba committed
96 97
                        visible:        _multipleFirmware
                    }
98 99 100 101 102 103

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

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

                        QGCLabel {
                            text:       _firmwareLabel
                            visible:    _showOfflineEditingCombos
118
                            Layout.fillWidth: true
119 120
                        }
                        FactComboBox {
121
                            fact:               QGroundControl.settingsManager.appSettings.offlineEditingFirmwareType
122 123
                            indexModel:         false
                            visible:            _showOfflineEditingCombos
124
                            Layout.preferredWidth:  _fieldWidth
125 126 127 128 129
                        }

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

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

                        QGCLabel {
                            text:       _vehicleLabel
                            visible:    !_showOfflineEditingCombos
154
                            Layout.fillWidth: true
155 156 157 158
                        }
                        QGCLabel {
                            text:       _missionVehicle.vehicleTypeString
                            visible:    !_showOfflineEditingCombos
159
                            Layout.preferredWidth:  _fieldWidth
160
                        }
161

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

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

187 188 189 190 191 192 193 194
                    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
195
                            fact:       QGroundControl.settingsManager.appSettings.offlineEditingHoverSpeed
196 197 198
                        }
                    }

199 200 201 202
                    QGCLabel {
                        width:          parent.width
                        wrapMode:       Text.WordWrap
                        font.pointSize: ScreenTools.smallFontPointSize
203 204
                        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
205 206 207 208 209 210 211
                    }

                    Rectangle {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        height:         1
                        color:          qgcPal.text
212
                    }
Gus Grubba's avatar
Gus Grubba committed
213 214

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

221 222 223 224 225
                } // Column
            } // Item
        } // Component
    } // Loader
} // Rectangle