Commit c3c54d13 authored by dogmaphobic's avatar dogmaphobic

Reformatting message window text.

parent 770ece07
...@@ -145,17 +145,17 @@ void UASMessageHandler::handleTextMessage(int, int compId, int severity, QString ...@@ -145,17 +145,17 @@ void UASMessageHandler::handleTextMessage(int, int compId, int severity, QString
case MAV_SEVERITY_ALERT: case MAV_SEVERITY_ALERT:
case MAV_SEVERITY_CRITICAL: case MAV_SEVERITY_CRITICAL:
case MAV_SEVERITY_ERROR: case MAV_SEVERITY_ERROR:
style = QString("color: #f95e5e; font-weight:bold"); style = QString("<#E>");
_errorCount++; _errorCount++;
_errorCountTotal++; _errorCountTotal++;
break; break;
case MAV_SEVERITY_NOTICE: case MAV_SEVERITY_NOTICE:
case MAV_SEVERITY_WARNING: case MAV_SEVERITY_WARNING:
style = QString("color: #f9b55e; font-weight:bold"); style = QString("<#I>");
_warningCount++; _warningCount++;
break; break;
default: default:
style = QString("color: #ffffff; font-weight:bold"); style = QString("<#N>");
_normalCount++; _normalCount++;
break; break;
} }
...@@ -200,7 +200,7 @@ void UASMessageHandler::handleTextMessage(int, int compId, int severity, QString ...@@ -200,7 +200,7 @@ void UASMessageHandler::handleTextMessage(int, int compId, int severity, QString
if (_multiComp) { if (_multiComp) {
compString = QString(" COMP:%1").arg(compId); compString = QString(" COMP:%1").arg(compId);
} }
message->_setFormatedText(QString("<p><font style=\"%1\">[%2%3]%4 %5</font></p>").arg(style).arg(dateString).arg(compString).arg(severityText).arg(text)); message->_setFormatedText(QString("<font style=\"%1\">[%2%3]%4 %5</font><br/>").arg(style).arg(dateString).arg(compString).arg(severityText).arg(text));
if (message->severityIsError()) { if (message->severityIsError()) {
_latestError = severityText + " " + text; _latestError = severityText + " " + text;
......
...@@ -229,9 +229,16 @@ Item { ...@@ -229,9 +229,16 @@ Item {
} }
} }
function formatMessage(message) {
message = message.replace(new RegExp("<#E>", "g"), "color: #f95e5e; font: " + (ScreenTools.defaultFontPointSize.toFixed(0) - 1) + "pt monospace;");
message = message.replace(new RegExp("<#I>", "g"), "color: #f9b55e; font: " + (ScreenTools.defaultFontPointSize.toFixed(0) - 1) + "pt monospace;");
message = message.replace(new RegExp("<#N>", "g"), "color: #ffffff; font: " + (ScreenTools.defaultFontPointSize.toFixed(0) - 1) + "pt monospace;");
return message;
}
onFormatedMessageChanged: { onFormatedMessageChanged: {
if(messageArea.visible) { if(messageArea.visible) {
messageText.append(formatedMessage) messageText.append(formatMessage(formatedMessage))
//-- Hack to scroll down //-- Hack to scroll down
messageFlick.flick(0,-500) messageFlick.flick(0,-500)
} }
...@@ -242,7 +249,7 @@ Item { ...@@ -242,7 +249,7 @@ Item {
currentPopUp.close() currentPopUp.close()
} }
if(QGroundControl.multiVehicleManager.activeVehicleAvailable) { if(QGroundControl.multiVehicleManager.activeVehicleAvailable) {
messageText.text = activeVehicle.formatedMessages messageText.text = formatMessage(activeVehicle.formatedMessages)
//-- Hack to scroll to last message //-- Hack to scroll to last message
for (var i = 0; i < activeVehicle.messageCount; i++) for (var i = 0; i < activeVehicle.messageCount; i++)
messageFlick.flick(0,-5000) messageFlick.flick(0,-5000)
...@@ -372,13 +379,11 @@ Item { ...@@ -372,13 +379,11 @@ Item {
readOnly: true readOnly: true
textFormat: TextEdit.RichText textFormat: TextEdit.RichText
color: "white" color: "white"
font.family: ScreenTools.normalFontFamily
font.pointSize: ScreenTools.defaultFontPointSize
} }
} }
//-- Dismiss System Message //-- Dismiss System Message
Image { Image {
anchors.margins: ScreenTools.defaultFontPixelHeight //anchors.margins: ScreenTools.defaultFontPixelHeight
anchors.top: parent.top anchors.top: parent.top
anchors.right: parent.right anchors.right: parent.right
width: ScreenTools.defaultFontPixelHeight * 1.5 width: ScreenTools.defaultFontPixelHeight * 1.5
......
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