2
2
import Ubuntu.Components 0.1
7
function timeChanged(now) {
9
minutes = now.getMinutes()
10
seconds = now.getUTCSeconds();
7
13
property var currDate: new Date;
8
14
property int hours: currDate.getHours()
9
15
property int minutes: currDate.getMinutes()
10
16
property int seconds: currDate.getUTCSeconds();
12
// set this to false when app goes to background
13
// hides the seconds hand since it doesnt really
14
// make sense to waste cycles on updating it
15
property bool isForeground: true
17
function timeChanged(now) {
18
hours = now.getHours()
19
minutes = now.getMinutes()
20
seconds = now.getUTCSeconds();
25
fillRectangle: clockOuterCircle
26
/* this animation might be a bit much considering
27
that the seconds hand is already moving...
29
SequentialAnimation on opacity {
30
running: clockRoot.isForeground
31
loops: Animation.Infinite
47
// TODO: this might as well be an image really
51
anchors.centerIn: parent
60
anchors.centerIn: clockOuterCircle
72
// TODO: set source according to theme?
73
rotationAngle: (clockRoot.hours * 30) + (clockRoot.minutes / 2)
79
// TODO: set source according to theme?
80
rotationAngle: clockRoot.minutes * 6
85
// TODO: set source according to theme?
88
rotationAngle: clockRoot.seconds * 6
93
delegate: AnalogClockMarker {
18
// "API" of the analog face
19
// say you want add a mousearea to one of the hands
20
// (e.g. when doing a timepicker), just do
23
minuteHandRect.children: MouseArea {
25
onClicked: // do something
29
property alias hourHandRect: hourHand
30
property alias minuteHandRect: minuteHand
31
property alias secondsHandRect: secondsHand
38
// TODO: set source according to theme?
39
rotationAngle: (clockRoot.hours * 30) + (clockRoot.minutes / 2)
45
// TODO: set source according to theme?
46
rotationAngle: clockRoot.minutes * 6
51
// TODO: set source according to theme?
54
rotationAngle: clockRoot.seconds * 6
59
delegate: AnalogClockMarker {