Browse Source

Change message view styling based on severity

QGC4.4
tstellanova 12 years ago
parent
commit
2dfe72e564
  1. 13
      src/ui/uas/QGCMessageView.cc

13
src/ui/uas/QGCMessageView.cc

@ -53,7 +53,7 @@ void QGCMessageView::setActiveUAS(UASInterface* uas)
activeUAS = 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 // XXX color messages according to severity
@ -64,7 +64,16 @@ void QGCMessageView::handleTextMessage(int uasid, int componentid, int severity,
QScrollBar *scroller = msgWidget->verticalScrollBar(); QScrollBar *scroller = msgWidget->verticalScrollBar();
UASInterface *uas = UASManager::instance()->getUASForId(uasid); UASInterface *uas = UASManager::instance()->getUASForId(uasid);
msgWidget->appendHtml(QString("<font color=\"%1\">[%2:%3] %4</font>\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("<p style=\"color:#DC143C;background-color:#FFFACD;font-size:larger;font-weight:bold\">[%1:%2] %3</p>").arg(uasName).arg(compId).arg(text));
}
else {
msgWidget->appendHtml(QString("<p style=\"color:%1;font-size:smaller\">[%2:%3] %4</p>").arg(colorName).arg(uasName).arg(compId).arg(text));
}
// Ensure text area scrolls correctly // Ensure text area scrolls correctly
scroller->setValue(scroller->maximum()); scroller->setValue(scroller->maximum());
msgWidget->setUpdatesEnabled(true); msgWidget->setUpdatesEnabled(true);

Loading…
Cancel
Save