summaryrefslogtreecommitdiffstats
path: root/examples/sensors/grue
diff options
context:
space:
mode:
authorLincoln Ramsay <lincoln.ramsay@nokia.com>2012-03-06 12:42:04 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-08 03:12:22 +0100
commit59899eb9b8b7a68b3284fe9fe59b8a1e2610f6cf (patch)
treed56ead74359736fe127cad2925a0bcba71616f4b /examples/sensors/grue
parent22b8a1ca8ebb2d862fb99d061342a1190b747fec (diff)
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 <daron.edie@nokia.com>
Diffstat (limited to 'examples/sensors/grue')
-rw-r--r--examples/sensors/grue/qml_app/grue.pngbin0 -> 11207 bytes
-rw-r--r--examples/sensors/grue/qml_app/grue.xcfbin0 -> 23704 bytes
-rw-r--r--examples/sensors/grue/qml_app/main.qml27
-rw-r--r--examples/sensors/grue/qml_app/qml_app.pro3
4 files changed, 23 insertions, 7 deletions
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
--- /dev/null
+++ b/examples/sensors/grue/qml_app/grue.png
Binary files 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
--- /dev/null
+++ b/examples/sensors/grue/qml_app/grue.xcf
Binary files 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 = "<p>" + thetext + "</p>";
+ 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