Browse Source

New user model for critical vehicle messages

* Popup smaller
* Text indicates these are Vehicle Messages
* If there are additional messages which come in after display closing the popup will dropdown the Message Indicator in the toolbar
QGC4.4
Don Gagne 2 years ago committed by Philipp Borgers
parent
commit
2270c2a37e
  1. 141
      src/ui/MainRootWindow.qml
  2. 6
      src/ui/toolbar/MainToolBar.qml
  3. 17
      src/ui/toolbar/MainToolBarIndicators.qml
  4. 8
      src/ui/toolbar/MessageIndicator.qml

141
src/ui/MainRootWindow.qml

@ -506,15 +506,15 @@ ApplicationWindow { @@ -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 { @@ -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 += "<br>"
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();
}
}
}

6
src/ui/toolbar/MainToolBar.qml

@ -33,6 +33,12 @@ Rectangle { @@ -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

17
src/ui/toolbar/MainToolBarIndicators.qml

@ -24,6 +24,10 @@ Row { @@ -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 { @@ -36,7 +40,18 @@ Row {
}
Repeater {
model: _activeVehicle ? _activeVehicle.toolIndicators : []
id: toolIndicatorsRepeater
model: _activeVehicle ? _activeVehicle.toolIndicators : []
function dropMessageIndicatorTool() {
for (var i=0; i<count; i++) {
var thisTool = itemAt(i);
if (thisTool.item.dropMessageIndicator) {
thisTool.item.dropMessageIndicator();
}
}
}
Loader {
anchors.top: parent.top
anchors.bottom: parent.bottom

8
src/ui/toolbar/MessageIndicator.qml

@ -31,6 +31,10 @@ Item { @@ -31,6 +31,10 @@ Item {
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _isMessageImportant: _activeVehicle ? !_activeVehicle.messageTypeNormal && !_activeVehicle.messageTypeNone : false
function dropMessageIndicator() {
mainWindow.showIndicatorPopup(_root, vehicleMessagesPopup);
}
function getMessageColor() {
if (_activeVehicle) {
if (_activeVehicle.messageTypeNone)
@ -70,7 +74,7 @@ Item { @@ -70,7 +74,7 @@ Item {
MouseArea {
anchors.fill: parent
onClicked: mainWindow.showIndicatorPopup(_root, vehicleMessagesPopup)
onClicked: dropMessageIndicator()
}
Component {
@ -95,7 +99,7 @@ Item { @@ -95,7 +99,7 @@ Item {
//-- Hack to scroll to last message
for (var i = 0; i < _activeVehicle.messageCount; i++)
messageFlick.flick(0,-5000)
_activeVehicle.resetMessages()
_activeVehicle.resetAllMessages()
}
Connections {

Loading…
Cancel
Save