MissionSettingsEditor.qml 11 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 37 38 39

// 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
40
                property bool   _showHoverSpeed:            _missionVehicle.multiRotor || _missionVehicle.vtol
Gus Grubba's avatar
Gus Grubba committed
41
                property bool   _multipleFirmware:          QGroundControl.supportedFirmwareCount > 2
42
                property real   _fieldWidth:                ScreenTools.defaultFontPixelWidth * 16
43
                property bool   _mobile:                    ScreenTools.isMobile
44

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

                QGCPalette { id: qgcPal }

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

57 58 59 60 61
                    SectionHeader {
                        id:             plannedHomePositionSection
                        text:           qsTr("Planned Home Position")
                        showSpacer:     false
                    }
62

63 64 65 66 67 68 69
                    Column {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        spacing:        _margin
                        visible:        plannedHomePositionSection.checked

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

76 77 78
                            QGCLabel {
                                text: qsTr("Latitude")
                            }
79
                            FactTextField {
80 81
                                fact:               missionItem.plannedHomePositionLatitude
                                Layout.fillWidth:   true
82
                            }
83 84 85 86 87 88 89

                            QGCLabel {
                                text: qsTr("Longitude")
                            }
                            FactTextField {
                                fact:               missionItem.plannedHomePositionLongitude
                                Layout.fillWidth:   true
90 91
                            }

92 93 94 95 96 97 98 99
                            QGCLabel {
                                text: qsTr("Altitude")
                            }
                            FactTextField {
                                fact:               missionItem.plannedHomePositionAltitude
                                Layout.fillWidth:   true
                            }
                        }
100

101 102 103 104 105 106 107
                        QGCLabel {
                            width:                  parent.width
                            wrapMode:               Text.WordWrap
                            font.pointSize:         ScreenTools.smallFontPointSize
                            text:                   qsTr("Actual position set by vehicle at flight time.")
                            horizontalAlignment:    Text.AlignHCenter
                        }
108

109 110 111 112 113
                        QGCButton {
                            text:                       qsTr("Set Home To Map Center")
                            onClicked:                  missionItem.coordinate = map.center
                            anchors.horizontalCenter:   parent.horizontalCenter
                        }
Gus Grubba's avatar
Gus Grubba committed
114
                    }
115

116
                    SectionHeader {
117
                        id:             vehicleInfoSectionHeader
118
                        text:           qsTr("Vehicle Info")
119 120
                        visible:        _multipleFirmware && _showOfflineEditingCombos
                        checked:        false
121 122 123 124 125 126 127 128
                    }

                    GridLayout {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        columnSpacing:  ScreenTools.defaultFontPixelWidth
                        rowSpacing:     columnSpacing
                        columns:        2
129
                        visible:        vehicleInfoSectionHeader.visible && vehicleInfoSectionHeader.checked
130 131

                        QGCLabel {
132 133
                            text:               _firmwareLabel
                            Layout.fillWidth:   true
134 135
                        }
                        FactComboBox {
136 137
                            fact:                   QGroundControl.settingsManager.appSettings.offlineEditingFirmwareType
                            indexModel:             false
138
                            Layout.preferredWidth:  _fieldWidth
139 140 141
                        }

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

                        QGCLabel {
152 153 154
                            text:               qsTr("Cruise speed")
                            visible:            _showCruiseSpeed
                            Layout.fillWidth:   true
155 156
                        }
                        FactTextField {
157 158
                            fact:                   QGroundControl.settingsManager.appSettings.offlineEditingCruiseSpeed
                            visible:                _showCruiseSpeed
159
                            Layout.preferredWidth:  _fieldWidth
160 161 162
                        }

                        QGCLabel {
163 164 165
                            text:               qsTr("Hover speed")
                            visible:            _showHoverSpeed
                            Layout.fillWidth:   true
166 167
                        }
                        FactTextField {
168 169
                            fact:                   QGroundControl.settingsManager.appSettings.offlineEditingHoverSpeed
                            visible:                _showHoverSpeed
170
                            Layout.preferredWidth:  _fieldWidth
171 172 173
                        }
                    } // GridLayout

174 175 176 177 178 179 180
                    SectionHeader {
                        id:             missionDefaultsSectionHeader
                        text:           qsTr("Mission Defaults")
                        checked:        false
                    }

                    Column {
181 182 183
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        spacing:        _margin
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 214 215 216 217 218 219 220 221 222 223 224 225 226
                        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

                        /*
                          FIXME: NYI
                        FactComboBox {
                            anchors.left:   parent.left
                            anchors.right:  parent.right
                            fact:           missionItem.missionEndAction
                            indexModel:     false
                        }
                        */
                    }

227 228
                    CameraSection {
                        checked: missionItem.cameraSection.settingsSpecified
229 230
                    }

231
                    QGCLabel {
232 233 234 235 236 237
                        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
238
                    }
239 240 241 242 243
                } // Column
            } // Item
        } // Component
    } // Loader
} // Rectangle