From 2dfe72e5644f6fd4093234f01ef6b275841233d0 Mon Sep 17 00:00:00 2001 From: tstellanova Date: Mon, 19 Aug 2013 23:15:21 -0700 Subject: [PATCH] Change message view styling based on severity --- src/ui/uas/QGCMessageView.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ui/uas/QGCMessageView.cc b/src/ui/uas/QGCMessageView.cc index 7f4f891c8..0e9d23d82 100644 --- a/src/ui/uas/QGCMessageView.cc +++ b/src/ui/uas/QGCMessageView.cc @@ -53,7 +53,7 @@ void QGCMessageView::setActiveUAS(UASInterface* uas) activeUAS = uas; } -void QGCMessageView::handleTextMessage(int uasid, int componentid, int severity, QString text) +void QGCMessageView::handleTextMessage(int uasid, int compId, int severity, QString text) { // XXX color messages according to severity @@ -64,7 +64,16 @@ void QGCMessageView::handleTextMessage(int uasid, int componentid, int severity, QScrollBar *scroller = msgWidget->verticalScrollBar(); UASInterface *uas = UASManager::instance()->getUASForId(uasid); - msgWidget->appendHtml(QString("[%2:%3] %4\n").arg(uas->getColor().name()).arg(uas->getUASName()).arg(componentid).arg(text)); + QString uasName(uas->getUASName()); + QString colorName(uas->getColor().name()); + //change styling based on severity + if (160 == severity ) { //TODO where is the constant for "critical" severity? + msgWidget->appendHtml(QString("

[%1:%2] %3

").arg(uasName).arg(compId).arg(text)); + } + else { + msgWidget->appendHtml(QString("

[%2:%3] %4

").arg(colorName).arg(uasName).arg(compId).arg(text)); + } + // Ensure text area scrolls correctly scroller->setValue(scroller->maximum()); msgWidget->setUpdatesEnabled(true); -- 2.22.0