summaryrefslogtreecommitdiffstats
path: root/examples/sensors/grue/qml_app
diff options
context:
space:
mode:
Diffstat (limited to 'examples/sensors/grue/qml_app')
-rw-r--r--examples/sensors/grue/qml_app/icon.pngbin0 -> 8145 bytes
-rw-r--r--examples/sensors/grue/qml_app/info.json12
-rw-r--r--examples/sensors/grue/qml_app/main.qml18
3 files changed, 24 insertions, 6 deletions
diff --git a/examples/sensors/grue/qml_app/icon.png b/examples/sensors/grue/qml_app/icon.png
new file mode 100644
index 00000000..e75e5003
--- /dev/null
+++ b/examples/sensors/grue/qml_app/icon.png
Binary files differ
diff --git a/examples/sensors/grue/qml_app/info.json b/examples/sensors/grue/qml_app/info.json
new file mode 100644
index 00000000..6fba4427
--- /dev/null
+++ b/examples/sensors/grue/qml_app/info.json
@@ -0,0 +1,12 @@
+{
+ "info-version": "1.0",
+ "dict": {
+ "DisplayName": "Grue Sensor",
+ "Identifier": "6777c7a0-782e-432a-9598-322335ebd441",
+ "Runtime": "qml",
+ "MainQML": "main.qml",
+ "Version": "1.0.0",
+ "Category": "application",
+ "Summary": "The Grue sensor identifies your chance of being eaten by a Grue."
+ }
+}
diff --git a/examples/sensors/grue/qml_app/main.qml b/examples/sensors/grue/qml_app/main.qml
index 278bf727..b50f0ca7 100644
--- a/examples/sensors/grue/qml_app/main.qml
+++ b/examples/sensors/grue/qml_app/main.qml
@@ -39,11 +39,13 @@
****************************************************************************/
import QtQuick 2.0
+import QtMobility.sensors 1.3
import Grue 1.0
Item {
- width: 200
- height: 300
+ width: 240
+ height: 330
+ y: 30
GrueSensor {
id: sensor
@@ -51,17 +53,20 @@ Item {
property int lastPercent: 0
onReadingChanged: {
var percent = Math.floor(reading.chanceOfBeingEaten * 100);
+ var thetext = "";
if (percent == 0) {
- text.text = "It is light. You are safe from Grues.";
+ thetext = "It is light. You are safe from Grues.";
} else if (lastPercent == 0) {
- text.text = "It is dark. You are likely to be eaten by a Grue.";
+ thetext = "It is dark. You are likely to be eaten by a Grue.";
}
if (percent == 100) {
- text.text += "You have been eaten by a Grue!";
+ thetext += " You have been eaten by a Grue!";
sensor.active = false;
} else if (percent) {
- text.text += "Your chance of being eaten by a Grue: "+percent+" percent.";
+ thetext += " Your chance of being eaten by a Grue: "+percent+" percent.";
}
+ text.font.pixelSize = 30;
+ text.text = "<p>" + thetext + "</p>";
lastPercent = percent;
}
}
@@ -71,5 +76,6 @@ Item {
anchors.fill: parent
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
}
}