5import QGroundControl.Controls
9 spacing: ScreenTools.defaultFontPixelWidth
11 property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
12 property var _guidedController: globals.guidedControllerFlyView
13 property bool _armed: _activeVehicle ? _activeVehicle.armed : false
14 property real _margins: ScreenTools.defaultFontPixelWidth
15 property real _spacing: ScreenTools.defaultFontPixelWidth / 2
16 property bool _healthAndArmingChecksSupported: _activeVehicle ? _activeVehicle.healthAndArmingCheckReport.supported : false
17 property var _readiness: _activeVehicle ? _activeVehicle.readiness : null
18 property bool _vehicleSyncing: _readiness ? _readiness.status === VehicleReadiness.Status.Syncing : false
19 property var _vehicleInAir: _activeVehicle ? _activeVehicle.airborne || _activeVehicle.landing : false
20 property bool _vtolInFWDFlight: _activeVehicle ? _activeVehicle.vtolInFwdFlight : false
21 property bool _rebootRequired: _activeVehicle ? _activeVehicle.rebootRequired : false
22 property bool _checklistEnabled: QGroundControl.settingsManager.appSettings.useChecklist.rawValue
23 property bool _preVehicleChecklistActive: _checklistEnabled && !!preVehicleLoader.item && preVehicleLoader.item.hasGroups
24 property bool _preVehiclePassed: !preVehicleLoader.item || preVehicleLoader.item.allChecksPassed
25 property bool _flownSinceArming: false
26 property bool _checklistComplete: _activeVehicle ? _activeVehicle.checkListState === Vehicle.CheckListPassed : false
27 // The checklist is pre-flight, so an unfinished one is not flagged once armed
28 property bool _checklistWarning: _checklistEnabled && !!_activeVehicle && !_checklistComplete && !_armed
29 // Pre-vehicle checks are the only checks which can be pending while disconnected
30 property bool _preVehicleWarning: _preVehicleChecklistActive && !_preVehiclePassed
31 property bool _anyChecklistWarning: _activeVehicle ? _checklistWarning : _preVehicleWarning
32 property int _healthErrorCount: _healthAndArmingChecksSupported ?
33 _activeVehicle.healthAndArmingCheckReport.errorCount : 0
34 property int _healthWarningCount: _healthAndArmingChecksSupported ?
35 _activeVehicle.healthAndArmingCheckReport.warningCount : 0
37 readonly property int tabChecklist: 0
38 readonly property int tabMessages: 1
39 readonly property int tabStatus: 2
41 property int _initialTab: -1
43 // Raised when the dropdown is already open and should switch tabs
44 signal tabRequested(int tab)
46 function dropMainStatusIndicator(showMessages = false) {
47 _initialTab = showMessages ? tabMessages : -1
48 let overallStatusComponent = _activeVehicle ? overallStatusIndicatorPage : overallStatusOfflineIndicatorPage
49 mainWindow.showIndicatorDrawer(overallStatusComponent, control)
50 if (_initialTab !== -1) {
51 tabRequested(_initialTab)
55 QGCPalette { id: qgcPal }
57 // Lives here rather than in the dropdown so checklist progress survives the dropdown closing
61 active: _checklistEnabled
62 source: "qrc:/qml/QGroundControl/FlyView/PreVehicleCheckList.qml"
68 active: _checklistEnabled && !!_activeVehicle
69 source: "qrc:/qml/QGroundControl/FlyView/PreFlightCheckList.qml"
71 // The vehicle may still hold the Passed state of the previous checklist, so sync it to the new one
74 _activeVehicle.checkListState = item.checklistPassed === true ? Vehicle.CheckListPassed : Vehicle.CheckListNotSetup
80 target: checklistLoader.item
81 property: "prerequisitesPassed"
82 value: _preVehiclePassed
83 when: !!checklistLoader.item
86 // Each sortie starts with a clean checklist, but only when pre-vehicle checks make the previous one stale.
87 // Pre-vehicle checks only support a single vehicle: flights are tracked on the active vehicle only, so one which
88 // is airborne or lands while another vehicle is selected does not reset them.
90 target: _activeVehicle
92 function onAirborneChanged(airborne) {
94 _flownSinceArming = true
98 function onArmedChanged(armed) {
99 if (armed || !_flownSinceArming) {
102 _flownSinceArming = false
103 if (_preVehicleChecklistActive) {
104 preVehicleLoader.item.reset()
105 if (checklistLoader.item) {
106 checklistLoader.item.reset()
112 on_ActiveVehicleChanged: _flownSinceArming = false
116 objectName: "mainStatusText"
117 Layout.fillHeight: true
118 Layout.preferredWidth: Math.max(contentWidth + leftPadding + rightPadding, badgeRow.width)
119 leftPadding: ScreenTools.defaultFontPixelWidth / 2
120 rightPadding: ScreenTools.defaultFontPixelWidth / 2
121 horizontalAlignment: Text.AlignRight
122 verticalAlignment: Text.AlignVCenter
123 text: mainStatusText()
124 color: qgcPal.textPrimary
125 font.pointSize: ScreenTools.largeFontPointSize
127 property string _commLostText: qsTr("Comms Lost")
128 property string _readyToFlyText: qsTr("Ready")
129 property string _notReadyToFlyText: qsTr("Not Ready")
130 property string _disconnectedText: qsTr("Disconnected - Click to manually connect")
131 property string _armedText: qsTr("Armed")
132 property string _flyingText: qsTr("Flying")
133 property string _landingText: qsTr("Landing")
135 function mainStatusText() {
136 if (_activeVehicle) {
137 if (_communicationLost) {
138 _mainStatusBGColor = "red"
139 return mainStatusLabel._commLostText
142 const readinessStatus = _readiness ? _readiness.status : VehicleReadiness.Status.Unknown
143 const healthWarnings = _healthAndArmingChecksSupported &&
144 _activeVehicle.healthAndArmingCheckReport.hasWarningsOrErrors
146 if (_activeVehicle.armed) {
147 if (readinessStatus === VehicleReadiness.Status.NotReady) {
148 _mainStatusBGColor = "red"
149 } else if (healthWarnings || readinessStatus === VehicleReadiness.Status.Unknown || _vehicleSyncing) {
150 _mainStatusBGColor = "yellow"
152 _mainStatusBGColor = "green"
155 if (_activeVehicle.underway) {
156 return mainStatusLabel._flyingText
157 } else if (_activeVehicle.landing) {
158 return mainStatusLabel._landingText
160 return mainStatusLabel._armedText
164 if (readinessStatus === VehicleReadiness.Status.Ready) {
165 _mainStatusBGColor = healthWarnings ? "yellow" : "green"
166 return mainStatusLabel._readyToFlyText
168 _mainStatusBGColor = (readinessStatus === VehicleReadiness.Status.NotReady) ? "red" : "yellow"
169 return mainStatusLabel._notReadyToFlyText
171 _mainStatusBGColor = qgcPal.brandPrimary
172 return mainStatusLabel._disconnectedText
178 anchors.top: parent.top
180 anchors.right: parent.right
181 spacing: ScreenTools.defaultFontPixelWidth * 0.25
184 id: firmwareUpdateBadge
185 objectName: "mainStatusFirmwareUpdateBadge"
187 height: severityBadge.height
189 color: Qt.rgba(1, 1, 1, 0.75)
190 visible: _activeVehicle && !_vehicleSyncing && _activeVehicle.newStableFirmwareVersion !== "" && !_activeVehicle.newStableFirmwareVersionAcknowledged
194 source: "/res/UpdateAvailable.svg"
195 color: qgcPal.colorBlue
200 objectName: "mainStatusRebootBadge"
202 color: qgcPal.colorOrange
203 visible: _rebootRequired && !_vehicleSyncing
206 // Other errors or warnings take the severity pill over, so the incomplete checklist gets its own pill beside it
209 objectName: "mainStatusChecklistBadge"
210 text: qsTr("Pre-Flight")
211 color: qgcPal.warningIndicator
212 visible: !_vehicleSyncing && _anyChecklistWarning && !severityBadge.namesChecklist
215 // Worst state across the dropdown tabs: messages, health and arming checks, and the pre-flight checklist
218 objectName: "mainStatusSeverityBadge"
219 errorCount: _activeVehicle ? _activeVehicle.unreadCriticalMessageCount + _healthErrorCount : 0
220 warningCount: _activeVehicle ? _activeVehicle.unreadWarningMessageCount + _healthWarningCount +
221 (_checklistWarning ? 1 : 0) : (_preVehicleWarning ? 1 : 0)
222 unreadCount: _activeVehicle ? _activeVehicle.unreadMessageCount : 0
223 warningLabel: namesChecklist ? qsTr("Pre-Flight") : qsTr("Warning")
224 visible: !_vehicleSyncing && text.length > 0
226 readonly property bool namesChecklist: _anyChecklistWarning && severity === "warning" && warningCount === 1
229 // Takes the place of every other badge until initial connect completes
232 objectName: "mainStatusVehicleSyncBadge"
233 text: qsTr("Vehicle Sync")
234 color: qgcPal.warningIndicator
235 visible: _vehicleSyncing
241 onClicked: dropMainStatusIndicator()
247 Layout.fillHeight: true
248 verticalAlignment: Text.AlignVCenter
249 text: _vtolInFWDFlight ? qsTr("FW(vtol)") : qsTr("MR(vtol)")
250 color: qgcPal.textPrimary
251 font.pointSize: _vehicleInAir ? ScreenTools.largeFontPointSize : ScreenTools.defaultFontPointSize
252 visible: _activeVehicle && _activeVehicle.vtol
258 mainWindow.showIndicatorDrawer(vtolTransitionIndicatorPage)
265 id: overallStatusOfflineIndicatorPage
267 MainStatusIndicatorOfflinePage {
268 preVehicleChecklistLoader: preVehicleLoader
269 showChecklist: _preVehicleChecklistActive
271 Component.onCompleted: mainWindow.suppressCriticalVehicleMessages = true
272 Component.onDestruction: mainWindow.suppressCriticalVehicleMessages = false
277 id: overallStatusIndicatorPage
280 waitForParameters: false
282 contentComponent: mainStatusContentComponent
287 id: mainStatusContentComponent
293 property bool parametersReady: QGroundControl.multiVehicleManager.parameterReadyVehicleAvailable
295 // Only the Messages tab shows critical messages, so only then is the popup redundant
298 property: "suppressCriticalVehicleMessages"
299 value: mainLayout.visible && statusTabs.currentIndex === control.tabMessages
304 function onTabRequested(tab) { statusTabs.currentIndex = tab }
308 Layout.fillWidth: true
309 heading: qsTr("Commands")
311 // Stop controls must stay reachable without parameters
312 visible: parametersReady || _guidedController.showEmergencyStop || _guidedController.showDisarm || _rebootRequired
315 spacing: ScreenTools.defaultFontPixelWidth
318 objectName: "mainStatusArmButton"
319 enabled: _armed || (_guidedController.showArm && _guidedController.armReady)
320 text: _armed ? qsTr("Disarm") : qsTr("Arm")
321 visible: _armed ? _guidedController.showDisarm : parametersReady
324 _activeVehicle.armed = !_armed
325 mainWindow.closeIndicatorDrawer()
330 objectName: "mainStatusEmergencyStopButton"
331 text: qsTr("Emergency Stop")
332 backgroundColor: qgcPal.colorRed
333 textColor: qgcPal.accentText
334 fontWeight: Font.Bold
335 visible: _guidedController.showEmergencyStop
338 _guidedController.confirmAction(_guidedController.actionEmergencyStop)
339 mainWindow.closeIndicatorDrawer()
344 text: qsTr("Force Arm")
345 visible: parametersReady && _guidedController.showForceArm
348 _activeVehicle.forceArm()
349 mainWindow.closeIndicatorDrawer()
355 Layout.alignment: Qt.AlignTop
356 label: qsTr("Primary Link")
357 alternateText: _primaryLinkName
358 visible: parametersReady && _activeVehicle && _activeVehicle.vehicleLinkManager.linkNames.length > 1
360 property var _rgLinkNames: _activeVehicle ? _activeVehicle.vehicleLinkManager.linkNames : [ ]
361 property var _rgLinkStatus: _activeVehicle ? _activeVehicle.vehicleLinkManager.linkStatuses : [ ]
362 property string _primaryLinkName: _activeVehicle ? _activeVehicle.vehicleLinkManager.primaryLinkName : ""
364 function updateComboModel() {
366 for (let i = 0; i < _rgLinkNames.length; i++) {
367 let linkStatus = _rgLinkStatus[i]
368 linkModel.push(_rgLinkNames[i] + (linkStatus === "" ? "" : " " + _rgLinkStatus[i]))
370 primaryLinkCombo.model = linkModel
371 primaryLinkCombo.currentIndex = -1
374 Component.onCompleted: updateComboModel()
375 on_RgLinkNamesChanged: updateComboModel()
376 on_RgLinkStatusChanged: updateComboModel()
378 onActivated: (index) => {
379 _activeVehicle.vehicleLinkManager.primaryLinkName = _rgLinkNames[index]; currentIndex = -1
380 mainWindow.closeIndicatorDrawer()
385 Layout.maximumWidth: ScreenTools.defaultFontPixelWidth * 16
386 Layout.maximumHeight: rebootButton.height
387 text: qsTr("Reboot required for changes to take effect")
388 font.pointSize: ScreenTools.smallFontPointSize
389 wrapMode: Text.WordWrap
390 elide: Text.ElideRight
391 horizontalAlignment: Text.AlignRight
392 visible: _rebootRequired && !_armed
396 objectName: "mainStatusRebootDisarmLabel"
397 Layout.maximumWidth: ScreenTools.defaultFontPixelWidth * 16
398 Layout.maximumHeight: rebootButton.height
399 text: qsTr("Reboot required. Disarm vehicle first.")
400 font.pointSize: ScreenTools.smallFontPointSize
401 wrapMode: Text.WordWrap
402 elide: Text.ElideRight
403 horizontalAlignment: Text.AlignRight
404 visible: _rebootRequired && _armed
409 objectName: "mainStatusRebootButton"
410 text: qsTr("Reboot Vehicle")
411 visible: _rebootRequired && !_armed
414 _activeVehicle.rebootVehicle()
415 mainWindow.closeIndicatorDrawer()
422 Layout.fillWidth: true
423 spacing: ScreenTools.defaultFontPixelWidth
424 visible: _activeVehicle && _activeVehicle.newStableFirmwareVersion !== ""
427 objectName: "mainStatusFirmwareUpdateLabel"
428 text: _activeVehicle ? qsTr("Firmware update available: %1.%2.%3 → %4")
429 .arg(_activeVehicle.firmwareMajorVersion)
430 .arg(_activeVehicle.firmwareMinorVersion)
431 .arg(_activeVehicle.firmwarePatchVersion)
432 .arg(_activeVehicle.newStableFirmwareVersion) : ""
436 objectName: "mainStatusFirmwareUpdateAckButton"
438 text: qsTr("Acknowledge and Hide")
439 visible: _activeVehicle && !_activeVehicle.newStableFirmwareVersionAcknowledged
440 onClicked: _activeVehicle.acknowledgeNewStableFirmwareVersion()
446 Layout.fillWidth: true
448 contentSpacing: _spacing
450 Component.onCompleted: {
451 if (control._initialTab !== -1) {
452 currentIndex = control._initialTab
454 currentIndex = (_checklistEnabled && !_checklistComplete) ? control.tabChecklist : control.tabStatus
459 title: qsTr("Pre-Flight Checklist")
460 buttonObjectName: "mainStatusChecklistTab"
461 tabVisible: _checklistEnabled
463 objectName: "mainStatusChecklistTabBadge"
464 text: _checklistComplete ? qsTr("Passed") : qsTr("In Progress")
465 color: _checklistComplete ? QGroundControl.globalPalette.successIndicator : QGroundControl.globalPalette.warningIndicator
468 MainStatusChecklistHost {
469 loader: preVehicleLoader
470 visible: _preVehicleChecklistActive
473 MainStatusChecklistHost {
474 loader: checklistLoader
479 title: qsTr("Vehicle Messages")
480 buttonObjectName: "mainStatusMessagesTab"
481 badge: SeverityPill {
482 objectName: "mainStatusMessagesTabBadge"
483 errorCount: _activeVehicle ? _activeVehicle.unreadCriticalMessageCount : 0
484 warningCount: _activeVehicle ? _activeVehicle.unreadWarningMessageCount : 0
485 unreadCount: _activeVehicle ? _activeVehicle.unreadMessageCount : 0
489 Layout.fillWidth: true
490 spacing: ScreenTools.defaultFontPixelHeight / 4
493 Layout.fillWidth: true
494 spacing: ScreenTools.defaultFontPixelWidth / 2
495 visible: !vehicleMessageList.noMessages
497 Item { Layout.fillWidth: true }
500 objectName: "vehicleMessagesMarkReadButton"
502 text: qsTr("Mark as Read")
503 visible: _activeVehicle && _activeVehicle.hasUnreadMessages
504 onClicked: _activeVehicle.markMessagesRead()
508 objectName: "vehicleMessagesClearButton"
512 _activeVehicle.clearMessages()
513 mainWindow.closeIndicatorDrawer()
519 id: vehicleMessageList
520 Layout.fillWidth: true
525 text: qsTr("No new vehicle messages")
526 visible: vehicleMessageList.noMessages
532 title: qsTr("Overall Status")
533 buttonObjectName: "mainStatusOverallStatusTab"
534 badge: SeverityPill {
535 objectName: "mainStatusOverallStatusTabBadge"
536 errorCount: _healthErrorCount
537 warningCount: _healthWarningCount
543 columnSpacing: _spacing
544 rows: _activeVehicle.sysStatusSensorInfo.sensorNames.length
545 flow: GridLayout.TopToBottom
546 visible: parametersReady && !_healthAndArmingChecksSupported
549 model: _activeVehicle.sysStatusSensorInfo.sensorNames
550 QGCLabel { text: modelData }
554 model: _activeVehicle.sysStatusSensorInfo.sensorStatus
555 QGCLabel { text: modelData }
560 id: overallStatusList
561 Layout.fillWidth: true
563 visible: parametersReady && _healthAndArmingChecksSupported &&
564 _activeVehicle.healthAndArmingCheckReport.problemsForCurrentMode.count > 0
567 objectName: "healthChecksAcknowledgeAllButton"
568 Layout.alignment: Qt.AlignRight
570 text: qsTr("Acknowledge All Warnings")
571 visible: _healthWarningCount > 0
572 onClicked: _activeVehicle.healthAndArmingCheckReport.acknowledgeAllWarnings()
575 // List health and arming checks
577 model: _activeVehicle ? _activeVehicle.healthAndArmingCheckReport.problemsForCurrentMode : null
578 delegate: listdelegate
583 text: parametersReady ? qsTr("No status issues") : qsTr("Waiting for parameters...")
584 visible: !sensorStatusGrid.visible && !overallStatusList.visible
593 Layout.fillWidth: true
597 Layout.fillWidth: true
598 spacing: ScreenTools.defaultFontPixelHeight
602 Layout.fillWidth: true
604 textFormat: TextEdit.RichText
605 wrapMode: Text.WordWrap
606 color: object.severity == 'error' ? qgcPal.errorText : (object.severity == 'warning' && !object.acknowledged) ? qgcPal.warningText : qgcPal.textPrimary
607 opacity: object.acknowledged ? 0.6 : 1
611 if (object.description != "")
612 object.expanded = !object.expanded
618 Layout.alignment: Qt.AlignVCenter
619 text: qsTr("Acknowledged")
620 font.pointSize: ScreenTools.smallFontPointSize
622 visible: object.acknowledged
626 id: arrowDownIndicator
627 Layout.alignment: Qt.AlignVCenter
628 Layout.preferredHeight: 1.5 * ScreenTools.defaultFontPixelWidth
629 Layout.preferredWidth: Layout.preferredHeight
630 source: "/qmlimages/arrow-down.png"
631 color: qgcPal.textPrimary
632 visible: object.description != ""
635 onClicked: object.expanded = !object.expanded
642 Layout.fillWidth: true
643 text: object.description
644 textFormat: TextEdit.RichText
645 wrapMode: Text.WordWrap
647 visible: object.expanded
649 property var fact: null
651 onLinkActivated: (link) => {
652 if (link.startsWith('param://')) {
653 var paramName = link.substr(8);
654 fact = controller.getParameterFact(-1, paramName, true)
656 paramEditorDialogFactory.open()
659 Qt.openUrlExternally(link);
663 FactPanelController {
667 QGCPopupDialogFactory {
668 id: paramEditorDialogFactory
670 dialogComponent: paramEditorDialogComponent
674 id: paramEditorDialogComponent
676 ParameterEditorDialog {
677 title: qsTr("Edit Parameter")
678 fact: description.fact