MissionSettingsEditor.qml 10 KB
Newer Older
1 2 3 4
import QtQuick          2.5
import QtQuick.Controls 1.2
import QtQuick.Layouts  1.2

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

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

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

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

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

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

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

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

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

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

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

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

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

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

191 192 193 194 195 196 197 198
                    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
199
                            fact:       QGroundControl.settingsManager.appSettings.offlineEditingHoverSpeed
200 201 202
                        }
                    }

203 204 205 206
                    QGCLabel {
                        width:          parent.width
                        wrapMode:       Text.WordWrap
                        font.pointSize: ScreenTools.smallFontPointSize
207 208
                        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
209 210 211 212 213 214 215
                    }

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

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

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