diff --git a/src/ui/MainRootWindow.qml b/src/ui/MainRootWindow.qml
index 199f6eb..1b65530 100644
--- a/src/ui/MainRootWindow.qml
+++ b/src/ui/MainRootWindow.qml
@@ -506,15 +506,15 @@ ApplicationWindow {
//-------------------------------------------------------------------------
//-- Critical Vehicle Message Popup
- property var _vehicleMessageQueue: []
- property string _vehicleMessage: ""
-
function showCriticalVehicleMessage(message) {
indicatorPopup.close()
if (criticalVehicleMessagePopup.visible || QGroundControl.videoManager.fullScreen) {
- _vehicleMessageQueue.push(message)
+ // We received additional wanring message while an older warning message was still displayed.
+ // When the user close the older one drop the message indicator tool so they can see the rest of them.
+ criticalVehicleMessagePopup.dropMessageIndicatorOnClose = true
} else {
- _vehicleMessage = message
+ criticalVehicleMessagePopup.criticalVehicleMessage = message
+ criticalVehicleMessagePopup.dropMessageIndicatorOnClose = false
criticalVehicleMessagePopup.open()
}
}
@@ -524,100 +524,85 @@ ApplicationWindow {
y: ScreenTools.defaultFontPixelHeight
x: Math.round((mainWindow.width - width) * 0.5)
width: mainWindow.width * 0.55
- height: ScreenTools.defaultFontPixelHeight * 6
+ height: criticalVehicleMessageText.contentHeight + ScreenTools.defaultFontPixelHeight * 2
modal: false
focus: true
closePolicy: Popup.CloseOnEscape
+ property alias criticalVehicleMessage: criticalVehicleMessageText.text
+ property bool dropMessageIndicatorOnClose: false
+
background: Rectangle {
anchors.fill: parent
color: qgcPal.alertBackground
radius: ScreenTools.defaultFontPixelHeight * 0.5
border.color: qgcPal.alertBorder
border.width: 2
- }
- onOpened: {
- criticalVehicleMessageText.text = mainWindow._vehicleMessage
- }
+ Rectangle {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.top
+ anchors.topMargin: -(height / 2)
+ color: qgcPal.alertBackground
+ radius: ScreenTools.defaultFontPixelHeight * 0.25
+ border.color: qgcPal.alertBorder
+ border.width: 1
+ width: vehicleWarningLabel.contentWidth + _margins
+ height: vehicleWarningLabel.contentHeight + _margins
+
+ property real _margins: ScreenTools.defaultFontPixelHeight * 0.25
- onClosed: {
- //-- Are there messages in the waiting queue?
- if(mainWindow._vehicleMessageQueue.length) {
- mainWindow._vehicleMessage = ""
- //-- Show all messages in queue
- for (var i = 0; i < mainWindow._vehicleMessageQueue.length; i++) {
- var text = mainWindow._vehicleMessageQueue[i]
- if(i) mainWindow._vehicleMessage += "
"
- mainWindow._vehicleMessage += text
+ QGCLabel {
+ id: vehicleWarningLabel
+ anchors.centerIn: parent
+ text: qsTr("Vehicle Error")
+ font.pointSize: ScreenTools.smallFontPointSize
+ color: qgcPal.alertText
}
- //-- Clear it
- mainWindow._vehicleMessageQueue = []
- criticalVehicleMessagePopup.open()
- } else {
- mainWindow._vehicleMessage = ""
}
- }
- Flickable {
- id: criticalVehicleMessageFlick
- anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
- anchors.fill: parent
- contentHeight: criticalVehicleMessageText.height
- contentWidth: criticalVehicleMessageText.width
- boundsBehavior: Flickable.StopAtBounds
- pixelAligned: true
- clip: true
- TextEdit {
- id: criticalVehicleMessageText
- width: criticalVehicleMessagePopup.width - criticalVehicleMessageClose.width - (ScreenTools.defaultFontPixelHeight * 2)
- anchors.centerIn: parent
- readOnly: true
- textFormat: TextEdit.RichText
- font.pointSize: ScreenTools.defaultFontPointSize
- font.family: ScreenTools.demiboldFontFamily
- wrapMode: TextEdit.WordWrap
- color: qgcPal.alertText
- }
- }
+ Rectangle {
+ id: additionalErrorsIndicator
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: -(height / 2)
+ color: qgcPal.alertBackground
+ radius: ScreenTools.defaultFontPixelHeight * 0.25
+ border.color: qgcPal.alertBorder
+ border.width: 1
+ width: additionalErrorsLabel.contentWidth + _margins
+ height: additionalErrorsLabel.contentHeight + _margins
+ visible: criticalVehicleMessagePopup.dropMessageIndicatorOnClose
+
+ property real _margins: ScreenTools.defaultFontPixelHeight * 0.25
- //-- Dismiss Vehicle Message
- QGCColoredImage {
- id: criticalVehicleMessageClose
- anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
- anchors.top: parent.top
- anchors.right: parent.right
- width: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 1.5 : ScreenTools.defaultFontPixelHeight
- height: width
- sourceSize.height: width
- source: "/res/XDelete.svg"
- fillMode: Image.PreserveAspectFit
- color: qgcPal.alertText
- MouseArea {
- anchors.fill: parent
- anchors.margins: -ScreenTools.defaultFontPixelHeight
- onClicked: {
- criticalVehicleMessagePopup.close()
+ QGCLabel {
+ id: additionalErrorsLabel
+ anchors.centerIn: parent
+ text: qsTr("Additional errors received")
+ font.pointSize: ScreenTools.smallFontPointSize
+ color: qgcPal.alertText
}
}
}
- //-- More text below indicator
- QGCColoredImage {
- anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
- anchors.bottom: parent.bottom
- anchors.right: parent.right
- width: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 1.5 : ScreenTools.defaultFontPixelHeight
- height: width
- sourceSize.height: width
- source: "/res/ArrowDown.svg"
- fillMode: Image.PreserveAspectFit
- visible: criticalVehicleMessageText.lineCount > 5
+ QGCLabel {
+ id: criticalVehicleMessageText
+ width: criticalVehicleMessagePopup.width - ScreenTools.defaultFontPixelHeight
+ anchors.centerIn: parent
+ wrapMode: Text.WordWrap
color: qgcPal.alertText
- MouseArea {
- anchors.fill: parent
- onClicked: {
- criticalVehicleMessageFlick.flick(0,-500)
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ criticalVehicleMessagePopup.close()
+ console.log("Clicked", criticalVehicleMessagePopup.dropMessageIndicatorOnClose);
+ if (criticalVehicleMessagePopup.dropMessageIndicatorOnClose) {
+ criticalVehicleMessagePopup.dropMessageIndicatorOnClose = false;
+ QGroundControl.multiVehicleManager.activeVehicle.resetErrorLevelMessages();
+ toolbar.dropMessageIndicatorTool();
}
}
}
diff --git a/src/ui/toolbar/MainToolBar.qml b/src/ui/toolbar/MainToolBar.qml
index d1069c2..9a183ff 100644
--- a/src/ui/toolbar/MainToolBar.qml
+++ b/src/ui/toolbar/MainToolBar.qml
@@ -33,6 +33,12 @@ Rectangle {
property bool _communicationLost: _activeVehicle ? _activeVehicle.vehicleLinkManager.communicationLost : false
property color _mainStatusBGColor: qgcPal.brandingPurple
+ function dropMessageIndicatorTool() {
+ if (currentToolbar === flyViewToolbar) {
+ indicatorLoader.item.dropMessageIndicatorTool();
+ }
+ }
+
QGCPalette { id: qgcPal }
/// Bottom single pixel divider
diff --git a/src/ui/toolbar/MainToolBarIndicators.qml b/src/ui/toolbar/MainToolBarIndicators.qml
index 1434244..7a384a4 100644
--- a/src/ui/toolbar/MainToolBarIndicators.qml
+++ b/src/ui/toolbar/MainToolBarIndicators.qml
@@ -24,6 +24,10 @@ Row {
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property real _toolIndicatorMargins: ScreenTools.defaultFontPixelHeight * 0.66
+ function dropMessageIndicatorTool() {
+ toolIndicatorsRepeater.dropMessageIndicatorTool();
+ }
+
Repeater {
id: appRepeater
model: QGroundControl.corePlugin.toolBarIndicators
@@ -36,7 +40,18 @@ Row {
}
Repeater {
- model: _activeVehicle ? _activeVehicle.toolIndicators : []
+ id: toolIndicatorsRepeater
+ model: _activeVehicle ? _activeVehicle.toolIndicators : []
+
+ function dropMessageIndicatorTool() {
+ for (var i=0; i