MissionSettingsEditor.qml 10.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
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
    property var    _masterControler:               masterController
    property var    _missionController:             _masterControler.missionController
25 26 27 28 29
    property var    _controllerVehicle:             _masterControler.controllerVehicle
    property bool   _vehicleHasHomePosition:        _controllerVehicle.homePosition.isValid
    property bool   _enableOfflineVehicleCombos:    _noMissionItemsAdded
    property bool   _showCruiseSpeed:               !_controllerVehicle.multiRotor
    property bool   _showHoverSpeed:                _controllerVehicle.multiRotor || _controllerVehicle.vtol
30
    property bool   _multipleFirmware:              QGroundControl.supportedFirmwareCount > 2
31
    property bool   _multipleVehicleTypes:          QGroundControl.supportedVehicleCount > 1
32 33 34 35 36 37
    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
38
    property bool   _showCameraSection:             (_waypointsOnlyMode || QGroundControl.corePlugin.showAdvancedUI) && !_controllerVehicle.apmFirmware
39
    property bool   _simpleMissionStart:            QGroundControl.corePlugin.options.showSimpleMissionStart
40
    property bool   _showFlightSpeed:               !_controllerVehicle.vtol && !_simpleMissionStart && !_controllerVehicle.apmFirmware
DonLakeFlyer's avatar
DonLakeFlyer committed
41 42 43

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

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

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

57 58 59 60 61 62
        GridLayout {
            anchors.left:   parent.left
            anchors.right:  parent.right
            columnSpacing:  ScreenTools.defaultFontPixelWidth
            rowSpacing:     columnSpacing
            columns:        2
DonLakeFlyer's avatar
DonLakeFlyer committed
63

64
            QGCLabel {
65
                text:       qsTr("Waypoint alt")
DonLakeFlyer's avatar
DonLakeFlyer committed
66
            }
67 68
            FactTextField {
                fact:               QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude
69
                Layout.fillWidth:   true
DonLakeFlyer's avatar
DonLakeFlyer committed
70 71
            }

72 73 74
            QGCCheckBox {
                id:         flightSpeedCheckBox
                text:       qsTr("Flight speed")
75
                visible:    _showFlightSpeed
76 77
                checked:    missionItem.speedSection.specifyFlightSpeed
                onClicked:   missionItem.speedSection.specifyFlightSpeed = checked
78 79 80
            }
            FactTextField {
                Layout.fillWidth:   true
81
                fact:               missionItem.speedSection.flightSpeed
82
                visible:            _showFlightSpeed
83
                enabled:            flightSpeedCheckBox.checked
DonLakeFlyer's avatar
DonLakeFlyer committed
84
            }
85
        }
DonLakeFlyer's avatar
DonLakeFlyer committed
86

87 88 89 90
        Column {
            anchors.left:   parent.left
            anchors.right:  parent.right
            spacing:        _margin
91 92 93 94
            visible:        !_simpleMissionStart

            CameraSection {
                id:         cameraSection
Don Gagne's avatar
Don Gagne committed
95
                checked:    !_waypointsOnlyMode && missionItem.cameraSection.settingsSpecified
96 97 98 99 100 101 102 103 104 105 106 107 108 109
                visible:    _showCameraSection
            }

            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
                visible:                _showCameraSection && cameraSection.checked
            }

            SectionHeader {
110 111 112 113
                id:             vehicleInfoSectionHeader
                anchors.left:   parent.left
                anchors.right:  parent.right
                text:           qsTr("Vehicle Info")
114
                visible:        !_waypointsOnlyMode
115
                checked:        false
116
            }
DonLakeFlyer's avatar
DonLakeFlyer committed
117 118 119 120 121 122 123

            GridLayout {
                anchors.left:   parent.left
                anchors.right:  parent.right
                columnSpacing:  ScreenTools.defaultFontPixelWidth
                rowSpacing:     columnSpacing
                columns:        2
124
                visible:        vehicleInfoSectionHeader.visible && vehicleInfoSectionHeader.checked
DonLakeFlyer's avatar
DonLakeFlyer committed
125 126

                QGCLabel {
127 128
                    text:               _firmwareLabel
                    Layout.fillWidth:   true
129
                    visible:            _multipleFirmware
130 131 132 133 134
                }
                FactComboBox {
                    fact:                   QGroundControl.settingsManager.appSettings.offlineEditingFirmwareType
                    indexModel:             false
                    Layout.preferredWidth:  _fieldWidth
135 136 137 138 139
                    visible:                _multipleFirmware && _enableOfflineVehicleCombos
                }
                QGCLabel {
                    text:       _controllerVehicle.firmwareTypeString
                    visible:    _multipleFirmware && !_enableOfflineVehicleCombos
140 141 142 143 144
                }

                QGCLabel {
                    text:               _vehicleLabel
                    Layout.fillWidth:   true
145
                    visible:            _multipleVehicleTypes
146 147 148 149 150
                }
                FactComboBox {
                    fact:                   QGroundControl.settingsManager.appSettings.offlineEditingVehicleType
                    indexModel:             false
                    Layout.preferredWidth:  _fieldWidth
151 152 153 154 155
                    visible:                _multipleVehicleTypes && _enableOfflineVehicleCombos
                }
                QGCLabel {
                    text:       _controllerVehicle.vehicleTypeString
                    visible:    _multipleVehicleTypes && !_enableOfflineVehicleCombos
156 157 158 159 160 161
                }

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

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

181
            SectionHeader {
182 183 184
                id:             plannedHomePositionSection
                anchors.left:   parent.left
                anchors.right:  parent.right
185
                text:           qsTr("Launch Position")
186 187
                visible:        !_vehicleHasHomePosition
                checked:        false
188
            }
DonLakeFlyer's avatar
DonLakeFlyer committed
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
            Column {
                anchors.left:   parent.left
                anchors.right:  parent.right
                spacing:        _margin
                visible:        plannedHomePositionSection.checked && !_vehicleHasHomePosition

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

                    QGCLabel {
                        text: qsTr("Altitude")
                    }
                    FactTextField {
                        fact:               missionItem.plannedHomePositionAltitude
                        Layout.fillWidth:   true
                    }
                }

                QGCLabel {
                    width:                  parent.width
                    wrapMode:               Text.WordWrap
                    font.pointSize:         ScreenTools.smallFontPointSize
                    text:                   qsTr("Actual position set by vehicle at flight time.")
                    horizontalAlignment:    Text.AlignHCenter
                }

                QGCButton {
221
                    text:                       qsTr("Set To Map Center")
222 223 224
                    onClicked:                  missionItem.coordinate = map.center
                    anchors.horizontalCenter:   parent.horizontalCenter
                }
DonLakeFlyer's avatar
DonLakeFlyer committed
225
            }
226
        } // Column
227
    } // Column
228
} // Rectangle