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
case MAV_SEVERITY_ALERT:
case MAV_SEVERITY_CRITICAL:
case MAV_SEVERITY_ERROR:
style = QString("color: #f95e5e; font-weight:bold");
style = QString("<#E>");
_errorCount++;
_errorCountTotal++;
break;
case MAV_SEVERITY_NOTICE:
case MAV_SEVERITY_WARNING:
style = QString("color: #f9b55e; font-weight:bold");
style = QString("<#I>");
_warningCount++;
break;
default:
style = QString("color: #ffffff; font-weight:bold");
style = QString("<#N>");
_normalCount++;
break;
}
......@@ -200,7 +200,7 @@ void UASMessageHandler::handleTextMessage(int, int compId, int severity, QString
if (_multiComp) {
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()) {
_latestError = severityText + " " + text;
......
......@@ -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: {
if(messageArea.visible) {
messageText.append(formatedMessage)
messageText.append(formatMessage(formatedMessage))
//-- Hack to scroll down
messageFlick.flick(0,-500)
}
......@@ -242,7 +249,7 @@ Item {
currentPopUp.close()
}
if(QGroundControl.multiVehicleManager.activeVehicleAvailable) {
messageText.text = activeVehicle.formatedMessages
messageText.text = formatMessage(activeVehicle.formatedMessages)
//-- Hack to scroll to last message
for (var i = 0; i < activeVehicle.messageCount; i++)
messageFlick.flick(0,-5000)
......@@ -372,13 +379,11 @@ Item {
readOnly: true
textFormat: TextEdit.RichText
color: "white"
font.family: ScreenTools.normalFontFamily
font.pointSize: ScreenTools.defaultFontPointSize
}
}
//-- Dismiss System Message
Image {
anchors.margins: ScreenTools.defaultFontPixelHeight
//anchors.margins: ScreenTools.defaultFontPixelHeight
anchors.top: parent.top
anchors.right: parent.right
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