summaryrefslogtreecommitdiffstats
path: root/CoffeeTweed/Counter_toGo.qml
diff options
context:
space:
mode:
Diffstat (limited to 'CoffeeTweed/Counter_toGo.qml')
-rw-r--r--CoffeeTweed/Counter_toGo.qml58
1 files changed, 58 insertions, 0 deletions
diff --git a/CoffeeTweed/Counter_toGo.qml b/CoffeeTweed/Counter_toGo.qml
new file mode 100644
index 0000000..2bf8d88
--- /dev/null
+++ b/CoffeeTweed/Counter_toGo.qml
@@ -0,0 +1,58 @@
+import Qt 4.7
+
+Item {
+ width: 170; height: 90;
+ state: "default"
+
+ Text {
+ id: toGo_counter
+ x: 20; y: 0
+ width: parent.width
+
+ text: coffee_total
+ color: "#FFF"; font.bold: true; font.pixelSize: 100; smooth: true; horizontalAlignment: "AlignRight"
+
+ Behavior on opacity {
+ NumberAnimation { duration: 300;}
+ }
+ }
+
+ function reset_counter_state() {
+ counter_toGo.state = "default"
+ }
+
+ states: [
+ State {
+ name: "default"
+ },
+ State {
+ name: "add_count"
+ },
+ State {
+ name: "remove_count"
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "default"; to: "add_count"
+ SequentialAnimation {
+ PropertyAnimation { target: toGo_counter; property: "opacity"; to: 0; }
+ PropertyAction{ target: toGo_counter; property: "text"; value: coffee_total - coffee_count }
+ PauseAnimation { duration: 1500; }
+ PropertyAnimation { target: toGo_counter; property: "opacity"; to: 1; }
+ ScriptAction { script: reset_counter_state() }
+ }
+ },
+ Transition {
+ from: "default"; to: "remove_count"
+ SequentialAnimation {
+ PropertyAnimation { target: toGo_counter; property: "opacity"; to: 0; }
+ PropertyAction{ target: toGo_counter; property: "text"; value: coffee_total - coffee_count }
+ PauseAnimation { duration: 300; }
+ PropertyAnimation { target: toGo_counter; property: "opacity"; to: 1; }
+ ScriptAction { script: reset_counter_state() }
+ }
+ }
+ ]
+}