diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2011-03-01 09:43:00 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2011-03-01 09:43:00 +0100 |
commit | f37a39cf77bc20770211e05fbb4570a4a2aacaa7 (patch) | |
tree | 96c8c47ee17d5c7b7c64e709446ff7937a8a1ccc /CoffeeTweed | |
parent | 671c364ff69dbf9beb18ec66cb360bd3a669ce38 (diff) |
Add a bunch of new mobile demos from INdT
Diffstat (limited to 'CoffeeTweed')
33 files changed, 493 insertions, 0 deletions
diff --git a/CoffeeTweed/Add.qml b/CoffeeTweed/Add.qml new file mode 100644 index 0000000..5a16af9 --- /dev/null +++ b/CoffeeTweed/Add.qml @@ -0,0 +1,38 @@ +import Qt 4.7 + +Item { + id: bt_add + width: 188; height: 188 + + signal addClicked + + Image { + id: bt_add_off; + source: "images/bt_add_off.png"; + } + + Image { + id: bt_add_on; + source: "images/bt_add_on.png"; + opacity: 0; + Behavior on opacity { NumberAnimation { duration: 150; } } + } + + MouseArea { + anchors.fill: parent + onPressed: { bt_add.state = "pressed" } + onReleased: { bt_add.state = "released"; bt_add.addClicked() } + + } + + states: [ + State { + name: "pressed" + PropertyChanges{ target: bt_add_on; opacity: 1; } + }, + State { + name: "released" + PropertyChanges{ target: bt_add_on; opacity: 0; } + } + ] +} diff --git a/CoffeeTweed/CoffeeTweed.qml b/CoffeeTweed/CoffeeTweed.qml new file mode 100644 index 0000000..ed2fdae --- /dev/null +++ b/CoffeeTweed/CoffeeTweed.qml @@ -0,0 +1,82 @@ +import Qt 4.6 + +Rectangle { + id: root + width: 800; height: 480 + + property int coffee_count: 0 + property int coffee_total: 12 + + function add_one() { + if (coffee_count < coffee_total) { + root.coffee_count += 1, + counter_toGo.state = "add_count", + counter_cupsDown.state = "add_count", + cup.state = "less_one", + tray.add_cup(coffee_count) + } + } + function remove_one() { + if (coffee_count > 0) { + root.coffee_count -= 1, + counter_toGo.state = "remove_count", + counter_cupsDown.state = "remove_count", + tray.remove_cup(coffee_count) + } + } + + Image { + source: "images/bg.png" + } + + Taskbar { + anchors.top: root.top + } + + Counter_toGo { + id: counter_toGo + x: 130; y: 120; + } + + Counter_cupsDown { + id: counter_cupsDown + x: 260; y: 86; + } + + Text { + id: toGo; + y: 120; x: 345; + text: "to go"; font.pixelSize: 100; font.letterSpacing: 90; color: "#FFF" + } + Text { + id: cupsDown + y: 86; x: 390; + text: "cups down"; font.pixelSize: 50; font.letterSpacing: 90; color: "#999" + } + + Tray { + id: tray + x: 335; y: 280; + } + + Tray_model{ + id: traymodel + } + + Cup { + id: cup + x: 175; y: 0; + } + + Add { + id: add_btn + x: -7; y: 200 + onAddClicked: add_one() + } + + Remove { + id: remove_btn + x: 619; y: 200 + onRemoveClicked: remove_one() + } +} diff --git a/CoffeeTweed/CoffeeTweed.qmlproject b/CoffeeTweed/CoffeeTweed.qmlproject new file mode 100644 index 0000000..86a5669 --- /dev/null +++ b/CoffeeTweed/CoffeeTweed.qmlproject @@ -0,0 +1,16 @@ +// File generated by QtCreator + +import QmlProject 1.0 + +Project { + // Scan current directory for .qml, .js, and image files + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/CoffeeTweed/Counter_cupsDown.qml b/CoffeeTweed/Counter_cupsDown.qml new file mode 100644 index 0000000..9507390 --- /dev/null +++ b/CoffeeTweed/Counter_cupsDown.qml @@ -0,0 +1,58 @@ +import Qt 4.7 + +Item { + width: 100; height: 90; + state: "default" + + Text { + id: cupsDown_counter + x: 20; y: 0 + width: parent.width + + text: "0" + color: "#999"; font.bold: true; font.pixelSize: 50; smooth: true; horizontalAlignment: "AlignRight" + + Behavior on opacity { + NumberAnimation { duration: 300;} + } + } + + function reset_counter_state() { + counter_cupsDown.state = "default" + } + + states: [ + State { + name: "default" + }, + State { + name: "add_count" + }, + State { + name: "remove_count" + } + ] + + transitions: [ + Transition { + from: "default"; to: "add_count" + SequentialAnimation { + PropertyAnimation { target: cupsDown_counter; property: "opacity"; to: 0; } + PropertyAction{ target: cupsDown_counter; property: "text"; value: coffee_count } + PauseAnimation { duration: 1500; } + PropertyAnimation { target: cupsDown_counter; property: "opacity"; to: 1; } + ScriptAction { script: reset_counter_state() } + } + }, + Transition { + from: "default"; to: "remove_count" + SequentialAnimation { + PropertyAnimation { target: cupsDown_counter; property: "opacity"; to: 0; } + PropertyAction{ target: cupsDown_counter; property: "text"; value: coffee_count } + PauseAnimation { duration: 300; } + PropertyAnimation { target: cupsDown_counter; property: "opacity"; to: 1; } + ScriptAction { script: reset_counter_state() } + } + } + ] +} 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() } + } + } + ] +} diff --git a/CoffeeTweed/Cup.qml b/CoffeeTweed/Cup.qml new file mode 100644 index 0000000..93fc385 --- /dev/null +++ b/CoffeeTweed/Cup.qml @@ -0,0 +1,112 @@ +import Qt 4.7 + +Item { + id: coffee_cup + width: 190; height: 480 + + function return_to_ashes() { + coffee_cup.state = ""; + } + + Image { + id: cup_plate + source: "images/coffee_plate.png"; y: 365 + } + + Item { + id: cup_full + width: 135; height: 138; x: 7; y: 280 + Image { source: "images/cup_back.png"; } + + Item { id: cup_content; Image { source: "images/cup_content.png"; } } + Item { id: cup_front; Image { source: "images/cup_front.png"; } } + } + + Item { + id: cup_empty + width: 135; height: 138; x: 7; y: 280; opacity: 0 + Image { source: "images/cup_empty.png"; } + } + + Item { + id: cup_smoke + width: 233; height: 258; y: 45; x: -13; opacity: 1 + Image { source: "images/cup_smoke.png" } + } + + Item { + id: cup_running + width: 135; height: 188; x: 7; y: -228; opacity: 0 + Image { source: "images/cup_blur.png"; } + } + + states: [ + State{ + name: "less_one" + } + ] + + transitions: [ + Transition { + from: "" + to: "less_one" + + SequentialAnimation{ + + // Empty the cup and fade the smoke + ParallelAnimation { + PropertyAnimation { target: cup_smoke; property: "opacity"; to: 0; duration: 500; } + PropertyAnimation { target: cup_content; property: "y"; to: 25; duration: 500; } + } + + // Change the full cup composition by the empty cup + PropertyAction { target: cup_empty; property: "opacity"; value: 1 } + PropertyAction { target: cup_full; property: "opacity"; value: 0; } + + // Pause for coffee + PauseAnimation { duration: 100; } + + // Fade out the empty cup + PropertyAnimation { target: cup_empty; property: "opacity"; to: 0; duration: 200; } + + // Send the empty cup to the top and update the number + PropertyAction { target: cup_empty; property: "y"; value: -188; } + + // Turn on the blur and empty cups + PropertyAction { target: cup_running; property: "opacity"; value: 1; } + PropertyAction { target: cup_empty; property: "opacity"; value: 1; } + + // Clean cup coming! + ParallelAnimation { + PropertyAnimation { target: cup_running; property: "y"; to: 235; duration: 300; } + PropertyAnimation { target: cup_empty; property: "y"; to: 285; duration: 300; } + } + + // Landing in the plate + ParallelAnimation { + PropertyAnimation { target: cup_empty; property: "y"; to: 280; duration: 150; } + PropertyAnimation { target: cup_running; property: "opacity"; to: 0; duration: 200; } + } + + // Get the blured cup to the original place + PropertyAction { target: cup_running; property: "y"; value: -228; } + + // Wait for the waiter + PauseAnimation { duration: 500; } + + // Change the empty cup by the full cup composition + PropertyAction { target: cup_full; property: "opacity"; value: 1; } + PropertyAction { target: cup_empty; property: "opacity"; value: 0; } + + // Here is your coffee, sir + PropertyAnimation { target: cup_content; property: "y"; to: 0; duration: 400; } + PropertyAnimation { target: cup_smoke; property: "opacity"; to: 1; duration: 700; } + + // Ready for the next turn + ScriptAction { script: return_to_ashes() } + } + + } + ] + +} diff --git a/CoffeeTweed/Remove.qml b/CoffeeTweed/Remove.qml new file mode 100644 index 0000000..66c35f1 --- /dev/null +++ b/CoffeeTweed/Remove.qml @@ -0,0 +1,39 @@ +import Qt 4.7 + +Item { + id: bt_remove + width: 188; height: 188 + + signal removeClicked + + Image { + id: bt_remove_off; + source: "images/bt_remove_off.png"; + } + + Image { + id: bt_remove_on; + source: "images/bt_remove_on.png"; + opacity: 0; + Behavior on opacity { NumberAnimation { duration: 150; } } + } + + MouseArea { + anchors.fill: parent + onPressed: { bt_remove.state = "pressed" } + onReleased: { bt_remove.state = "released"; bt_remove.removeClicked() } + + } + + states: [ + State { + name: "pressed" + PropertyChanges{ target: bt_remove_on; opacity: 1; } + }, + State { + name: "released" + PropertyChanges{ target: bt_remove_on; opacity: 0; } + } + ] + +} diff --git a/CoffeeTweed/Taskbar.qml b/CoffeeTweed/Taskbar.qml new file mode 100644 index 0000000..f64ae17 --- /dev/null +++ b/CoffeeTweed/Taskbar.qml @@ -0,0 +1,6 @@ +import Qt 4.7 + +Rectangle { + width: 800; height: 55 + Image { source: "images/taskbar_placeholder.png" } +} diff --git a/CoffeeTweed/Tray.qml b/CoffeeTweed/Tray.qml new file mode 100644 index 0000000..608317a --- /dev/null +++ b/CoffeeTweed/Tray.qml @@ -0,0 +1,64 @@ +import Qt 4.7 + +Item { + id:cuptray + width: 330; height: 110; + + Tray_model{ + id: traymodel + } + + function add_cup(indx) { + var cupindx = indx -1; + traymodel.set(cupindx, { cupstate: "display" }); + } + + function remove_cup(indx) { + var cupindx = indx; + traymodel.set(cupindx, { cupstate: "hide" }); + } + + Component { + id: emptycup + Item { + id: empty_cup + width: 69; height: 67 + x: pos_x; y: pos_y; z: pos_z + opacity: 0 + state: cupstate + + Image { source: img_src } + + Behavior on opacity { NumberAnimation { duration: 400 } } + + states: [ + State { + name: "display" + }, + State { + name: "hide" + } + ] + transitions: [ + Transition { + from: "*"; to: "hide" + SequentialAnimation { + PropertyAnimation { target: empty_cup; property: "opacity"; to: 0; } + } + }, + Transition { + from: "hide"; to: "display" + SequentialAnimation { + PropertyAnimation { target: empty_cup; property: "opacity"; to: 1; } + } + } + ] + } + } + + Repeater { + model: traymodel + delegate: emptycup + } + +} diff --git a/CoffeeTweed/Tray_model.qml b/CoffeeTweed/Tray_model.qml new file mode 100644 index 0000000..bbbcb38 --- /dev/null +++ b/CoffeeTweed/Tray_model.qml @@ -0,0 +1,20 @@ +import Qt 4.7 + +ListModel { + id: tray_model + + ListElement { cupstate: "hide"; img_src: "images/empty_row1.png"; pos_x: 64; pos_y: 40; pos_z: 3 } + ListElement { cupstate: "hide"; img_src: "images/empty_row1.png"; pos_x: 124; pos_y: 40; pos_z: 3 } + ListElement { cupstate: "hide"; img_src: "images/empty_row1.png"; pos_x: 184; pos_y: 40; pos_z: 3 } + ListElement { cupstate: "hide"; img_src: "images/empty_row1.png"; pos_x: 244; pos_y: 40; pos_z: 3 } + + ListElement { cupstate: "hide"; img_src: "images/empty_row2.png"; pos_x: 32; pos_y: 20; pos_z: 2 } + ListElement { cupstate: "hide"; img_src: "images/empty_row2.png"; pos_x: 92; pos_y: 20; pos_z: 2 } + ListElement { cupstate: "hide"; img_src: "images/empty_row2.png"; pos_x: 152; pos_y: 20; pos_z: 2 } + ListElement { cupstate: "hide"; img_src: "images/empty_row2.png"; pos_x: 212; pos_y: 20; pos_z: 2 } + + ListElement { cupstate: "hide"; img_src: "images/empty_row3.png"; pos_x: 0; pos_y: 0; pos_z: 1 } + ListElement { cupstate: "hide"; img_src: "images/empty_row3.png"; pos_x: 60; pos_y: 0; pos_z: 1 } + ListElement { cupstate: "hide"; img_src: "images/empty_row3.png"; pos_x: 120; pos_y: 0; pos_z: 1 } + ListElement { cupstate: "hide"; img_src: "images/empty_row3.png"; pos_x: 180; pos_y: 0; pos_z: 1 } +} diff --git a/CoffeeTweed/images/.DS_Store b/CoffeeTweed/images/.DS_Store Binary files differnew file mode 100755 index 0000000..5008ddf --- /dev/null +++ b/CoffeeTweed/images/.DS_Store diff --git a/CoffeeTweed/images/bg.png b/CoffeeTweed/images/bg.png Binary files differnew file mode 100755 index 0000000..ef08d0e --- /dev/null +++ b/CoffeeTweed/images/bg.png diff --git a/CoffeeTweed/images/bt_add_off.png b/CoffeeTweed/images/bt_add_off.png Binary files differnew file mode 100755 index 0000000..b317af6 --- /dev/null +++ b/CoffeeTweed/images/bt_add_off.png diff --git a/CoffeeTweed/images/bt_add_on.png b/CoffeeTweed/images/bt_add_on.png Binary files differnew file mode 100755 index 0000000..593cf2e --- /dev/null +++ b/CoffeeTweed/images/bt_add_on.png diff --git a/CoffeeTweed/images/bt_remove_off.png b/CoffeeTweed/images/bt_remove_off.png Binary files differnew file mode 100755 index 0000000..c5bd438 --- /dev/null +++ b/CoffeeTweed/images/bt_remove_off.png diff --git a/CoffeeTweed/images/bt_remove_on.png b/CoffeeTweed/images/bt_remove_on.png Binary files differnew file mode 100755 index 0000000..2b6c9e2 --- /dev/null +++ b/CoffeeTweed/images/bt_remove_on.png diff --git a/CoffeeTweed/images/coffee_plate.png b/CoffeeTweed/images/coffee_plate.png Binary files differnew file mode 100755 index 0000000..4abbfb9 --- /dev/null +++ b/CoffeeTweed/images/coffee_plate.png diff --git a/CoffeeTweed/images/cup_back.png b/CoffeeTweed/images/cup_back.png Binary files differnew file mode 100755 index 0000000..c553027 --- /dev/null +++ b/CoffeeTweed/images/cup_back.png diff --git a/CoffeeTweed/images/cup_blur.png b/CoffeeTweed/images/cup_blur.png Binary files differnew file mode 100755 index 0000000..2add637 --- /dev/null +++ b/CoffeeTweed/images/cup_blur.png diff --git a/CoffeeTweed/images/cup_content.png b/CoffeeTweed/images/cup_content.png Binary files differnew file mode 100755 index 0000000..848a691 --- /dev/null +++ b/CoffeeTweed/images/cup_content.png diff --git a/CoffeeTweed/images/cup_empty.png b/CoffeeTweed/images/cup_empty.png Binary files differnew file mode 100755 index 0000000..6201666 --- /dev/null +++ b/CoffeeTweed/images/cup_empty.png diff --git a/CoffeeTweed/images/cup_front.png b/CoffeeTweed/images/cup_front.png Binary files differnew file mode 100755 index 0000000..81c5da6 --- /dev/null +++ b/CoffeeTweed/images/cup_front.png diff --git a/CoffeeTweed/images/cup_full.png b/CoffeeTweed/images/cup_full.png Binary files differnew file mode 100755 index 0000000..7470d53 --- /dev/null +++ b/CoffeeTweed/images/cup_full.png diff --git a/CoffeeTweed/images/cup_smoke.png b/CoffeeTweed/images/cup_smoke.png Binary files differnew file mode 100755 index 0000000..aa98b3b --- /dev/null +++ b/CoffeeTweed/images/cup_smoke.png diff --git a/CoffeeTweed/images/empty_row1.png b/CoffeeTweed/images/empty_row1.png Binary files differnew file mode 100755 index 0000000..9023f93 --- /dev/null +++ b/CoffeeTweed/images/empty_row1.png diff --git a/CoffeeTweed/images/empty_row2.png b/CoffeeTweed/images/empty_row2.png Binary files differnew file mode 100755 index 0000000..2a8fa2f --- /dev/null +++ b/CoffeeTweed/images/empty_row2.png diff --git a/CoffeeTweed/images/empty_row3.png b/CoffeeTweed/images/empty_row3.png Binary files differnew file mode 100755 index 0000000..211a6d7 --- /dev/null +++ b/CoffeeTweed/images/empty_row3.png diff --git a/CoffeeTweed/images/taskbar_bg.png b/CoffeeTweed/images/taskbar_bg.png Binary files differnew file mode 100755 index 0000000..0658fbf --- /dev/null +++ b/CoffeeTweed/images/taskbar_bg.png diff --git a/CoffeeTweed/images/taskbar_close_bt.png b/CoffeeTweed/images/taskbar_close_bt.png Binary files differnew file mode 100755 index 0000000..70a1e66 --- /dev/null +++ b/CoffeeTweed/images/taskbar_close_bt.png diff --git a/CoffeeTweed/images/taskbar_division.png b/CoffeeTweed/images/taskbar_division.png Binary files differnew file mode 100755 index 0000000..0e481a4 --- /dev/null +++ b/CoffeeTweed/images/taskbar_division.png diff --git a/CoffeeTweed/images/taskbar_home_bt.png b/CoffeeTweed/images/taskbar_home_bt.png Binary files differnew file mode 100755 index 0000000..f4c61d8 --- /dev/null +++ b/CoffeeTweed/images/taskbar_home_bt.png diff --git a/CoffeeTweed/images/taskbar_options_bt.png b/CoffeeTweed/images/taskbar_options_bt.png Binary files differnew file mode 100755 index 0000000..f68a4f4 --- /dev/null +++ b/CoffeeTweed/images/taskbar_options_bt.png diff --git a/CoffeeTweed/images/taskbar_placeholder.png b/CoffeeTweed/images/taskbar_placeholder.png Binary files differnew file mode 100755 index 0000000..824f1b3 --- /dev/null +++ b/CoffeeTweed/images/taskbar_placeholder.png |