diff options
Diffstat (limited to 'homescreen/qml')
-rw-r--r-- | homescreen/qml/SpeechChrome.qml | 112 | ||||
-rw-r--r-- | homescreen/qml/images/SpeechChrome/bar.png | bin | 0 -> 23826 bytes | |||
-rw-r--r-- | homescreen/qml/images/SpeechChrome/push_to_talk.png | bin | 0 -> 1544 bytes | |||
-rw-r--r-- | homescreen/qml/images/SpeechChrome/speechchrome.qrc | 6 | ||||
-rw-r--r-- | homescreen/qml/main.qml | 7 | ||||
-rw-r--r-- | homescreen/qml/qml.qrc | 1 |
6 files changed, 126 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 + } + } + ] +} diff --git a/homescreen/qml/images/SpeechChrome/bar.png b/homescreen/qml/images/SpeechChrome/bar.png Binary files differnew file mode 100644 index 0000000..caabde1 --- /dev/null +++ b/homescreen/qml/images/SpeechChrome/bar.png diff --git a/homescreen/qml/images/SpeechChrome/push_to_talk.png b/homescreen/qml/images/SpeechChrome/push_to_talk.png Binary files differnew file mode 100644 index 0000000..f45218e --- /dev/null +++ b/homescreen/qml/images/SpeechChrome/push_to_talk.png diff --git a/homescreen/qml/images/SpeechChrome/speechchrome.qrc b/homescreen/qml/images/SpeechChrome/speechchrome.qrc new file mode 100644 index 0000000..8ab1472 --- /dev/null +++ b/homescreen/qml/images/SpeechChrome/speechchrome.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/images/SpeechChrome"> + <file>bar.png</file> + <file>push_to_talk.png</file> + </qresource> +</RCC> diff --git a/homescreen/qml/main.qml b/homescreen/qml/main.qml index 7d40276..d74fd1f 100644 --- a/homescreen/qml/main.qml +++ b/homescreen/qml/main.qml @@ -90,6 +90,13 @@ Window { } } + SpeechChrome { + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: 215 + } + Connections { target: homescreenHandler onShowInformation: { diff --git a/homescreen/qml/qml.qrc b/homescreen/qml/qml.qrc index e60ea63..d901481 100644 --- a/homescreen/qml/qml.qrc +++ b/homescreen/qml/qml.qrc @@ -10,5 +10,6 @@ <file>StatusArea.qml</file> <file>TopArea.qml</file> <file>IconItem.qml</file> + <file>SpeechChrome.qml</file> </qresource> </RCC> |