5import QGroundControl.Controls
9 spacing: ScreenTools.defaultFontPixelWidth
11 property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
12 property bool _armed: _activeVehicle ? _activeVehicle.armed : false
13 property real _margins: ScreenTools.defaultFontPixelWidth
14 property real _spacing: ScreenTools.defaultFontPixelWidth / 2
15 property bool _allowForceArm: false
16 property bool _healthAndArmingChecksSupported: _activeVehicle ? _activeVehicle.healthAndArmingCheckReport.supported : false
17 property bool _vehicleFlies: _activeVehicle ? _activeVehicle.airShip || _activeVehicle.fixedWing || _activeVehicle.vtol || _activeVehicle.multiRotor : false
18 property var _vehicleInAir: _activeVehicle ? _activeVehicle.flying || _activeVehicle.landing : false
19 property bool _vtolInFWDFlight: _activeVehicle ? _activeVehicle.vtolInFwdFlight : false
21 function dropMainStatusIndicator() {
22 let overallStatusComponent = _activeVehicle ? overallStatusIndicatorPage : overallStatusOfflineIndicatorPage
23 mainWindow.showIndicatorDrawer(overallStatusComponent, control)
26 QGCPalette { id: qgcPal }
30 Layout.fillHeight: true
31 Layout.preferredWidth: contentWidth + (vehicleMessagesIcon.visible ? vehicleMessagesIcon.width + control.spacing : 0)
32 verticalAlignment: Text.AlignVCenter
33 text: mainStatusText()
34 color: qgcPal.windowTransparentText
35 font.pointSize: ScreenTools.largeFontPointSize
37 property string _commLostText: qsTr("Comms Lost")
38 property string _readyToFlyText: qsTr("Ready")
39 property string _notReadyToFlyText: qsTr("Not Ready")
40 property string _disconnectedText: qsTr("Disconnected - Click to manually connect")
41 property string _armedText: qsTr("Armed")
42 property string _flyingText: qsTr("Flying")
43 property string _landingText: qsTr("Landing")
45 function mainStatusText() {
48 if (_communicationLost) {
49 _mainStatusBGColor = "red"
50 return mainStatusLabel._commLostText
52 if (_activeVehicle.armed) {
53 _mainStatusBGColor = "green"
55 if (_healthAndArmingChecksSupported) {
56 if (_activeVehicle.healthAndArmingCheckReport.canArm) {
57 if (_activeVehicle.healthAndArmingCheckReport.hasWarningsOrErrors) {
58 _mainStatusBGColor = "yellow"
61 _mainStatusBGColor = "red"
65 if (_activeVehicle.flying) {
66 return mainStatusLabel._flyingText
67 } else if (_activeVehicle.landing) {
68 return mainStatusLabel._landingText
70 return mainStatusLabel._armedText
73 if (_healthAndArmingChecksSupported) {
74 if (_activeVehicle.healthAndArmingCheckReport.canArm) {
75 if (_activeVehicle.healthAndArmingCheckReport.hasWarningsOrErrors) {
76 _mainStatusBGColor = "yellow"
78 _mainStatusBGColor = "green"
80 return mainStatusLabel._readyToFlyText
82 _mainStatusBGColor = "red"
83 return mainStatusLabel._notReadyToFlyText
85 } else if (_activeVehicle.readyToFlyAvailable) {
86 if (_activeVehicle.readyToFly) {
87 _mainStatusBGColor = "green"
88 return mainStatusLabel._readyToFlyText
90 _mainStatusBGColor = "yellow"
91 return mainStatusLabel._notReadyToFlyText
94 // Best we can do is determine readiness based on AutoPilot component setup and health indicators from SYS_STATUS
95 if (_activeVehicle.allSensorsHealthy && _activeVehicle.autopilotPlugin.setupComplete) {
96 _mainStatusBGColor = "green"
97 return mainStatusLabel._readyToFlyText
99 _mainStatusBGColor = "yellow"
100 return mainStatusLabel._notReadyToFlyText
105 _mainStatusBGColor = qgcPal.brandingPurple
106 return mainStatusLabel._disconnectedText
111 id: vehicleMessagesIcon
112 anchors.verticalCenter: parent.verticalCenter
113 anchors.right: parent.right
114 width: ScreenTools.defaultFontPixelWidth * 2
116 source: "/res/VehicleMessages.png"
117 color: getIconColor()
118 sourceSize.width: width
119 fillMode: Image.PreserveAspectFit
120 visible: _activeVehicle && _activeVehicle.messageCount > 0
122 function getIconColor() {
123 let iconColor = qgcPal.windowTransparentText
124 if (_activeVehicle) {
125 if (_activeVehicle.messageTypeWarning) {
126 iconColor = qgcPal.colorOrange
127 } else if (_activeVehicle.messageTypeError) {
128 iconColor = qgcPal.colorRed
137 onClicked: dropMainStatusIndicator()
143 Layout.fillHeight: true
144 verticalAlignment: Text.AlignVCenter
145 text: _vtolInFWDFlight ? qsTr("FW(vtol)") : qsTr("MR(vtol)")
146 color: qgcPal.windowTransparentText
147 font.pointSize: _vehicleInAir ? ScreenTools.largeFontPointSize : ScreenTools.defaultFontPointSize
148 visible: _activeVehicle && _activeVehicle.vtol
154 mainWindow.showIndicatorDrawer(vtolTransitionIndicatorPage)
161 id: overallStatusOfflineIndicatorPage
163 MainStatusIndicatorOfflinePage { }
167 id: overallStatusIndicatorPage
171 waitForParameters: false
172 expandedComponentWaitForParameters: true
173 contentComponent: mainStatusContentComponent
174 expandedComponent: mainStatusExpandedComponent
179 id: mainStatusContentComponent
185 property bool parametersReady: QGroundControl.multiVehicleManager.parameterReadyVehicleAvailable
188 spacing: ScreenTools.defaultFontPixelWidth
189 visible: parametersReady
192 enabled: _armed || !_healthAndArmingChecksSupported || _activeVehicle.healthAndArmingCheckReport.canArm
193 text: _armed ? qsTr("Disarm") : (control._allowForceArm ? qsTr("Force Arm") : qsTr("Arm"))
197 _activeVehicle.armed = false
199 if (_allowForceArm) {
200 _allowForceArm = false
201 _activeVehicle.forceArm()
203 _activeVehicle.armed = true
206 mainWindow.closeIndicatorDrawer()
212 Layout.alignment: Qt.AlignTop
213 label: qsTr("Primary Link")
214 alternateText: _primaryLinkName
215 visible: _activeVehicle && _activeVehicle.vehicleLinkManager.linkNames.length > 1
217 property var _rgLinkNames: _activeVehicle ? _activeVehicle.vehicleLinkManager.linkNames : [ ]
218 property var _rgLinkStatus: _activeVehicle ? _activeVehicle.vehicleLinkManager.linkStatuses : [ ]
219 property string _primaryLinkName: _activeVehicle ? _activeVehicle.vehicleLinkManager.primaryLinkName : ""
221 function updateComboModel() {
223 for (let i = 0; i < _rgLinkNames.length; i++) {
224 let linkStatus = _rgLinkStatus[i]
225 linkModel.push(_rgLinkNames[i] + (linkStatus === "" ? "" : " " + _rgLinkStatus[i]))
227 primaryLinkCombo.model = linkModel
228 primaryLinkCombo.currentIndex = -1
231 Component.onCompleted: updateComboModel()
232 on_RgLinkNamesChanged: updateComboModel()
233 on_RgLinkStatusChanged: updateComboModel()
235 onActivated: (index) => {
236 _activeVehicle.vehicleLinkManager.primaryLinkName = _rgLinkNames[index]; currentIndex = -1
237 mainWindow.closeIndicatorDrawer()
242 SettingsGroupLayout {
243 //Layout.fillWidth: true
244 heading: qsTr("Vehicle Messages")
247 id: vehicleMessageList
252 text: qsTr("No new vehicle messages")
253 visible: vehicleMessageList.noMessages
257 SettingsGroupLayout {
258 //Layout.fillWidth: true
259 heading: qsTr("Sensor Status")
260 visible: parametersReady && !_healthAndArmingChecksSupported
264 columnSpacing: _spacing
265 rows: _activeVehicle.sysStatusSensorInfo.sensorNames.length
266 flow: GridLayout.TopToBottom
269 model: _activeVehicle.sysStatusSensorInfo.sensorNames
270 QGCLabel { text: modelData }
274 model: _activeVehicle.sysStatusSensorInfo.sensorStatus
275 QGCLabel { text: modelData }
280 SettingsGroupLayout {
281 //Layout.fillWidth: true
282 heading: qsTr("Overall Status")
283 visible: parametersReady && _healthAndArmingChecksSupported && _activeVehicle.healthAndArmingCheckReport.problemsForCurrentMode.count > 0
285 // List health and arming checks
287 model: _activeVehicle ? _activeVehicle.healthAndArmingCheckReport.problemsForCurrentMode : null
288 delegate: listdelegate
297 spacing: ScreenTools.defaultFontPixelHeight
302 textFormat: TextEdit.RichText
303 color: object.severity == 'error' ? qgcPal.colorRed : object.severity == 'warning' ? qgcPal.colorOrange : qgcPal.text
307 if (object.description != "")
308 object.expanded = !object.expanded
314 id: arrowDownIndicator
315 anchors.verticalCenter: parent.verticalCenter
316 height: 1.5 * ScreenTools.defaultFontPixelWidth
318 source: "/qmlimages/arrow-down.png"
320 visible: object.description != ""
323 onClicked: object.expanded = !object.expanded
330 text: object.description
331 textFormat: TextEdit.RichText
333 visible: object.expanded
335 property var fact: null
337 onLinkActivated: (link) => {
338 if (link.startsWith('param://')) {
339 var paramName = link.substr(8);
340 fact = controller.getParameterFact(-1, paramName, true)
342 paramEditorDialogFactory.open()
345 Qt.openUrlExternally(link);
349 FactPanelController {
353 QGCPopupDialogFactory {
354 id: paramEditorDialogFactory
356 dialogComponent: paramEditorDialogComponent
360 id: paramEditorDialogComponent
362 ParameterEditorDialog {
363 title: qsTr("Edit Parameter")
364 fact: description.fact
375 id: mainStatusExpandedComponent
378 Layout.preferredWidth: ScreenTools.defaultFontPixelWidth * 60
381 property real margins: ScreenTools.defaultFontPixelHeight
384 Layout.fillWidth: true
385 source: _activeVehicle.expandedToolbarIndicatorSource("MainStatus")
388 SettingsGroupLayout {
389 Layout.fillWidth: true
390 heading: qsTr("Force Arm")
391 headingDescription: qsTr("Force arming bypasses pre-arm checks. Use with caution.")
392 visible: _activeVehicle && !_armed
395 Layout.fillWidth: true
396 text: qsTr("Allow Force Arm")
398 onClicked: _allowForceArm = true
402 SettingsGroupLayout {
403 Layout.fillWidth: true
404 visible: QGroundControl.corePlugin.showAdvancedUI
408 rowSpacing: ScreenTools.defaultFontPixelHeight / 2
409 columnSpacing: ScreenTools.defaultFontPixelWidth *2
410 Layout.fillWidth: true
412 QGCLabel { Layout.fillWidth: true; text: qsTr("Vehicle Parameters") }
414 text: qsTr("Configure")
416 mainWindow.showVehicleConfigParametersPage()
417 mainWindow.closeIndicatorDrawer()
421 QGCLabel { Layout.fillWidth: true; text: qsTr("Vehicle Configuration") }
423 text: qsTr("Configure")
425 mainWindow.showVehicleConfig()
426 mainWindow.closeIndicatorDrawer()