QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
MissionDefaultsEditor.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Layouts
4
5import QGroundControl
6import QGroundControl.Controls
7import QGroundControl.FactControls
8import QGroundControl.PlanView
9
10Rectangle {
11 id: _root
12
13 required property var missionController
14 required property var planMasterController
15
16 property var _controllerVehicle: planMasterController.controllerVehicle
17 property var _visualItems: missionController.visualItems
18 property bool _noMissionItemsAdded: _visualItems ? _visualItems.count <= 1 : true
19 property var _settingsItem: _visualItems && _visualItems.count > 0 ? _visualItems.get(0) : null
20 property bool _flightSpeedSpecified: _settingsItem ? _settingsItem.speedSection.specifyFlightSpeed : false
21 property bool _showCruiseSpeed: _controllerVehicle ? !_controllerVehicle.multiRotor : false
22 property bool _showHoverSpeed: _controllerVehicle ? (_controllerVehicle.multiRotor || _controllerVehicle.vtol) : false
23 property bool _showAscentDescentSpeed: _controllerVehicle ? (_controllerVehicle.multiRotor || _controllerVehicle.vtol) : false
24 property bool _isVtol: _controllerVehicle ? _controllerVehicle.vtol : false
25
26 width: parent ? parent.width : 0
27 height: mainColumn.height + ScreenTools.defaultFontPixelHeight
28 color: qgcPal.windowPanel
29
30 QGCPalette { id: qgcPal; colorGroupEnabled: _root.enabled }
31
32 Connections {
33 target: _root._controllerVehicle
34 function onFirmwareTypeChanged() {
35 if (!_root._controllerVehicle.supports.terrainFrame
36 && _root.missionController.globalAltitudeFrame === QGroundControl.AltitudeFrameTerrain) {
37 _root.missionController.globalAltitudeFrame = QGroundControl.AltitudeFrameCalcAboveTerrain
38 }
39 }
40 }
41
42 Component { id: altFrameDialogComponent; AltFrameDialog { } }
43
44 QGCPopupDialogFactory {
45 id: altFrameDialogFactory
46 dialogComponent: altFrameDialogComponent
47 }
48
49 ColumnLayout {
50 id: mainColumn
51 anchors.left: parent.left
52 anchors.right: parent.right
53 anchors.verticalCenter: parent.verticalCenter
54 anchors.margins: ScreenTools.defaultFontPixelWidth
55 spacing: ScreenTools.defaultFontPixelHeight * 0.5
56
57 LabelledButton {
58 Layout.fillWidth: true
59 label: qsTr("Alt Frame")
60 buttonText: QGroundControl.altitudeFrameExtraUnits(_root.missionController.globalAltitudeFrame)
61
62 onClicked: {
63 let removeModes = []
64 let updateFunction = function(altFrame) { _root.missionController.globalAltitudeFrame = altFrame }
65 if (!_root._controllerVehicle.supports.terrainFrame) {
66 removeModes.push(QGroundControl.AltitudeFrameTerrain)
67 }
68 if (!_root._noMissionItemsAdded) {
69 if (_root.missionController.globalAltitudeFrame !== QGroundControl.AltitudeFrameRelative) {
70 removeModes.push(QGroundControl.AltitudeFrameRelative)
71 }
72 if (_root.missionController.globalAltitudeFrame !== QGroundControl.AltitudeFrameAbsolute) {
73 removeModes.push(QGroundControl.AltitudeFrameAbsolute)
74 }
75 if (_root.missionController.globalAltitudeFrame !== QGroundControl.AltitudeFrameCalcAboveTerrain) {
76 removeModes.push(QGroundControl.AltitudeFrameCalcAboveTerrain)
77 }
78 if (_root.missionController.globalAltitudeFrame !== QGroundControl.AltitudeFrameTerrain) {
79 removeModes.push(QGroundControl.AltitudeFrameTerrain)
80 }
81 }
82 altFrameDialogFactory.open({ currentAltFrame: _root.missionController.globalAltitudeFrame, rgRemoveModes: removeModes, updateAltFrameFn: updateFunction })
83 }
84 }
85
86 FactTextFieldSlider {
87 Layout.fillWidth: true
88 label: qsTr("Altitude")
89 fact: QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude
90 }
91
92 RowLayout {
93 Layout.fillWidth: true
94 spacing: ScreenTools.defaultFontPixelWidth
95 visible: _root.missionController.applyDefaultMissionAltitudeAvailable
96
97 QGCLabel {
98 Layout.fillWidth: true
99 wrapMode: Text.WordWrap
100 font.pointSize: ScreenTools.smallFontPointSize
101 text: qsTr("Apply new altitude to all mission items?")
102 }
103
104 QGCButton {
105 small: true
106 text: qsTr("Apply")
107 onClicked: _root.missionController.applyDefaultMissionAltitude()
108 }
109 }
110
111 FactTextFieldSlider {
112 Layout.fillWidth: true
113 label: qsTr("Flight Speed")
114 fact: _root._settingsItem ? _root._settingsItem.speedSection.flightSpeed : null
115 showEnableCheckbox: true
116 enableCheckBoxChecked: _root._settingsItem ? _root._settingsItem.speedSection.specifyFlightSpeed : false
117 visible: _root._settingsItem ? _root._settingsItem.speedSection.available : false
118
119 onEnableCheckboxClicked: {
120 if (_root._settingsItem) {
121 _root._settingsItem.speedSection.specifyFlightSpeed = enableCheckBoxChecked
122 }
123 }
124 }
125
126 // ── Vehicle Speeds ──
127 SectionHeader {
128 id: vehicleSpeedsSectionHeader
129 Layout.fillWidth: true
130 text: qsTr("Expected Vehicle Speeds")
131 visible: _root._showCruiseSpeed || _root._showHoverSpeed || _root._showAscentDescentSpeed
132 }
133
134 ColumnLayout {
135 Layout.fillWidth: true
136 spacing: ScreenTools.defaultFontPixelHeight * 0.5
137 visible: vehicleSpeedsSectionHeader.visible && vehicleSpeedsSectionHeader.checked
138
139 QGCLabel {
140 Layout.fillWidth: true
141 wrapMode: Text.WordWrap
142 font.pointSize: ScreenTools.smallFontPointSize
143 text: qsTr("The following speed values are used to calculate total mission time. They do not affect the flight speed for the mission.")
144 }
145
146 FactTextFieldSlider {
147 Layout.fillWidth: true
148 label: _root._isVtol ? qsTr("FW - Flight speed") : qsTr("Flight speed")
149 fact: QGroundControl.settingsManager.appSettings.offlineEditingCruiseSpeed
150 visible: _root._showCruiseSpeed
151 enabled: !_root._flightSpeedSpecified
152 }
153
154 FactTextFieldSlider {
155 Layout.fillWidth: true
156 label: _root._isVtol ? qsTr("MR - Flight speed") : qsTr("Flight speed")
157 fact: QGroundControl.settingsManager.appSettings.offlineEditingHoverSpeed
158 visible: _root._showHoverSpeed
159 enabled: !_root._flightSpeedSpecified
160 }
161
162 FactTextFieldSlider {
163 Layout.fillWidth: true
164 label: _root._isVtol ? qsTr("MR - Ascent speed") : qsTr("Ascent speed")
165 fact: QGroundControl.settingsManager.appSettings.offlineEditingAscentSpeed
166 visible: _root._showAscentDescentSpeed
167 }
168
169 FactTextFieldSlider {
170 Layout.fillWidth: true
171 label: _root._isVtol ? qsTr("MR - Descent speed") : qsTr("Descent speed")
172 fact: QGroundControl.settingsManager.appSettings.offlineEditingDescentSpeed
173 visible: _root._showAscentDescentSpeed
174 }
175 }
176 }
177}