2
* Copyright (C) 2013 Canonical Ltd
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Alessandro Pozzi <signor.hyde@gmail.com>
17
* Nekhelesh Ramananthan <krnekhelesh@gmail.com>
21
import Ubuntu.Components 0.1
22
import "StopwatchSupport.js" as SScript
25
// This component draws the stopwatch analog UI and defines different UI modes like normal and easteregg.
29
property var startTime: 0;
30
property var stopTime: 0;
31
property int delay : 0;
32
property bool flag: true;
33
property int totalTime: 0;
35
property int hours: 0;
36
property int minutes: 0;
37
property int seconds: 0;
38
property int milliseconds: 0;
39
property int decimalgradient: 0;
41
// Sets the location and visible (bool) values of the blip (small circle visible when the lap button is pressed)
42
property alias blipLocation: blipFist.location;
43
property alias blipVisible: blipFist.visible;
45
// Retrieves the status of the stopwatch timer
46
property bool timerStatus: stopwatchUIUpdate.running
49
decimalgradient = totalTime = milliseconds = seconds = minutes = hours = 0
50
SScript.deltaTime[0] = SScript.deltaTime[1] = SScript.deltaTime[2] = SScript.deltaTime[3] = 0
51
startTime = stopTime = delay = 0;
56
stopwatchUIUpdate.start()
60
stopwatchUIUpdate.stop()
63
// Timer which runs every 100 microseconds to update the time and also the trailing hand gradient.
70
totalTime = SScript.delta();
71
SScript.deltaTime = SScript.msToTime(totalTime)
72
hours = SScript.deltaTime[0];
73
minutes = SScript.deltaTime[1];
74
seconds = SScript.deltaTime[2];
75
milliseconds = SScript.deltaTime[3];
76
decimalgradient = minutes * 10;
80
// This component draws the small orange circle that is visible everytime the lap button is pressed.
85
// This component draws the trailing shadow of the second hand.
88
rotationAngle: minutes * 6
89
decimalGradient: decimalgradient
95
model: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"]
97
delegate: AnalogClockMarker {
109
handHeight: units.gu(12.5); handWidth: units.gu(1);
110
rotation: hours * 15;
117
handHeight: units.gu(14.5); handWidth: units.gu(0.5);
118
rotation: minutes * 6;
125
handHeight: units.gu(17); handWidth: units.gu(0.5)
126
rotation: seconds * 6;