From 59899eb9b8b7a68b3284fe9fe59b8a1e2610f6cf Mon Sep 17 00:00:00 2001 From: Lincoln Ramsay Date: Tue, 6 Mar 2012 12:42:04 +1000 Subject: Fix display of Grue app. Don't just assume a white background will be set. We're now using a black background with white text. Fade in a grue as your chance of being eaten increases. Change-Id: I47af31f2f0092136ce3da377e1c6ffc21af07496 Reviewed-by: Daron Andrew Edie --- examples/sensors/grue/qml_app/grue.png | Bin 0 -> 11207 bytes examples/sensors/grue/qml_app/grue.xcf | Bin 0 -> 23704 bytes examples/sensors/grue/qml_app/main.qml | 27 +++++++++++++++++++++------ examples/sensors/grue/qml_app/qml_app.pro | 3 ++- 4 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 examples/sensors/grue/qml_app/grue.png create mode 100644 examples/sensors/grue/qml_app/grue.xcf (limited to 'examples/sensors/grue') diff --git a/examples/sensors/grue/qml_app/grue.png b/examples/sensors/grue/qml_app/grue.png new file mode 100644 index 00000000..f0b070b4 Binary files /dev/null and b/examples/sensors/grue/qml_app/grue.png differ diff --git a/examples/sensors/grue/qml_app/grue.xcf b/examples/sensors/grue/qml_app/grue.xcf new file mode 100644 index 00000000..2837ed7e Binary files /dev/null and b/examples/sensors/grue/qml_app/grue.xcf differ diff --git a/examples/sensors/grue/qml_app/main.qml b/examples/sensors/grue/qml_app/main.qml index 409e18f9..5b619c69 100644 --- a/examples/sensors/grue/qml_app/main.qml +++ b/examples/sensors/grue/qml_app/main.qml @@ -42,10 +42,10 @@ import QtQuick 2.0 import QtMobility.sensors 1.3 import Grue 1.0 -Item { +Rectangle { width: 240 - height: 330 - y: 30 + height: 320 + color: "black" GrueSensor { id: sensor @@ -53,27 +53,42 @@ Item { onReadingChanged: { var percent = reading.chanceOfBeingEaten; var thetext = ""; + var theopacity = 0; if (percent === 0) { thetext = "It is light. You are safe from Grues."; } else if (percent === 100) { thetext = "You have been eaten by a Grue!"; sensor.active = false; + theopacity = 1; } else if (percent > 0) { - thetext = "It is dark. You are likely to be eaten by a Grue."; - thetext += " Your chance of being eaten by a Grue: "+percent+" percent."; + thetext = "It is dark. You are likely to be eaten by a Grue. " + + "Your chance of being eaten by a Grue: "+percent+" percent."; + theopacity = 0.05 + (percent * 0.001); } text.font.pixelSize = 30; text.text = "

" + thetext + "

"; + grueimg.opacity = theopacity; } } Text { id: text - anchors.fill: parent + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right text: "I can't tell if you're going to be eaten by a Grue or not. You're on your own!" wrapMode: Text.WordWrap font.pixelSize: 50 + color: "white" + } + + Image { + id: grueimg + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + source: "grue.png" + opacity: 0 } } diff --git a/examples/sensors/grue/qml_app/qml_app.pro b/examples/sensors/grue/qml_app/qml_app.pro index 42f830be..c017dcc4 100644 --- a/examples/sensors/grue/qml_app/qml_app.pro +++ b/examples/sensors/grue/qml_app/qml_app.pro @@ -3,7 +3,8 @@ TEMPLATE = aux app.files = \ icon.png \ info.json \ - main.qml + main.qml \ + grue.png MT_SYSROOT=$$(MT_SYSROOT) !isEmpty(MT_SYSROOT):EXAMPLES_PREFIX=/opt/mt/applications -- cgit v1.2.3