MissionSettingsEditor.qml 9.56 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
DonLakeFlyer's avatar
DonLakeFlyer committed
12
import QGroundControl.Controllers       1.0
13 14 15 16 17

// Editor for Mission Settings
Rectangle {
    id:                 valuesRect
    width:              availableWidth
18
    height:             valuesColumn.height + (_margin * 2)
19 20 21 22
    color:              qgcPal.windowShadeDark
    visible:            missionItem.isCurrentItem
    radius:             _radius

23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
    property var    _masterControler:               masterController
    property var    _missionController:             _masterControler.missionController
    property var    _missionVehicle:                _masterControler.controllerVehicle
    property bool   _vehicleHasHomePosition:        _missionVehicle.homePosition.isValid
    property bool   _offlineEditing:                _missionVehicle.isOfflineEditingVehicle
    property bool   _showOfflineVehicleCombos:      _multipleFirmware
    property bool   _enableOfflineVehicleCombos:    _offlineEditing && _noMissionItemsAdded
    property bool   _showCruiseSpeed:               !_missionVehicle.multiRotor
    property bool   _showHoverSpeed:                _missionVehicle.multiRotor || _missionVehicle.vtol
    property bool   _multipleFirmware:              QGroundControl.supportedFirmwareCount > 2
    property real   _fieldWidth:                    ScreenTools.defaultFontPixelWidth * 16
    property bool   _mobile:                        ScreenTools.isMobile
    property var    _savePath:                      QGroundControl.settingsManager.appSettings.missionSavePath
    property var    _fileExtension:                 QGroundControl.settingsManager.appSettings.missionFileExtension
    property var    _appSettings:                   QGroundControl.settingsManager.appSettings
    property bool   _waypointsOnlyMode:             QGroundControl.corePlugin.options.missionWaypointsOnly
39
    property bool   _showCameraSection:             !_waypointsOnlyMode || QGroundControl.corePlugin.showAdvancedUI
DonLakeFlyer's avatar
DonLakeFlyer committed
40 41 42

    readonly property string _firmwareLabel:    qsTr("Firmware")
    readonly property string _vehicleLabel:     qsTr("Vehicle")
43
    readonly property real  _margin:            ScreenTools.defaultFontPixelWidth / 2
DonLakeFlyer's avatar
DonLakeFlyer committed
44 45

    QGCPalette { id: qgcPal }
46
    QGCFileDialogController { id: fileController }
DonLakeFlyer's avatar
DonLakeFlyer committed
47

48 49 50 51 52 53 54
    Column {
        id:                 valuesColumn
        anchors.margins:    _margin
        anchors.left:       parent.left
        anchors.right:      parent.right
        anchors.top:        parent.top
        spacing:            _margin
55

56 57 58 59
        Column {
            anchors.left:   parent.left
            anchors.right:  parent.right
            spacing:        _margin
60

61 62 63 64 65 66
            GridLayout {
                anchors.left:   parent.left
                anchors.right:  parent.right
                columnSpacing:  ScreenTools.defaultFontPixelWidth
                rowSpacing:     columnSpacing
                columns:        2
67

68 69 70 71 72 73 74
                QGCLabel {
                    text:       qsTr("Waypoint alt")
                }
                FactTextField {
                    fact:               QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude
                    Layout.fillWidth:   true
                }
75

76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
                QGCCheckBox {
                    id:         flightSpeedCheckBox
                    text:       qsTr("Flight speed")
                    visible:    !_missionVehicle.vtol
                    checked:    missionItem.speedSection.specifyFlightSpeed
                    onClicked:   missionItem.speedSection.specifyFlightSpeed = checked
                }
                FactTextField {
                    Layout.fillWidth:   true
                    fact:               missionItem.speedSection.flightSpeed
                    visible:            flightSpeedCheckBox.visible
                    enabled:            flightSpeedCheckBox.checked
                }
            } // GridLayout
        }

        CameraSection {
            id:         cameraSection
            checked:    missionItem.cameraSection.settingsSpecified
95
            visible:    _showCameraSection
96 97 98 99 100 101 102 103 104
        }

        QGCLabel {
            anchors.left:           parent.left
            anchors.right:          parent.right
            text:                   qsTr("Above camera commands will take affect immediately upon mission start.")
            wrapMode:               Text.WordWrap
            horizontalAlignment:    Text.AlignHCenter
            font.pointSize:         ScreenTools.smallFontPointSize
105
            visible:                _showCameraSection && cameraSection.checked
106 107 108 109 110 111 112
        }

        SectionHeader {
            id:         missionEndHeader
            text:       qsTr("Mission End")
            checked:    true
        }
DonLakeFlyer's avatar
DonLakeFlyer committed
113 114

        Column {
115 116
            anchors.left:   parent.left
            anchors.right:  parent.right
DonLakeFlyer's avatar
DonLakeFlyer committed
117
            spacing:        _margin
118
            visible:        missionEndHeader.checked
DonLakeFlyer's avatar
DonLakeFlyer committed
119

120 121 122 123 124 125
            QGCCheckBox {
                text:       qsTr("Return To Launch")
                checked:    missionItem.missionEndRTL
                onClicked:  missionItem.missionEndRTL = checked
            }
        }
DonLakeFlyer's avatar
DonLakeFlyer committed
126 127


128 129 130 131 132 133
        SectionHeader {
            id:         vehicleInfoSectionHeader
            text:       qsTr("Vehicle Info")
            visible:    _offlineEditing && !_waypointsOnlyMode
            checked:    false
        }
DonLakeFlyer's avatar
DonLakeFlyer committed
134

135 136 137 138 139 140 141
        GridLayout {
            anchors.left:   parent.left
            anchors.right:  parent.right
            columnSpacing:  ScreenTools.defaultFontPixelWidth
            rowSpacing:     columnSpacing
            columns:        2
            visible:        vehicleInfoSectionHeader.visible && vehicleInfoSectionHeader.checked
DonLakeFlyer's avatar
DonLakeFlyer committed
142

143 144 145 146 147 148 149 150 151 152 153
            QGCLabel {
                text:               _firmwareLabel
                Layout.fillWidth:   true
                visible:            _showOfflineVehicleCombos
            }
            FactComboBox {
                fact:                   QGroundControl.settingsManager.appSettings.offlineEditingFirmwareType
                indexModel:             false
                Layout.preferredWidth:  _fieldWidth
                visible:                _showOfflineVehicleCombos
                enabled:                _enableOfflineVehicleCombos
DonLakeFlyer's avatar
DonLakeFlyer committed
154 155 156
            }

            QGCLabel {
157 158 159
                text:               _vehicleLabel
                Layout.fillWidth:   true
                visible:            _showOfflineVehicleCombos
DonLakeFlyer's avatar
DonLakeFlyer committed
160
            }
161 162 163 164 165 166
            FactComboBox {
                fact:                   QGroundControl.settingsManager.appSettings.offlineEditingVehicleType
                indexModel:             false
                Layout.preferredWidth:  _fieldWidth
                visible:                _showOfflineVehicleCombos
                enabled:                _enableOfflineVehicleCombos
DonLakeFlyer's avatar
DonLakeFlyer committed
167 168
            }

169 170 171 172 173 174 175 176 177 178
            QGCLabel {
                text:               qsTr("Cruise speed")
                visible:            _showCruiseSpeed
                Layout.fillWidth:   true
            }
            FactTextField {
                fact:                   QGroundControl.settingsManager.appSettings.offlineEditingCruiseSpeed
                visible:                _showCruiseSpeed
                Layout.preferredWidth:  _fieldWidth
            }
DonLakeFlyer's avatar
DonLakeFlyer committed
179

180 181 182 183
            QGCLabel {
                text:               qsTr("Hover speed")
                visible:            _showHoverSpeed
                Layout.fillWidth:   true
DonLakeFlyer's avatar
DonLakeFlyer committed
184
            }
185 186 187 188 189 190
            FactTextField {
                fact:                   QGroundControl.settingsManager.appSettings.offlineEditingHoverSpeed
                visible:                _showHoverSpeed
                Layout.preferredWidth:  _fieldWidth
            }
        } // GridLayout
DonLakeFlyer's avatar
DonLakeFlyer committed
191

192 193 194 195 196 197
        SectionHeader {
            id:         plannedHomePositionSection
            text:       qsTr("Planned Home Position")
            visible:    !_vehicleHasHomePosition
            checked:    false
        }
DonLakeFlyer's avatar
DonLakeFlyer committed
198

199 200 201 202 203
        Column {
            anchors.left:   parent.left
            anchors.right:  parent.right
            spacing:        _margin
            visible:        plannedHomePositionSection.checked && !_vehicleHasHomePosition
DonLakeFlyer's avatar
DonLakeFlyer committed
204 205 206 207 208 209 210 211 212

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

                QGCLabel {
213
                    text: qsTr("Altitude")
DonLakeFlyer's avatar
DonLakeFlyer committed
214 215
                }
                FactTextField {
216
                    fact:               missionItem.plannedHomePositionAltitude
DonLakeFlyer's avatar
DonLakeFlyer committed
217 218 219 220
                    Layout.fillWidth:   true
                }
            }

221 222 223 224 225 226 227
            QGCLabel {
                width:                  parent.width
                wrapMode:               Text.WordWrap
                font.pointSize:         ScreenTools.smallFontPointSize
                text:                   qsTr("Actual position set by vehicle at flight time.")
                horizontalAlignment:    Text.AlignHCenter
            }
DonLakeFlyer's avatar
DonLakeFlyer committed
228

229 230 231 232
            QGCButton {
                text:                       qsTr("Set Home To Map Center")
                onClicked:                  missionItem.coordinate = map.center
                anchors.horizontalCenter:   parent.horizontalCenter
DonLakeFlyer's avatar
DonLakeFlyer committed
233
            }
234 235
        }
    } // Column
236
} // Rectangle