From c38d55fc0b43215f63c873e7578554f5942e69b3 Mon Sep 17 00:00:00 2001 From: zheng_wenlong Date: Fri, 14 Jun 2019 14:24:31 +0900 Subject: add vui display --- homescreen/qml/main.qml | 9 +++++++++ homescreen/src/homescreenvoice.cpp | 14 ++++++++------ homescreen/src/homescreenvoice.h | 1 + 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/homescreen/qml/main.qml b/homescreen/qml/main.qml index de833a9..a0ff4f4 100644 --- a/homescreen/qml/main.qml +++ b/homescreen/qml/main.qml @@ -243,6 +243,15 @@ Window { } } + Connections { + target: homescreenVoice + onShowInformation: { + bottomText.text = info + bottomInformation.visible = true + informationTimer.restart() + } + } + Timer { id:notificationTimer interval: 3000 diff --git a/homescreen/src/homescreenvoice.cpp b/homescreen/src/homescreenvoice.cpp index 4a376e1..f56625e 100644 --- a/homescreen/src/homescreenvoice.cpp +++ b/homescreen/src/homescreenvoice.cpp @@ -206,17 +206,19 @@ void HomescreenVoice::on_event(void *closure, const char *event, struct afb_wsj1 return; } - const char* corestatus = json_object_get_string(json_state); + const char* info = json_object_get_string(json_state); - if (strcasecmp(corestatus, HomescreenVoice::state_lists[0].c_str()) == 0) { + if (strcasecmp(info, HomescreenVoice::state_lists[0].c_str()) == 0) { emit statusChanged(true); } - else if ((strcasecmp(corestatus, HomescreenVoice::state_lists[1].c_str()) == 0)|| - (strcasecmp(corestatus, HomescreenVoice::state_lists[2].c_str()) == 0)|| - (strcasecmp(corestatus, HomescreenVoice::state_lists[3].c_str()) == 0)|| - (strcasecmp(corestatus, HomescreenVoice::state_lists[4].c_str()) == 0)){ + else if ((strcasecmp(info, HomescreenVoice::state_lists[1].c_str()) == 0)|| + (strcasecmp(info, HomescreenVoice::state_lists[2].c_str()) == 0)|| + (strcasecmp(info, HomescreenVoice::state_lists[3].c_str()) == 0)|| + (strcasecmp(info, HomescreenVoice::state_lists[4].c_str()) == 0)){ emit statusChanged(false); } + + emit showInformation(QString(QLatin1String(info))); } /** diff --git a/homescreen/src/homescreenvoice.h b/homescreen/src/homescreenvoice.h index 6a4f7e5..011280c 100644 --- a/homescreen/src/homescreenvoice.h +++ b/homescreen/src/homescreenvoice.h @@ -47,6 +47,7 @@ public: Q_INVOKABLE int startListening(void); signals: void statusChanged(bool status); + void showInformation(QString info); private: int initialize_websocket(void); -- cgit 1.2.3-korg