MissionSettingsEditor.qml 10.7 KB
Newer Older
1 2 3
import QtQuick          2.3
import QtQuick.Controls 1.2
import QtQuick.Layouts  1.2
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

// 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
37
                property bool   _vehicleHasHomePosition:    _missionVehicle.homePosition.isValid
38
                property bool   _offlineEditing:            _missionVehicle.isOfflineEditingVehicle
39
                property bool   _showOfflineVehicleCombos:  _offlineEditing && _multipleFirmware && _noMissionItemsAdded
40
                property bool   _showCruiseSpeed:           !_missionVehicle.multiRotor
41
                property bool   _showHoverSpeed:            _missionVehicle.multiRotor || _missionVehicle.vtol
Gus Grubba's avatar
Gus Grubba committed
42
                property bool   _multipleFirmware:          QGroundControl.supportedFirmwareCount > 2
43
                property real   _fieldWidth:                ScreenTools.defaultFontPixelWidth * 16
44
                property bool   _mobile:                    ScreenTools.isMobile
45

46 47
                readonly property string _firmwareLabel:    qsTr("Firmware")
                readonly property string _vehicleLabel:     qsTr("Vehicle")
48 49 50 51 52 53 54 55 56 57

                QGCPalette { id: qgcPal }

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

58 59 60 61
                    SectionHeader {
                        id:             plannedHomePositionSection
                        text:           qsTr("Planned Home Position")
                        showSpacer:     false
62
                        visible:        !_vehicleHasHomePosition
63
                    }
64

65 66 67 68
                    Column {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        spacing:        _margin
69
                        visible:        plannedHomePositionSection.checked && !_vehicleHasHomePosition
70 71

                        GridLayout {
72 73
                            anchors.left:   parent.left
                            anchors.right:  parent.right
74 75 76
                            columnSpacing:  ScreenTools.defaultFontPixelWidth
                            rowSpacing:     columnSpacing
                            columns:        2
77

78 79 80 81 82 83 84 85
                            QGCLabel {
                                text: qsTr("Altitude")
                            }
                            FactTextField {
                                fact:               missionItem.plannedHomePositionAltitude
                                Layout.fillWidth:   true
                            }
                        }
86

87 88 89 90 91 92 93
                        QGCLabel {
                            width:                  parent.width
                            wrapMode:               Text.WordWrap
                            font.pointSize:         ScreenTools.smallFontPointSize
                            text:                   qsTr("Actual position set by vehicle at flight time.")
                            horizontalAlignment:    Text.AlignHCenter
                        }
94

95 96 97 98 99
                        QGCButton {
                            text:                       qsTr("Set Home To Map Center")
                            onClicked:                  missionItem.coordinate = map.center
                            anchors.horizontalCenter:   parent.horizontalCenter
                        }
Gus Grubba's avatar
Gus Grubba committed
100
                    }
101

102
                    SectionHeader {
103
                        id:             vehicleInfoSectionHeader
104
                        text:           qsTr("Vehicle Info")
105
                        visible:        _offlineEditing
106
                        checked:        false
107 108 109 110 111 112 113 114
                    }

                    GridLayout {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        columnSpacing:  ScreenTools.defaultFontPixelWidth
                        rowSpacing:     columnSpacing
                        columns:        2
115
                        visible:        vehicleInfoSectionHeader.visible && vehicleInfoSectionHeader.checked
116 117

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

                        QGCLabel {
130 131
                            text:               _vehicleLabel
                            Layout.fillWidth:   true
132
                            visible:            _showOfflineVehicleCombos
133 134
                        }
                        FactComboBox {
135 136
                            fact:                   QGroundControl.settingsManager.appSettings.offlineEditingVehicleType
                            indexModel:             false
137
                            Layout.preferredWidth:  _fieldWidth
138
                            visible:                _showOfflineVehicleCombos
139 140 141
                        }

                        QGCLabel {
142 143 144
                            text:               qsTr("Cruise speed")
                            visible:            _showCruiseSpeed
                            Layout.fillWidth:   true
145 146
                        }
                        FactTextField {
147 148
                            fact:                   QGroundControl.settingsManager.appSettings.offlineEditingCruiseSpeed
                            visible:                _showCruiseSpeed
149
                            Layout.preferredWidth:  _fieldWidth
150 151 152
                        }

                        QGCLabel {
153 154 155
                            text:               qsTr("Hover speed")
                            visible:            _showHoverSpeed
                            Layout.fillWidth:   true
156 157
                        }
                        FactTextField {
158 159
                            fact:                   QGroundControl.settingsManager.appSettings.offlineEditingHoverSpeed
                            visible:                _showHoverSpeed
160
                            Layout.preferredWidth:  _fieldWidth
161 162 163
                        }
                    } // GridLayout

164 165 166
                    SectionHeader {
                        id:             missionDefaultsSectionHeader
                        text:           qsTr("Mission Defaults")
167
                        checked:        true
168 169 170
                    }

                    Column {
171 172 173
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        spacing:        _margin
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
                        visible:        missionDefaultsSectionHeader.checked

                        GridLayout {
                            anchors.left:   parent.left
                            anchors.right:  parent.right
                            columnSpacing:  ScreenTools.defaultFontPixelWidth
                            rowSpacing:     columnSpacing
                            columns:        2

                            QGCLabel {
                                text:       qsTr("Altitude")
                            }
                            FactTextField {
                                fact:               QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude
                                Layout.fillWidth:   true
                            }

                            QGCCheckBox {
                                id:         flightSpeedCheckBox
                                text:       qsTr("Flight speed")
                                visible:    !_missionVehicle.vtol
                                checked:    missionItem.specifyMissionFlightSpeed
                                onClicked:  missionItem.specifyMissionFlightSpeed = checked
                            }
                            FactTextField {
                                Layout.fillWidth:   true
                                fact:               missionItem.missionFlightSpeed
                                visible:            flightSpeedCheckBox.visible
                                enabled:            flightSpeedCheckBox.checked
                            }
                        } // GridLayout

                        FactComboBox {
                            anchors.left:   parent.left
                            anchors.right:  parent.right
                            fact:           missionItem.missionEndAction
                            indexModel:     false
                        }
                    }

214 215
                    CameraSection {
                        checked: missionItem.cameraSection.settingsSpecified
216 217
                    }

218
                    QGCLabel {
219 220 221 222 223 224
                        width:                  parent.width
                        wrapMode:               Text.WordWrap
                        font.pointSize:         ScreenTools.smallFontPointSize
                        text:                   qsTr("Speeds are only used for time calculations. Actual vehicle speed will not be affected.")
                        horizontalAlignment:    Text.AlignHCenter
                        visible:                _offlineEditing && _missionVehicle.vtol
Gus Grubba's avatar
Gus Grubba committed
225
                    }
226 227 228 229 230
                } // Column
            } // Item
        } // Component
    } // Loader
} // Rectangle