aboutsummaryrefslogtreecommitdiffstats
path: root/homescreen/qml/SpeechChrome.qml
diff options
context:
space:
mode:
authorNaveen Bobbili <nbobbili@amazon.com>2019-04-28 20:51:16 -0700
committerJan-Simon Möller <jsmoeller@linuxfoundation.org>2019-06-24 14:14:42 +0200
commit9f02e451dd2f91c217d73c8029bb939b3a211672 (patch)
treed79eb0f93e835746169b3a96454cf8da70c0c037 /homescreen/qml/SpeechChrome.qml
parent2509e623a5f95a612a715818f15daddf2ca77f12 (diff)
Code commit by ICS team to add Alexa Voice Chrome to Homescreen App.sandbox/jsmoeller/speechdemo
Change-Id: I2052e345baaf4306e8e3f27a01bc6940f4d27d88 Signed-off-by: Naveen Bobbili <nbobbili@amazon.com>
Diffstat (limited to 'homescreen/qml/SpeechChrome.qml')
-rw-r--r--homescreen/qml/SpeechChrome.qml112
1 files changed, 112 insertions, 0 deletions
diff --git a/homescreen/qml/SpeechChrome.qml b/homescreen/qml/SpeechChrome.qml
new file mode 100644
index 0000000..aba8283
--- /dev/null
+++ b/homescreen/qml/SpeechChrome.qml
@@ -0,0 +1,112 @@
+import QtQuick 2.0
+import SpeechChrome 1.0
+
+Item {
+ id: root
+
+ clip: true
+
+ Image {
+ id: chromeBarImage
+
+ anchors.top: parent.top
+ source: "./images/SpeechChrome/bar.png"
+
+ Behavior on x {
+ NumberAnimation { duration: 250 }
+ }
+ Behavior on opacity {
+ NumberAnimation { duration: 250 }
+ }
+ }
+
+ Image {
+ id: pushToTalk
+
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ source: "./images/SpeechChrome/push_to_talk.png"
+
+ MouseArea {
+ anchors.fill: parent
+ onPressed: speechChromeController.pushToTalk()
+ }
+
+ Behavior on opacity {
+ NumberAnimation { duration: 250 }
+ }
+ }
+
+ states: [
+ State {
+ name: "Idle"
+ when: speechChromeController.chromeState == SpeechChromeController.Idle
+ PropertyChanges {
+ target: chromeBarImage
+ opacity: 0.0
+ x: 0
+ }
+ PropertyChanges {
+ target: pushToTalk
+ opacity: 1.0
+ enabled: true
+ }
+ },
+ State {
+ name: "Listening"
+ when: speechChromeController.chromeState == SpeechChromeController.Listening
+ PropertyChanges {
+ target: chromeBarImage
+ opacity: 1.0
+ x: 0
+ }
+ PropertyChanges {
+ target: pushToTalk
+ opacity: 0.0
+ enabled: false
+ }
+ },
+ State {
+ name: "Thinking"
+ when: speechChromeController.chromeState == SpeechChromeController.Thinking
+ PropertyChanges {
+ target: chromeBarImage
+ opacity: 1.0
+ x: root.width - chromeBarImage.width
+ }
+ PropertyChanges {
+ target: pushToTalk
+ opacity: 0.0
+ enabled: false
+ }
+ },
+ State {
+ name: "Speaking"
+ when: speechChromeController.chromeState == SpeechChromeController.Speaking
+ PropertyChanges {
+ target: chromeBarImage
+ opacity: 1.0
+ x: (root.width - chromeBarImage.width) * 0.5
+ }
+ PropertyChanges {
+ target: pushToTalk
+ opacity: 0.0
+ enabled: false
+ }
+ },
+ State {
+ name: "MicrophoneOff"
+ when: speechChromeController.chromeState == SpeechChromeController.MicrophoneOff
+ PropertyChanges {
+ target: chromeBarImage
+ opacity: 0.0
+ x: 0
+ }
+ PropertyChanges {
+ target: pushToTalk
+ opacity: 1.0
+ enabled: true
+ }
+ }
+ ]
+}