Commit cfe2cf55 authored by dogmaphobic's avatar dogmaphobic

Message Window Cleanup

parent 2896a075
...@@ -126,8 +126,6 @@ ...@@ -126,8 +126,6 @@
<file alias="MapSyncChanged.svg">src/FlightMap/Images/MapSyncChanged.svg</file> <file alias="MapSyncChanged.svg">src/FlightMap/Images/MapSyncChanged.svg</file>
<file alias="MapType.svg">src/FlightMap/Images/MapType.svg</file> <file alias="MapType.svg">src/FlightMap/Images/MapType.svg</file>
<file alias="MapTypeBlack.svg">src/FlightMap/Images/MapTypeBlack.svg</file> <file alias="MapTypeBlack.svg">src/FlightMap/Images/MapTypeBlack.svg</file>
<file alias="TrashDelete.svg">src/FlightMap/Images/TrashDelete.svg</file>
<file alias="TrashDeleteBlack.svg">src/FlightMap/Images/TrashDeleteBlack.svg</file>
<file alias="Armed.svg">src/ui/toolbar/Images/Armed.svg</file> <file alias="Armed.svg">src/ui/toolbar/Images/Armed.svg</file>
<file alias="Battery.svg">src/ui/toolbar/Images/Battery.svg</file> <file alias="Battery.svg">src/ui/toolbar/Images/Battery.svg</file>
<file alias="Connect.svg">src/ui/toolbar/Images/Connect.svg</file> <file alias="Connect.svg">src/ui/toolbar/Images/Connect.svg</file>
...@@ -174,6 +172,7 @@ ...@@ -174,6 +172,7 @@
<file alias="QGroundControlConnect">resources/QGroundControlConnect.svg</file> <file alias="QGroundControlConnect">resources/QGroundControlConnect.svg</file>
<file alias="SplashScreen">resources/SplashScreen.png</file> <file alias="SplashScreen">resources/SplashScreen.png</file>
<file alias="Stop">resources/Stop.svg</file> <file alias="Stop">resources/Stop.svg</file>
<file alias="TrashDelete.svg">resources/TrashDelete.svg</file>
<file alias="XDelete.svg">resources/XDelete.svg</file> <file alias="XDelete.svg">resources/XDelete.svg</file>
<file alias="XDeleteBlack.svg">resources/XDeleteBlack.svg</file> <file alias="XDeleteBlack.svg">resources/XDeleteBlack.svg</file>
</qresource> </qresource>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <!-- Generator: Adobe Illustrator 19.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="-89 46 72 72" enable-background="new -89 46 72 72" xml:space="preserve"> viewBox="-89 46 72 72" enable-background="new -89 46 72 72" xml:space="preserve">
<g> <rect x="-78.911" y="46" fill="#FFFFFF" width="51.822" height="10.66"/>
<path fill="none" d="M-71.309,68.986"/> <path fill="#FFFFFF" d="M-27.089,59.781h-51.822V118h51.822L-27.089,59.781L-27.089,59.781z M-33.927,110.332h-7.17V68.068h7.17
</g> V110.332z M-49.416,110.332h-7.17V68.068h7.17V110.332z M-64.245,110.332h-7.17V68.068h7.17V110.332z"/>
<rect x="-64.709" y="65.8" fill="#FFFFFF" width="23.417" height="4.797"/> </svg>
<path fill="#FFFFFF" d="M-41.291,72.001h-23.417V98.2h23.417L-41.291,72.001L-41.291,72.001z M-44.381,94.749h-3.24V75.731h3.24
V94.749z M-51.38,94.749h-3.24V75.731h3.24V94.749z M-58.081,94.749h-3.24V75.731h3.24V94.749z"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="-89 46 72 72" enable-background="new -89 46 72 72" xml:space="preserve">
<g>
<path fill="none" d="M-71.309,68.986"/>
</g>
<rect x="-64.709" y="65.8" fill="#231F20" width="23.417" height="4.797"/>
<path fill="#231F20" d="M-41.291,72.001h-23.417V98.2h23.417L-41.291,72.001L-41.291,72.001z M-44.381,94.749h-3.24V75.731h3.24
V94.749z M-51.38,94.749h-3.24V75.731h3.24V94.749z M-58.081,94.749h-3.24V75.731h3.24V94.749z"/>
</svg>
...@@ -922,6 +922,11 @@ QString Vehicle::formatedMessages() ...@@ -922,6 +922,11 @@ QString Vehicle::formatedMessages()
return messages; return messages;
} }
void Vehicle::clearMessages()
{
qgcApp()->toolbox()->uasMessageHandler()->clearMessages();
}
void Vehicle::_handletextMessageReceived(UASMessage* message) void Vehicle::_handletextMessageReceived(UASMessage* message)
{ {
if(message) if(message)
......
...@@ -363,6 +363,9 @@ public: ...@@ -363,6 +363,9 @@ public:
/// Reboot vehicle /// Reboot vehicle
Q_INVOKABLE void rebootVehicle(); Q_INVOKABLE void rebootVehicle();
/// Clear Messages
Q_INVOKABLE void clearMessages();
bool guidedModeSupported(void) const; bool guidedModeSupported(void) const;
bool pauseVehicleSupported(void) const; bool pauseVehicleSupported(void) const;
......
...@@ -349,13 +349,11 @@ Item { ...@@ -349,13 +349,11 @@ Item {
//-- System Message Area //-- System Message Area
Rectangle { Rectangle {
id: messageArea id: messageArea
function close() { function close() {
currentPopUp = null currentPopUp = null
messageText.text = "" messageText.text = ""
messageArea.visible = false messageArea.visible = false
} }
width: mainWindow.width * 0.5 width: mainWindow.width * 0.5
height: mainWindow.height * 0.5 height: mainWindow.height * 0.5
color: Qt.rgba(0,0,0,0.8) color: Qt.rgba(0,0,0,0.8)
...@@ -366,6 +364,13 @@ Item { ...@@ -366,6 +364,13 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: tbHeight + ScreenTools.defaultFontPixelHeight anchors.topMargin: tbHeight + ScreenTools.defaultFontPixelHeight
MouseArea {
// This MouseArea prevents the Map below it from getting Mouse events. Without this
// things like mousewheel will scroll the Flickable and then scroll the map as well.
anchors.fill: parent
preventStealing: true
onWheel: wheel.accepted = true
}
QGCFlickable { QGCFlickable {
id: messageFlick id: messageFlick
anchors.margins: ScreenTools.defaultFontPixelHeight anchors.margins: ScreenTools.defaultFontPixelHeight
...@@ -383,7 +388,7 @@ Item { ...@@ -383,7 +388,7 @@ Item {
} }
//-- Dismiss System Message //-- Dismiss System Message
Image { Image {
//anchors.margins: ScreenTools.defaultFontPixelHeight anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
anchors.top: parent.top anchors.top: parent.top
anchors.right: parent.right anchors.right: parent.right
width: ScreenTools.isTinyScreen ? ScreenTools.defaultFontPixelHeight * 1.5 : ScreenTools.defaultFontPixelHeight width: ScreenTools.isTinyScreen ? ScreenTools.defaultFontPixelHeight * 1.5 : ScreenTools.defaultFontPixelHeight
...@@ -400,7 +405,30 @@ Item { ...@@ -400,7 +405,30 @@ Item {
} }
} }
} }
//-- Clear Messages
Image {
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
height: ScreenTools.isTinyScreen ? ScreenTools.defaultFontPixelHeight * 1.5 : ScreenTools.defaultFontPixelHeight
width: height
sourceSize.height: height
source: "/res/TrashDelete.svg"
fillMode: Image.PreserveAspectFit
mipmap: true
smooth: true
MouseArea {
anchors.fill: parent
onClicked: {
if(QGroundControl.multiVehicleManager.activeVehicleAvailable) {
activeVehicle.clearMessages();
messageArea.close()
}
}
}
}
} }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//-- Critical Message Area //-- Critical Message Area
Rectangle { Rectangle {
...@@ -468,7 +496,7 @@ Item { ...@@ -468,7 +496,7 @@ Item {
//-- Dismiss Critical Message //-- Dismiss Critical Message
QGCColoredImage { QGCColoredImage {
id: criticalClose id: criticalClose
anchors.margins: ScreenTools.defaultFontPixelHeight anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
anchors.top: parent.top anchors.top: parent.top
anchors.right: parent.right anchors.right: parent.right
width: ScreenTools.isTinyScreen ? ScreenTools.defaultFontPixelHeight * 1.5 : ScreenTools.defaultFontPixelHeight width: ScreenTools.isTinyScreen ? ScreenTools.defaultFontPixelHeight * 1.5 : ScreenTools.defaultFontPixelHeight
...@@ -487,7 +515,7 @@ Item { ...@@ -487,7 +515,7 @@ Item {
//-- More text below indicator //-- More text below indicator
QGCColoredImage { QGCColoredImage {
anchors.margins: ScreenTools.defaultFontPixelHeight anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
width: ScreenTools.isTinyScreen ? ScreenTools.defaultFontPixelHeight * 1.5 : ScreenTools.defaultFontPixelHeight width: ScreenTools.isTinyScreen ? ScreenTools.defaultFontPixelHeight * 1.5 : ScreenTools.defaultFontPixelHeight
......
...@@ -87,7 +87,11 @@ void UASMessageViewWidget::handleTextMessage(UASMessage *message) ...@@ -87,7 +87,11 @@ void UASMessageViewWidget::handleTextMessage(UASMessage *message)
// Turn off updates while we're appending content to avoid breaking the autoscroll behavior // Turn off updates while we're appending content to avoid breaking the autoscroll behavior
msgWidget->setUpdatesEnabled(false); msgWidget->setUpdatesEnabled(false);
QScrollBar *scroller = msgWidget->verticalScrollBar(); QScrollBar *scroller = msgWidget->verticalScrollBar();
msgWidget->appendHtml(message->getFormatedText()); QString messages = message->getFormatedText();
messages = messages.replace("<#E>", "color: #f95e5e; font: monospace;");
messages = messages.replace("<#I>", "color: #f9b55e; font: monospace;");
messages = messages.replace("<#N>", "color: #ffffff; font: monospace;");
msgWidget->appendHtml(messages);
// Ensure text area scrolls correctly // Ensure text area scrolls correctly
scroller->setValue(scroller->maximum()); scroller->setValue(scroller->maximum());
msgWidget->setUpdatesEnabled(true); msgWidget->setUpdatesEnabled(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment