~ubuntu-clock-dev/ubuntu-clock-app/reboot-packaging

« back to all changes in this revision

Viewing changes to app/clock/AnalogMode.qml

  • Committer: Michael Zanetti
  • Date: 2014-07-13 14:45:39 UTC
  • mto: (20.1.4 10-world-clocks)
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: michael.zanetti@canonical.com-20140713144539-q204tshktb06fjxo
fix, explain the Zone class

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Copyright (C) 2014 Canonical Ltd
3
3
 *
4
 
 * This file is part of Ubuntu Clock App
5
 
 *
6
 
 * Ubuntu Clock App is free software: you can redistribute it and/or modify
 
4
 * This program is free software: you can redistribute it and/or modify
7
5
 * it under the terms of the GNU General Public License version 3 as
8
6
 * published by the Free Software Foundation.
9
7
 *
10
 
 * Ubuntu Clock App is distributed in the hope that it will be useful,
 
8
 * This program is distributed in the hope that it will be useful,
11
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
11
 * GNU General Public License for more details.
18
16
 
19
17
import QtQuick 2.0
20
18
import Ubuntu.Components 1.1
 
19
import "../components"
 
20
import "../components/Utils.js" as Utils
21
21
 
22
22
ClockCircle {
23
23
    id: _innerCircleAnalog
24
24
 
25
 
    // Property to set the max width when running the animation
26
 
    property int maxWidth
27
 
 
28
 
    // Property to show/hide the seconds hand
29
 
    property bool showSeconds
30
 
 
31
25
    function startAnimation() {
32
26
        _animationTimer.start()
33
27
    }
51
45
        smooth: true
52
46
        source: "../graphics/Hour_Hand.png"
53
47
        fillMode: Image.PreserveAspectFit
54
 
        rotation: (analogTime.getHours() * 30) + (analogTime.getMinutes() / 2)
 
48
        rotation: analogTime.getHours() * 30
55
49
    }
56
50
 
57
51
    Image {
63
57
        smooth: true
64
58
        source: "../graphics/Minute_Hand.png"
65
59
        fillMode: Image.PreserveAspectFit
66
 
        rotation: (analogTime.getMinutes() * 6) + (analogTime.getSeconds() / 10)
 
60
        rotation: analogTime.getMinutes() * 6
67
61
    }
68
62
 
69
63
    Image {
73
67
        width: parent.width + units.gu(2)
74
68
 
75
69
        smooth: true
76
 
        visible: showSeconds
77
70
        source: "../graphics/Second_Hand.png"
78
71
        fillMode: Image.PreserveAspectFit
79
 
        rotation: visible ? ((360 * ((analogTime.getSeconds() * 1000) +
80
 
                           analogTime.getMilliseconds())) / 60000) : 0
 
72
        rotation: analogTime.getSeconds() * 6
81
73
    }
82
74
 
83
75
    Image {
96
88
        target: _innerCircleAnalog
97
89
        property: "width"
98
90
        from: units.gu(0)
99
 
        to: maxWidth
 
91
        to: units.gu(23)
100
92
        duration: 900
101
93
    }
 
94
 
102
95
}