MissionSettingsEditor.qml 15.1 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

// 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

22 23 24 25 26 27
    ExclusiveGroup {
        id: sectionHeaderExclusiverGroup
    }

    property ExclusiveGroup sectionHeaderGroup: ScreenTools.isShortScreen ? sectionHeaderExclusiverGroup : null

28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
    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
46
                property bool   _showHoverSpeed:            _missionVehicle.multiRotor || _missionVehicle.vtol
Gus Grubba's avatar
Gus Grubba committed
47
                property bool   _multipleFirmware:          QGroundControl.supportedFirmwareCount > 2
48
                property real   _fieldWidth:                ScreenTools.defaultFontPixelWidth * 16
49
                property bool   _mobile:                    ScreenTools.isMobile
50

51 52
                readonly property string _firmwareLabel:    qsTr("Firmware")
                readonly property string _vehicleLabel:     qsTr("Vehicle")
53 54 55 56 57 58 59 60 61 62

                QGCPalette { id: qgcPal }

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

63 64 65 66 67 68
                    SectionHeader {
                        id:             plannedHomePositionSection
                        text:           qsTr("Planned Home Position")
                        showSpacer:     false
                        exclusiveGroup: sectionHeaderGroup
                    }
69

70 71 72 73 74 75 76
                    Column {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        spacing:        _margin
                        visible:        plannedHomePositionSection.checked

                        GridLayout {
77 78
                            anchors.left:   parent.left
                            anchors.right:  parent.right
79 80 81
                            columnSpacing:  ScreenTools.defaultFontPixelWidth
                            rowSpacing:     columnSpacing
                            columns:        2
82

83 84 85
                            QGCLabel {
                                text: qsTr("Latitude")
                            }
86
                            FactTextField {
87 88
                                fact:               missionItem.plannedHomePositionLatitude
                                Layout.fillWidth:   true
89
                            }
90 91 92 93 94 95 96

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

99 100 101 102 103 104 105 106
                            QGCLabel {
                                text: qsTr("Altitude")
                            }
                            FactTextField {
                                fact:               missionItem.plannedHomePositionAltitude
                                Layout.fillWidth:   true
                            }
                        }
107

108 109 110 111 112 113 114
                        QGCLabel {
                            width:                  parent.width
                            wrapMode:               Text.WordWrap
                            font.pointSize:         ScreenTools.smallFontPointSize
                            text:                   qsTr("Actual position set by vehicle at flight time.")
                            horizontalAlignment:    Text.AlignHCenter
                        }
115

116 117 118 119 120
                        QGCButton {
                            text:                       qsTr("Set Home To Map Center")
                            onClicked:                  missionItem.coordinate = map.center
                            anchors.horizontalCenter:   parent.horizontalCenter
                        }
Gus Grubba's avatar
Gus Grubba committed
121
                    }
122

123
                    SectionHeader {
124
                        id:             vehicleInfoSectionHeader
125
                        text:           qsTr("Vehicle Info")
126 127 128
                        visible:        _multipleFirmware && _showOfflineEditingCombos
                        checked:        false
                        exclusiveGroup: sectionHeaderGroup
129 130 131 132 133 134 135 136
                    }

                    GridLayout {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        columnSpacing:  ScreenTools.defaultFontPixelWidth
                        rowSpacing:     columnSpacing
                        columns:        2
137
                        visible:        vehicleInfoSectionHeader.visible && vehicleInfoSectionHeader.checked
138 139

                        QGCLabel {
140 141
                            text:               _firmwareLabel
                            Layout.fillWidth:   true
142 143
                        }
                        FactComboBox {
144 145
                            fact:                   QGroundControl.settingsManager.appSettings.offlineEditingFirmwareType
                            indexModel:             false
146
                            Layout.preferredWidth:  _fieldWidth
147 148 149
                        }

                        QGCLabel {
150 151
                            text:               _vehicleLabel
                            Layout.fillWidth:   true
152 153
                        }
                        FactComboBox {
154 155
                            fact:                   QGroundControl.settingsManager.appSettings.offlineEditingVehicleType
                            indexModel:             false
156
                            Layout.preferredWidth:  _fieldWidth
157 158 159
                        }

                        QGCLabel {
160 161 162
                            text:               qsTr("Cruise speed")
                            visible:            _showCruiseSpeed
                            Layout.fillWidth:   true
163 164
                        }
                        FactTextField {
165 166
                            fact:                   QGroundControl.settingsManager.appSettings.offlineEditingCruiseSpeed
                            visible:                _showCruiseSpeed
167
                            Layout.preferredWidth:  _fieldWidth
168 169 170
                        }

                        QGCLabel {
171 172 173
                            text:               qsTr("Hover speed")
                            visible:            _showHoverSpeed
                            Layout.fillWidth:   true
174 175
                        }
                        FactTextField {
176 177
                            fact:                   QGroundControl.settingsManager.appSettings.offlineEditingHoverSpeed
                            visible:                _showHoverSpeed
178
                            Layout.preferredWidth:  _fieldWidth
179 180 181
                        }
                    } // GridLayout

182 183 184 185 186 187 188 189
                    SectionHeader {
                        id:             missionDefaultsSectionHeader
                        text:           qsTr("Mission Defaults")
                        checked:        false
                        exclusiveGroup: sectionHeaderGroup
                    }

                    Column {
190 191 192
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        spacing:        _margin
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 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317
                        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
                        }
                        */
                    }

                    SectionHeader {
                        id:             cameraSectionHeader
                        text:           qsTr("Camera")
                        checked:        false
                        exclusiveGroup: sectionHeaderGroup
                    }

                    Column {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        spacing:        _margin
                        visible:        cameraSectionHeader.checked

                        FactComboBox {
                            id:             cameraActionCombo
                            anchors.left:   parent.left
                            anchors.right:  parent.right
                            fact:           missionItem.cameraAction
                            indexModel:     false
                        }

                        RowLayout {
                            anchors.left:   parent.left
                            anchors.right:  parent.right
                            spacing:        ScreenTools.defaultFontPixelWidth
                            visible:        cameraActionCombo.currentIndex == 1

                            QGCLabel {
                                text:               qsTr("Time")
                                Layout.fillWidth:   true
                            }
                            FactTextField {
                                fact:                   missionItem.cameraPhotoIntervalTime
                                Layout.preferredWidth:  _fieldWidth
                            }
                        }

                        RowLayout {
                            anchors.left:   parent.left
                            anchors.right:  parent.right
                            spacing:        ScreenTools.defaultFontPixelWidth
                            visible:        cameraActionCombo.currentIndex == 2

                            QGCLabel {
                                text:               qsTr("Distance")
                                Layout.fillWidth:   true
                            }
                            FactTextField {
                                fact:                   missionItem.cameraPhotoIntervalDistance
                                Layout.preferredWidth:  _fieldWidth
                            }
                        }

                        GridLayout {
                            anchors.left:   parent.left
                            anchors.right:  parent.right
                            columnSpacing:  0
                            rowSpacing:     0
                            columns:        3

                            Item { width: 1; height: 1 }
                            QGCLabel { text: qsTr("Pitch") }
                            QGCLabel { text: qsTr("Yaw") }

                            QGCCheckBox {
                                id:                 gimbalCheckBox
                                text:               qsTr("Gimbal")
                                checked:            missionItem.specifyGimbal
                                onClicked:          missionItem.specifyGimbal = checked
                                Layout.fillWidth:   true
                            }
                            FactTextField {
                                fact:           missionItem.gimbalPitch
                                implicitWidth:  ScreenTools.defaultFontPixelWidth * 9
                                enabled:        gimbalCheckBox.checked
                            }

                            FactTextField {
                                fact:           missionItem.gimbalYaw
                                implicitWidth:  ScreenTools.defaultFontPixelWidth * 9
                                enabled:        gimbalCheckBox.checked
                            }
318 319 320
                        }
                    }

321
                    QGCLabel {
322 323 324 325 326 327
                        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
328
                    }
329 330 331 332 333
                } // Column
            } // Item
        } // Component
    } // Loader
} // Rectangle