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()
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.text
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)")
147 font.pointSize: _vehicleInAir ? ScreenTools.largeFontPointSize : ScreenTools.defaultFontPointSize
148 visible: _activeVehicle && _activeVehicle.vtol
154 mainWindow.showIndicatorDrawer(vtolTransitionIndicatorPage)
161 id: overallStatusOfflineIndicatorPage
163 MainStatusIndicatorOfflinePage {
164 Component.onCompleted: mainWindow.suppressCriticalVehicleMessages = true
165 Component.onDestruction: mainWindow.suppressCriticalVehicleMessages = false
170 id: overallStatusIndicatorPage
174 waitForParameters: false
175 expandedComponentWaitForParameters: true
176 contentComponent: mainStatusContentComponent
177 expandedComponent: mainStatusExpandedComponent
179 Component.onCompleted: mainWindow.suppressCriticalVehicleMessages = true
180 Component.onDestruction: mainWindow.suppressCriticalVehicleMessages = false
185 id: mainStatusContentComponent
191 property bool parametersReady: QGroundControl.multiVehicleManager.parameterReadyVehicleAvailable
194 spacing: ScreenTools.defaultFontPixelWidth
195 visible: parametersReady
198 enabled: _armed || !_healthAndArmingChecksSupported || _activeVehicle.healthAndArmingCheckReport.canArm
199 text: _armed ? qsTr("Disarm") : (control._allowForceArm ? qsTr("Force Arm") : qsTr("Arm"))
203 _activeVehicle.armed = false
205 if (_allowForceArm) {
206 _allowForceArm = false
207 _activeVehicle.forceArm()
209 _activeVehicle.armed = true
212 mainWindow.closeIndicatorDrawer()
218 Layout.alignment: Qt.AlignTop
219 label: qsTr("Primary Link")
220 alternateText: _primaryLinkName
221 visible: _activeVehicle && _activeVehicle.vehicleLinkManager.linkNames.length > 1
223 property var _rgLinkNames: _activeVehicle ? _activeVehicle.vehicleLinkManager.linkNames : [ ]
224 property var _rgLinkStatus: _activeVehicle ? _activeVehicle.vehicleLinkManager.linkStatuses : [ ]
225 property string _primaryLinkName: _activeVehicle ? _activeVehicle.vehicleLinkManager.primaryLinkName : ""
227 function updateComboModel() {
229 for (let i = 0; i < _rgLinkNames.length; i++) {
230 let linkStatus = _rgLinkStatus[i]
231 linkModel.push(_rgLinkNames[i] + (linkStatus === "" ? "" : " " + _rgLinkStatus[i]))
233 primaryLinkCombo.model = linkModel
234 primaryLinkCombo.currentIndex = -1
237 Component.onCompleted: updateComboModel()
238 on_RgLinkNamesChanged: updateComboModel()
239 on_RgLinkStatusChanged: updateComboModel()
241 onActivated: (index) => {
242 _activeVehicle.vehicleLinkManager.primaryLinkName = _rgLinkNames[index]; currentIndex = -1
243 mainWindow.closeIndicatorDrawer()
248 SettingsGroupLayout {
249 //Layout.fillWidth: true
250 heading: qsTr("Vehicle Messages")
253 id: vehicleMessageList
258 text: qsTr("No new vehicle messages")
259 visible: vehicleMessageList.noMessages
263 SettingsGroupLayout {
264 //Layout.fillWidth: true
265 heading: qsTr("Sensor Status")
266 visible: parametersReady && !_healthAndArmingChecksSupported
270 columnSpacing: _spacing
271 rows: _activeVehicle.sysStatusSensorInfo.sensorNames.length
272 flow: GridLayout.TopToBottom
275 model: _activeVehicle.sysStatusSensorInfo.sensorNames
276 QGCLabel { text: modelData }
280 model: _activeVehicle.sysStatusSensorInfo.sensorStatus
281 QGCLabel { text: modelData }
286 SettingsGroupLayout {
287 //Layout.fillWidth: true
288 heading: qsTr("Overall Status")
289 visible: parametersReady && _healthAndArmingChecksSupported && _activeVehicle.healthAndArmingCheckReport.problemsForCurrentMode.count > 0
291 // List health and arming checks
293 model: _activeVehicle ? _activeVehicle.healthAndArmingCheckReport.problemsForCurrentMode : null
294 delegate: listdelegate
303 spacing: ScreenTools.defaultFontPixelHeight
308 textFormat: TextEdit.RichText
309 color: object.severity == 'error' ? qgcPal.colorRed : object.severity == 'warning' ? qgcPal.colorOrange : qgcPal.text
313 if (object.description != "")
314 object.expanded = !object.expanded
320 id: arrowDownIndicator
321 anchors.verticalCenter: parent.verticalCenter
322 height: 1.5 * ScreenTools.defaultFontPixelWidth
324 source: "/qmlimages/arrow-down.png"
326 visible: object.description != ""
329 onClicked: object.expanded = !object.expanded
336 text: object.description
337 textFormat: TextEdit.RichText
339 visible: object.expanded
341 property var fact: null
343 onLinkActivated: (link) => {
344 if (link.startsWith('param://')) {
345 var paramName = link.substr(8);
346 fact = controller.getParameterFact(-1, paramName, true)
348 paramEditorDialogFactory.open()
351 Qt.openUrlExternally(link);
355 FactPanelController {
359 QGCPopupDialogFactory {
360 id: paramEditorDialogFactory
362 dialogComponent: paramEditorDialogComponent
366 id: paramEditorDialogComponent
368 ParameterEditorDialog {
369 title: qsTr("Edit Parameter")
370 fact: description.fact
381 id: mainStatusExpandedComponent
384 Layout.preferredWidth: ScreenTools.defaultFontPixelWidth * 60
387 property real margins: ScreenTools.defaultFontPixelHeight
390 Layout.fillWidth: true
391 source: _activeVehicle.expandedToolbarIndicatorSource("MainStatus")
394 SettingsGroupLayout {
395 Layout.fillWidth: true
396 heading: qsTr("Force Arm")
397 headingDescription: qsTr("Force arming bypasses pre-arm checks. Use with caution.")
398 visible: _activeVehicle && !_armed
401 Layout.fillWidth: true
402 text: qsTr("Allow Force Arm")
404 onClicked: _allowForceArm = true
408 SettingsGroupLayout {
409 Layout.fillWidth: true
410 visible: QGroundControl.corePlugin.showAdvancedUI
414 rowSpacing: ScreenTools.defaultFontPixelHeight / 2
415 columnSpacing: ScreenTools.defaultFontPixelWidth *2
416 Layout.fillWidth: true
418 QGCLabel { Layout.fillWidth: true; text: qsTr("Vehicle Parameters") }
420 text: qsTr("Configure")
422 mainWindow.showVehicleConfigParametersPage()
423 mainWindow.closeIndicatorDrawer()
427 QGCLabel { Layout.fillWidth: true; text: qsTr("Vehicle Configuration") }
429 text: qsTr("Configure")
431 mainWindow.showVehicleConfig()
432 mainWindow.closeIndicatorDrawer()