From 3dd28725a32c5eae6fa05c2bbe309c7919671cdc Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 2 Nov 2009 14:33:53 +1000 Subject: add night support for clocks example --- examples/declarative/clocks/content/Clock.qml | 5 ++++- examples/declarative/clocks/content/clock-night.png | Bin 0 -> 23359 bytes examples/declarative/clocks/content/clock.png | Bin 21780 -> 20653 bytes 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100755 examples/declarative/clocks/content/clock-night.png diff --git a/examples/declarative/clocks/content/Clock.qml b/examples/declarative/clocks/content/Clock.qml index 2aac5f1..0c6836f 100644 --- a/examples/declarative/clocks/content/Clock.qml +++ b/examples/declarative/clocks/content/Clock.qml @@ -9,10 +9,12 @@ Item { property var minutes property var seconds property var shift : 0 + property bool night: false function timeChanged() { var date = new Date; hours = shift ? date.getUTCHours() + Math.floor(clock.shift) : date.getHours() + if ( hours < 7 || hours > 19 ) night = true; else night = false minutes = shift ? date.getUTCMinutes() + ((clock.shift % 1) * 60) : date.getMinutes() seconds = date.getUTCSeconds(); } @@ -22,7 +24,8 @@ Item { onTriggered: clock.timeChanged() } - Image { id: background; source: "clock.png" } + Image { id: background; source: "clock.png"; visible: clock.night == false } + Image { source: "clock-night.png"; visible: clock.night == true } Image { x: 92.5; y: 27 diff --git a/examples/declarative/clocks/content/clock-night.png b/examples/declarative/clocks/content/clock-night.png new file mode 100755 index 0000000..cc7151a Binary files /dev/null and b/examples/declarative/clocks/content/clock-night.png differ diff --git a/examples/declarative/clocks/content/clock.png b/examples/declarative/clocks/content/clock.png index 30bc577..462edac 100755 Binary files a/examples/declarative/clocks/content/clock.png and b/examples/declarative/clocks/content/clock.png differ -- cgit v0.12