From c9b53416d1810a9f3748dc5ad8db862d57097edf Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 15 Jul 2014 15:59:28 +0200 Subject: [PATCH] Moved audio output out of UI widget --- src/uas/UAS.cc | 4 ++-- src/ui/uas/QGCMessageView.cc | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index 9bc6ca3fb..6023c377c 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -1314,11 +1314,11 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) QString text = QString(b); int severity = mavlink_msg_statustext_get_severity(&message); - if (text.startsWith("#audio:")) + if (text.startsWith("#") || severity > MAV_SEVERITY_WARNING) { text.remove("#audio:"); emit textMessageReceived(uasId, message.compid, severity, QString("Audio message: ") + text); - GAudioOutput::instance()->say(text, severity); + GAudioOutput::instance()->say(text.toLower(), severity); } else { diff --git a/src/ui/uas/QGCMessageView.cc b/src/ui/uas/QGCMessageView.cc index 5e005636f..913644af8 100644 --- a/src/ui/uas/QGCMessageView.cc +++ b/src/ui/uas/QGCMessageView.cc @@ -97,8 +97,6 @@ void QGCMessageView::handleTextMessage(int uasid, int compId, int severity, QStr case MAV_SEVERITY_ALERT: case MAV_SEVERITY_CRITICAL: case MAV_SEVERITY_ERROR: - // TODO: Move this audio output to UAS.cc, as it doesn't make sense to put audio output in a message logger widget. - GAudioOutput::instance()->say(text.toLower()); //Use set RGB values from given color from QGC style = QString("color: rgb(%1, %2, %3); font-weight:bold").arg(QGC::colorRed.red()).arg(QGC::colorRed.green()).arg(QGC::colorRed.blue()); break; -- 2.22.0