diff --git a/src/ui/uas/QGCMessageView.cc b/src/ui/uas/QGCMessageView.cc index 7f4f891c8aa4316853b98abf368373b4f4efed42..a1fdcce52b64db52246a078a4a5ee029e19a6798 100644 --- a/src/ui/uas/QGCMessageView.cc +++ b/src/ui/uas/QGCMessageView.cc @@ -1,11 +1,15 @@ #include "QGCMessageView.h" -#include "ui_QGCMessageView.h" -#include "UASManager.h" -#include "QGCUnconnectedInfoWidget.h" #include #include + +#include "GAudioOutput.h" +#include "QGCUnconnectedInfoWidget.h" +#include "UASManager.h" +#include "ui_QGCMessageView.h" + + QGCMessageView::QGCMessageView(QWidget *parent) : QWidget(parent), activeUAS(NULL), @@ -53,7 +57,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 +68,17 @@ 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? + GAudioOutput::instance()->say(text.toLower()); + 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);