Merge lp:~nik90/ubuntu-clock-app/dialer-transition into lp:ubuntu-clock-app/saucy
- dialer-transition
- Merge into saucy
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Michael Zanetti | ||||
Approved revision: | 303 | ||||
Merged at revision: | 286 | ||||
Proposed branch: | lp:~nik90/ubuntu-clock-app/dialer-transition | ||||
Merge into: | lp:ubuntu-clock-app/saucy | ||||
Diff against target: |
1610 lines (+462/-855) 19 files modified
alarm/AddAlarmPage.qml (+14/-53) alarm/AlarmFace.qml (+52/-0) alarm/AlarmPage.qml (+4/-9) alarm/AnalogAlarm.qml (+0/-72) clock/AnalogClockFace.qml (+0/-72) clock/ClockPage.qml (+21/-6) common/AnalogClockHand.qml (+0/-50) common/AnalogFaceBase.qml (+0/-149) common/AnalogGlowEffect.qml (+1/-1) common/AnalogTouchHand.qml (+0/-108) common/ClockBase.qml (+94/-0) common/ClockUtils.js (+11/-0) stopwatch/AnalogStopwatch.qml (+0/-128) stopwatch/StopwatchFace.qml (+91/-0) stopwatch/StopwatchPage.qml (+25/-25) tests/autopilot/ubuntu_clock_app/emulators.py (+10/-10) timer/AnalogTimer.qml (+0/-121) timer/TimerFace.qml (+99/-0) timer/TimerPage.qml (+40/-51) |
||||
To merge this branch: | bzr merge lp:~nik90/ubuntu-clock-app/dialer-transition | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Michael Zanetti (community) | Approve | ||
Ubuntu Clock Developers | Pending | ||
Review via email: mp+200740@code.launchpad.net |
Commit message
Transitions the clock app to use the SDK Dialer widget
Description of the change
Transitions the clock app to use the SDK Dialer widget
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:291
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:294
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:295
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alan Pope πΊπ§π± π¦ (popey) wrote : | # |
Ran 12 tests in 257.827s
OK
Passed autopilot tests on nexus 4.
Nekhelesh Ramananthan (nik90) wrote : | # |
Noticed a small issue with the timer hand animation. I have a fix in mind. Will comment again when that is ready.
Michael Zanetti (mzanetti) wrote : | # |
18 + // The range of the analogue clock is 0-60 while the alarm hours should be between 00-23. Hence the factor 23/60
19 + alarmTime.
Could it make sense to create a function hoursToCirclePo
===
1079 + 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"]
model: 23
should be enough
===
803 + // Property to help with the naming of the clock hands for autopilot purposes
804 + property string objectBase: "Default"
I think it would be cleaner to drop this and change the autopilot tests to do a 2 step search. eg.
select_
Nekhelesh Ramananthan (nik90) wrote : | # |
Timer animation glitch fixed. Ready for review!
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:296
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 297. By Nekhelesh Ramananthan
-
Simplified repeater stopwatch face model
- 298. By Nekhelesh Ramananthan
-
Removed objectBase and adjusted autopilot tests for it
- 299. By Nekhelesh Ramananthan
-
Tweaked timer text update duration to 250ms to match timerhand animation duration
- 300. By Nekhelesh Ramananthan
-
Added functions hourstoCirclePo
sition( ) and circlePositiont oHours( ) in add alarm page
Nekhelesh Ramananthan (nik90) wrote : | # |
>
> 1079 + 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"]
>
> model: 23
> should be enough
>
Fixed in rev 297
Nekhelesh Ramananthan (nik90) wrote : | # |
> 18 + // The range of the analogue clock is 0-60 while the alarm hours
> should be between 00-23. Hence the factor 23/60
> 19 + alarmTime.
> Math.round(
>
> Could it make sense to create a function hoursToCirclePo
> copy pasting this all over the place?
>
Fixed in rev 300
Nekhelesh Ramananthan (nik90) wrote : | # |
>
> 803 + // Property to help with the naming of the clock hands for autopilot
> purposes
> 804 + property string objectBase: "Default"
>
> I think it would be cleaner to drop this and change the autopilot tests to do
> a 2 step search. eg.
>
> select_
> )
Fixed in rev 298
Nekhelesh Ramananthan (nik90) wrote : | # |
Also reduced timer text update duration from 500 to 250ms in rev 299
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:300
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michael Zanetti (mzanetti) wrote : | # |
88 + // The range of the analogue clock is 0-60 while the alarm hours should be between 00-23. Hence the factor 23/60
This comment can now go, no?
===
175 + onMinutesChanged: innerLabel.text = Utils.zeroleft(
Seems its also used in the Alarms stuff. Maybe it belongs into Utils?
- 301. By Nekhelesh Ramananthan
-
moved functions hourstocirclepo
sition( ) and circlepositiont ohours( ) to ClockUtils.js - 302. By Nekhelesh Ramananthan
-
Fixed clock hand position
Nekhelesh Ramananthan (nik90) wrote : | # |
> 88 + // The range of the analogue clock is 0-60 while the alarm hours
> should be between 00-23. Hence the factor 23/60
>
> This comment can now go, no?
>
Absolutely. I missed it before. Fixed in rev 301
>
> 175 + onMinutesChanged: innerLabel.text = Utils.zeroleft(
> ":" + Utils.zeroleft(
>
> Seems its also used in the Alarms stuff. Maybe it belongs into Utils?
I think for this commit, moving to Utils makes sense. However this might change in the near future since the alarms page should technically follow a similar behaviour to the clock page where the hours range is between 0-12 instead of 0-24. However that will come only after design approval.
Fixed in rev 301.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:302
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 303. By Nekhelesh Ramananthan
-
Missed one alarm statement
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:303
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'alarm/AddAlarmPage.qml' | |||
2 | --- alarm/AddAlarmPage.qml 2013-12-29 20:53:56 +0000 | |||
3 | +++ alarm/AddAlarmPage.qml 2014-01-10 14:02:26 +0000 | |||
4 | @@ -62,8 +62,6 @@ | |||
5 | 62 | if (status != Alarm.Ready) | 62 | if (status != Alarm.Ready) |
6 | 63 | return; | 63 | return; |
7 | 64 | if ((operation > Alarm.NoOperation) && (operation < Alarm.Reseting)) { | 64 | if ((operation > Alarm.NoOperation) && (operation < Alarm.Reseting)) { |
8 | 65 | reset(); | ||
9 | 66 | resetPage() | ||
10 | 67 | pagestack.pop(); | 65 | pagestack.pop(); |
11 | 68 | } | 66 | } |
12 | 69 | } | 67 | } |
13 | @@ -72,7 +70,8 @@ | |||
14 | 72 | // Function to save a new alarm | 70 | // Function to save a new alarm |
15 | 73 | function saveNewAlarm() { | 71 | function saveNewAlarm() { |
16 | 74 | var alarmTime = new Date(); | 72 | var alarmTime = new Date(); |
18 | 75 | alarmTime.setHours(addAlarmFace.hours, addAlarmFace.minutes, 0) | 73 | |
19 | 74 | alarmTime.setHours(Utils.hourstoCirclePosition(addAlarmFace.hours), Math.round(addAlarmFace.minutes), 0) | ||
20 | 76 | 75 | ||
21 | 77 | alarm.message = nameAlarm.text | 76 | alarm.message = nameAlarm.text |
22 | 78 | alarm.date = alarmTime | 77 | alarm.date = alarmTime |
23 | @@ -101,32 +100,25 @@ | |||
24 | 101 | alarm.enabled = temp_alarm.enabled | 100 | alarm.enabled = temp_alarm.enabled |
25 | 102 | alarm.date = temp_alarm.date | 101 | alarm.date = temp_alarm.date |
26 | 103 | 102 | ||
29 | 104 | addAlarmFace.hours = Qt.formatTime(alarm.date, "hh") | 103 | addAlarmFace.hours = Utils.circlePositiontoHours(Qt.formatTime(alarm.date, "hh")) |
28 | 105 | addAlarmFace.hourHandRotation = addAlarmFace.hours * 15 | ||
30 | 106 | addAlarmFace.minutes = Qt.formatTime(alarm.date, "mm") | 104 | addAlarmFace.minutes = Qt.formatTime(alarm.date, "mm") |
31 | 107 | addAlarmFace.minuteHandRotation = addAlarmFace.minutes * 6 | ||
32 | 108 | } | 105 | } |
33 | 109 | 106 | ||
34 | 110 | function updateAlarm() { | 107 | function updateAlarm() { |
35 | 111 | var temp_alarm = alarmModel.get(alarmIndex) | 108 | var temp_alarm = alarmModel.get(alarmIndex) |
36 | 112 | 109 | ||
37 | 113 | var alarmTime = new Date() | 110 | var alarmTime = new Date() |
39 | 114 | alarmTime.setHours(addAlarmFace.hours, addAlarmFace.minutes, 0) | 111 | |
40 | 112 | alarmTime.setHours(Utils.hourstoCirclePosition(addAlarmFace.hours), Math.round(addAlarmFace.minutes), 0) | ||
41 | 115 | 113 | ||
42 | 116 | temp_alarm.message = nameAlarm.text | 114 | temp_alarm.message = nameAlarm.text |
43 | 117 | temp_alarm.type = alarm.type | 115 | temp_alarm.type = alarm.type |
44 | 118 | temp_alarm.daysOfWeek = alarm.daysOfWeek | 116 | temp_alarm.daysOfWeek = alarm.daysOfWeek |
45 | 119 | temp_alarm.date = alarmTime | 117 | temp_alarm.date = alarmTime |
46 | 120 | temp_alarm.save() | 118 | temp_alarm.save() |
47 | 121 | resetPage() | ||
48 | 122 | pagestack.pop() | 119 | pagestack.pop() |
49 | 123 | } | 120 | } |
50 | 124 | 121 | ||
51 | 125 | function resetPage() { | ||
52 | 126 | addAlarmFace.hours = addAlarmFace.minutes = 0; | ||
53 | 127 | addAlarmFace.hourHandRotation = addAlarmFace.minuteHandRotation = 0 | ||
54 | 128 | } | ||
55 | 129 | |||
56 | 130 | Timer { | 122 | Timer { |
57 | 131 | id: errorTimer | 123 | id: errorTimer |
58 | 132 | interval: 1000 | 124 | interval: 1000 |
59 | @@ -149,58 +141,27 @@ | |||
60 | 149 | spacing: units.gu(1) | 141 | spacing: units.gu(1) |
61 | 150 | anchors { left: parent.left; right: parent.right; top: parent.top; topMargin: units.gu(5)} | 142 | anchors { left: parent.left; right: parent.right; top: parent.top; topMargin: units.gu(5)} |
62 | 151 | 143 | ||
64 | 152 | AnalogFaceBase { | 144 | ClockBase { |
65 | 153 | id: addAlarmFace | 145 | id: addAlarmFace |
66 | 154 | 146 | ||
71 | 155 | property int hours: 0 | 147 | draggable: true |
72 | 156 | property int minutes: 0 | 148 | showSecondHand: false |
69 | 157 | property alias hourHandRotation: hourHand.rotationValue | ||
70 | 158 | property alias minuteHandRotation: minuteHand.rotationValue | ||
73 | 159 | 149 | ||
76 | 160 | onMinutesChanged: innerLabel.text = Utils.zeroleft(addAlarmFace.hours, 2) + ":" + Utils.zeroleft(addAlarmFace.minutes, 2); | 150 | onMinutesChanged: innerLabel.text = Utils.zeroleft(Utils.hourstoCirclePosition(hours), 2) + ":" + Utils.zeroleft(minutes, 2); |
77 | 161 | onHoursChanged: innerLabel.text = Utils.zeroleft(addAlarmFace.hours, 2) + ":" + Utils.zeroleft(addAlarmFace.minutes, 2); | 151 | onHoursChanged: innerLabel.text = Utils.zeroleft(Utils.hourstoCirclePosition(hours), 2) + ":" + Utils.zeroleft(minutes, 2); |
78 | 162 | 152 | ||
79 | 163 | innerLabel.objectName: "labelAlarm" | 153 | innerLabel.objectName: "labelAlarm" |
81 | 164 | innerLabel.text: Utils.zeroleft(addAlarmFace.hours, 2) + ":" + Utils.zeroleft(addAlarmFace.minutes, 2) | 154 | innerLabel.text: Utils.zeroleft(Utils.hourstoCirclePosition(hours), 2) + ":" + Utils.zeroleft(minutes, 2) |
82 | 165 | 155 | ||
83 | 166 | anchors.horizontalCenter: parent.horizontalCenter | 156 | anchors.horizontalCenter: parent.horizontalCenter |
84 | 167 | 157 | ||
85 | 168 | // Hour hand with touch/mouse drag support | ||
86 | 169 | AnalogTouchHand { | ||
87 | 170 | id: hourHand | ||
88 | 171 | objectName: "hourHand" | ||
89 | 172 | |||
90 | 173 | onTimerValueChanged: addAlarmFace.hours = timerValue; | ||
91 | 174 | |||
92 | 175 | perAngle: 15; | ||
93 | 176 | totalValue: 24; | ||
94 | 177 | handHeight: units.gu(12.5); handWidth: units.gu(1); | ||
95 | 178 | z: minuteHand.z + 1; | ||
96 | 179 | animateFlag: false; | ||
97 | 180 | enabled: true; | ||
98 | 181 | grabMargin: units.gu(3); | ||
99 | 182 | } | ||
100 | 183 | |||
101 | 184 | // Minute hand with touch/mouse drag support | ||
102 | 185 | AnalogTouchHand { | ||
103 | 186 | id: minuteHand | ||
104 | 187 | |||
105 | 188 | onTimerValueChanged: addAlarmFace.minutes = timerValue; | ||
106 | 189 | |||
107 | 190 | handHeight: units.gu(14.5); handWidth: units.gu(0.5); | ||
108 | 191 | animateFlag: false; | ||
109 | 192 | enabled: true; | ||
110 | 193 | grabMargin: units.gu(0) | ||
111 | 194 | grabHeight: units.gu(7) | ||
112 | 195 | } | ||
113 | 196 | |||
114 | 197 | Label { | 158 | Label { |
115 | 198 | id: errorLabel | 159 | id: errorLabel |
116 | 199 | visible: false | 160 | visible: false |
118 | 200 | z: addAlarmFace.innerCircle.z + 1 | 161 | parent: addAlarmFace.centerItem |
119 | 201 | anchors { | 162 | anchors { |
122 | 202 | centerIn: addAlarmFace.innerCircle | 163 | centerIn: parent |
123 | 203 | fill: addAlarmFace.innerCircle | 164 | fill: parent |
124 | 204 | margins: units.gu(2) | 165 | margins: units.gu(2) |
125 | 205 | } | 166 | } |
126 | 206 | horizontalAlignment: Text.AlignHCenter | 167 | horizontalAlignment: Text.AlignHCenter |
127 | 207 | 168 | ||
128 | === added file 'alarm/AlarmFace.qml' | |||
129 | --- alarm/AlarmFace.qml 1970-01-01 00:00:00 +0000 | |||
130 | +++ alarm/AlarmFace.qml 2014-01-10 14:02:26 +0000 | |||
131 | @@ -0,0 +1,52 @@ | |||
132 | 1 | /* | ||
133 | 2 | * Copyright (C) 2013 Canonical Ltd | ||
134 | 3 | * | ||
135 | 4 | * This program is free software: you can redistribute it and/or modify | ||
136 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
137 | 6 | * published by the Free Software Foundation. | ||
138 | 7 | * | ||
139 | 8 | * This program is distributed in the hope that it will be useful, | ||
140 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
141 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
142 | 11 | * GNU General Public License for more details. | ||
143 | 12 | * | ||
144 | 13 | * You should have received a copy of the GNU General Public License | ||
145 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
146 | 15 | * | ||
147 | 16 | * Authored by: Nekhelesh Ramananthan <krnekhelesh@gmail.com> | ||
148 | 17 | */ | ||
149 | 18 | |||
150 | 19 | import QtQuick 2.0 | ||
151 | 20 | import Ubuntu.Components 0.1 | ||
152 | 21 | import "../common" | ||
153 | 22 | import "../common/ClockUtils.js" as Utils | ||
154 | 23 | |||
155 | 24 | ClockBase { | ||
156 | 25 | id: alarmFace | ||
157 | 26 | |||
158 | 27 | property alias showSetupMessage: setupMessage.visible | ||
159 | 28 | |||
160 | 29 | showSecondHand: false | ||
161 | 30 | |||
162 | 31 | onMinutesChanged: innerLabel.text = Utils.zeroleft(Utils.hourstoCirclePosition(hours), 2) + ":" + Utils.zeroleft(minutes, 2) | ||
163 | 32 | onHoursChanged: innerLabel.text = Utils.zeroleft(Utils.hourstoCirclePosition(hours), 2) + ":" + Utils.zeroleft(minutes, 2) | ||
164 | 33 | |||
165 | 34 | innerLabel.visible: !setupMessage.visible | ||
166 | 35 | innerLabel.text: Utils.zeroleft(Utils.hourstoCirclePosition(hours), 2) + ":" + Utils.zeroleft(minutes, 2) | ||
167 | 36 | |||
168 | 37 | Label { | ||
169 | 38 | id: setupMessage | ||
170 | 39 | objectName: "labelAlarmSetup" | ||
171 | 40 | |||
172 | 41 | parent: alarmFace.centerItem | ||
173 | 42 | width: parent.width; height: width; | ||
174 | 43 | anchors.centerIn: parent | ||
175 | 44 | horizontalAlignment: Text.AlignHCenter | ||
176 | 45 | verticalAlignment: Text.AlignVCenter | ||
177 | 46 | color: Theme.palette.normal.baseText | ||
178 | 47 | |||
179 | 48 | fontSize: "large" | ||
180 | 49 | text: i18n.tr("Long press to setup an alarm") | ||
181 | 50 | wrapMode: Text.WordWrap | ||
182 | 51 | } | ||
183 | 52 | } | ||
184 | 0 | 53 | ||
185 | === modified file 'alarm/AlarmPage.qml' | |||
186 | --- alarm/AlarmPage.qml 2013-10-26 19:26:49 +0000 | |||
187 | +++ alarm/AlarmPage.qml 2014-01-10 14:02:26 +0000 | |||
188 | @@ -69,7 +69,7 @@ | |||
189 | 69 | nextAlarm = alarmModel.get(i) | 69 | nextAlarm = alarmModel.get(i) |
190 | 70 | } | 70 | } |
191 | 71 | nameAlarm.text = nextAlarm.message | 71 | nameAlarm.text = nextAlarm.message |
193 | 72 | alarmFace.hours = Qt.formatTime(nextAlarm.date, "hh") | 72 | alarmFace.hours = Utils.circlePositiontoHours(Qt.formatTime(nextAlarm.date, "hh")) |
194 | 73 | alarmFace.minutes = Qt.formatTime(nextAlarm.date, "mm") | 73 | alarmFace.minutes = Qt.formatTime(nextAlarm.date, "mm") |
195 | 74 | } | 74 | } |
196 | 75 | else { | 75 | else { |
197 | @@ -118,18 +118,13 @@ | |||
198 | 118 | UbuntuNumberAnimation { duration: UbuntuAnimation.SlowDuration } | 118 | UbuntuNumberAnimation { duration: UbuntuAnimation.SlowDuration } |
199 | 119 | } | 119 | } |
200 | 120 | 120 | ||
202 | 121 | AnalogAlarm { | 121 | AlarmFace { |
203 | 122 | id: alarmFace | 122 | id: alarmFace |
204 | 123 | 123 | ||
205 | 124 | anchors { top: parent.top; topMargin: units.gu(10); horizontalCenter: parent.horizontalCenter } | 124 | anchors { top: parent.top; topMargin: units.gu(10); horizontalCenter: parent.horizontalCenter } |
206 | 125 | showSetupMessage: modelCount == 0 ? true : false | 125 | showSetupMessage: modelCount == 0 ? true : false |
214 | 126 | 126 | enableMouseArea: showSetupMessage | |
215 | 127 | MouseArea { | 127 | onPressAndHold: pagestack.push(Qt.resolvedUrl("AddAlarmPage.qml"), {"isNewAlarm": true}) |
209 | 128 | id: alarmMouseArea | ||
210 | 129 | anchors.fill: alarmFace.innerCircle | ||
211 | 130 | enabled: alarmFace.showSetupMessage | ||
212 | 131 | onPressAndHold: pagestack.push(Qt.resolvedUrl("AddAlarmPage.qml"), {"isNewAlarm": true}) | ||
213 | 132 | } | ||
216 | 133 | } | 128 | } |
217 | 134 | 129 | ||
218 | 135 | // Element to set the name of a saved preset. | 130 | // Element to set the name of a saved preset. |
219 | 136 | 131 | ||
220 | === removed file 'alarm/AnalogAlarm.qml' | |||
221 | --- alarm/AnalogAlarm.qml 2013-10-26 12:20:55 +0000 | |||
222 | +++ alarm/AnalogAlarm.qml 1970-01-01 00:00:00 +0000 | |||
223 | @@ -1,72 +0,0 @@ | |||
224 | 1 | /* | ||
225 | 2 | * Copyright (C) 2013 Canonical Ltd | ||
226 | 3 | * | ||
227 | 4 | * This program is free software: you can redistribute it and/or modify | ||
228 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
229 | 6 | * published by the Free Software Foundation. | ||
230 | 7 | * | ||
231 | 8 | * This program is distributed in the hope that it will be useful, | ||
232 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
233 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
234 | 11 | * GNU General Public License for more details. | ||
235 | 12 | * | ||
236 | 13 | * You should have received a copy of the GNU General Public License | ||
237 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
238 | 15 | * | ||
239 | 16 | * Authored by: Nekhelesh Ramananthan <krnekhelesh@gmail.com> | ||
240 | 17 | */ | ||
241 | 18 | |||
242 | 19 | import QtQuick 2.0 | ||
243 | 20 | import Ubuntu.Components 0.1 | ||
244 | 21 | import "../common" | ||
245 | 22 | import "../common/ClockUtils.js" as Utils | ||
246 | 23 | |||
247 | 24 | // Component which draws the analog alarm face. | ||
248 | 25 | AnalogFaceBase { | ||
249 | 26 | id: alarmRoot | ||
250 | 27 | |||
251 | 28 | property int hours: 0 | ||
252 | 29 | property int minutes: 0 | ||
253 | 30 | property alias showSetupMessage: setupMessage.visible; | ||
254 | 31 | |||
255 | 32 | onMinutesChanged: innerLabel.text = Utils.zeroleft(hours, 2) + ":" + Utils.zeroleft(minutes, 2); | ||
256 | 33 | onHoursChanged: innerLabel.text = Utils.zeroleft(hours, 2) + ":" + Utils.zeroleft(minutes, 2) | ||
257 | 34 | |||
258 | 35 | innerLabel.visible: !setupMessage.visible | ||
259 | 36 | innerLabel.text: Utils.zeroleft(alarmRoot.hours, 2) + ":" + Utils.zeroleft(alarmRoot.minutes, 2) | ||
260 | 37 | |||
261 | 38 | Label { | ||
262 | 39 | id: setupMessage | ||
263 | 40 | objectName: "labelAlarmSetup" | ||
264 | 41 | |||
265 | 42 | z: innerCircle.z + 1 | ||
266 | 43 | width: innerCircle.width; height: width; | ||
267 | 44 | anchors.centerIn: alarmRoot | ||
268 | 45 | horizontalAlignment: Text.AlignHCenter | ||
269 | 46 | verticalAlignment: Text.AlignVCenter | ||
270 | 47 | color: Theme.palette.normal.baseText | ||
271 | 48 | |||
272 | 49 | fontSize: "large" | ||
273 | 50 | text: i18n.tr("Long press \nto setup \nan alarm") | ||
274 | 51 | wrapMode: Text.WordWrap | ||
275 | 52 | } | ||
276 | 53 | |||
277 | 54 | AnalogClockHand { | ||
278 | 55 | id: hourHand | ||
279 | 56 | objectName: "alarmHourHand" | ||
280 | 57 | |||
281 | 58 | z: parent.z | ||
282 | 59 | handHeight: units.gu(12.5); handWidth: units.gu(1); | ||
283 | 60 | rotation: (alarmRoot.hours * 15) + (alarmRoot.minutes / 2); | ||
284 | 61 | } | ||
285 | 62 | |||
286 | 63 | AnalogClockHand { | ||
287 | 64 | id: minuteHand | ||
288 | 65 | objectName: "alarmMinuteHand" | ||
289 | 66 | |||
290 | 67 | z: parent.z + 1 | ||
291 | 68 | handHeight: units.gu(14.5); handWidth: units.gu(0.5); | ||
292 | 69 | rotation: alarmRoot.minutes * 6; | ||
293 | 70 | } | ||
294 | 71 | |||
295 | 72 | } | ||
296 | 73 | 0 | ||
297 | === removed file 'clock/AnalogClockFace.qml' | |||
298 | --- clock/AnalogClockFace.qml 2013-10-26 12:20:55 +0000 | |||
299 | +++ clock/AnalogClockFace.qml 1970-01-01 00:00:00 +0000 | |||
300 | @@ -1,72 +0,0 @@ | |||
301 | 1 | /* | ||
302 | 2 | * Copyright (C) 2013 Canonical Ltd | ||
303 | 3 | * | ||
304 | 4 | * This program is free software: you can redistribute it and/or modify | ||
305 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
306 | 6 | * published by the Free Software Foundation. | ||
307 | 7 | * | ||
308 | 8 | * This program is distributed in the hope that it will be useful, | ||
309 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
310 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
311 | 11 | * GNU General Public License for more details. | ||
312 | 12 | * | ||
313 | 13 | * You should have received a copy of the GNU General Public License | ||
314 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
315 | 15 | * | ||
316 | 16 | * Authored by: Juha Ristolainen <juha.ristolainen@codemancers.fi> | ||
317 | 17 | * Nekhelesh Ramananthan <krnekhelesh@gmail.com> | ||
318 | 18 | * Nick LeppΓ€nen Larsson <frals@frals.se> | ||
319 | 19 | */ | ||
320 | 20 | |||
321 | 21 | import QtQuick 2.0 | ||
322 | 22 | import Ubuntu.Components 0.1 | ||
323 | 23 | import "../common" | ||
324 | 24 | |||
325 | 25 | // Element which draws the clock face along with the hour, minute, second hand and the clock label | ||
326 | 26 | AnalogFaceBase { | ||
327 | 27 | id: clockRoot | ||
328 | 28 | |||
329 | 29 | property var currDate: new Date; | ||
330 | 30 | property int hours: currDate.getHours() | ||
331 | 31 | property int minutes: currDate.getMinutes() | ||
332 | 32 | property int seconds: currDate.getUTCSeconds(); | ||
333 | 33 | |||
334 | 34 | signal clicked(var mouse) | ||
335 | 35 | |||
336 | 36 | function timeChanged(now) { | ||
337 | 37 | hours = now.getHours() | ||
338 | 38 | minutes = now.getMinutes() | ||
339 | 39 | seconds = now.getUTCSeconds(); | ||
340 | 40 | } | ||
341 | 41 | |||
342 | 42 | AnalogClockHand { | ||
343 | 43 | id: hourHand | ||
344 | 44 | |||
345 | 45 | z: parent.z | ||
346 | 46 | handHeight: units.gu(12.5); handWidth: units.gu(1); | ||
347 | 47 | rotation: (hours * 30) + (minutes / 2); | ||
348 | 48 | } | ||
349 | 49 | |||
350 | 50 | AnalogClockHand { | ||
351 | 51 | id: minuteHand | ||
352 | 52 | |||
353 | 53 | z: parent.z + 1 | ||
354 | 54 | handHeight: units.gu(14.5); handWidth: units.gu(0.5); | ||
355 | 55 | rotation: minutes * 6; | ||
356 | 56 | } | ||
357 | 57 | |||
358 | 58 | AnalogClockHand { | ||
359 | 59 | id: secondsHand | ||
360 | 60 | |||
361 | 61 | z: parent.z - 1; | ||
362 | 62 | handHeight: units.gu(17); handWidth: units.gu(0.5) | ||
363 | 63 | rotation: seconds * 6; | ||
364 | 64 | } | ||
365 | 65 | |||
366 | 66 | // Mouse area to reveal the clock sunrise/sunset on clicking the clock face | ||
367 | 67 | MouseArea { | ||
368 | 68 | anchors.fill: parent | ||
369 | 69 | z: parent.z + 1; | ||
370 | 70 | onClicked: clockRoot.clicked(mouse); | ||
371 | 71 | } | ||
372 | 72 | } | ||
373 | 73 | 0 | ||
374 | === modified file 'clock/ClockPage.qml' | |||
375 | --- clock/ClockPage.qml 2013-11-07 16:35:51 +0000 | |||
376 | +++ clock/ClockPage.qml 2014-01-10 14:02:26 +0000 | |||
377 | @@ -26,7 +26,7 @@ | |||
378 | 26 | import "../common" | 26 | import "../common" |
379 | 27 | 27 | ||
380 | 28 | Page { | 28 | Page { |
382 | 29 | id: clockPage; | 29 | id: clockPage |
383 | 30 | 30 | ||
384 | 31 | // Property to hold the formatted time string to show on the screen | 31 | // Property to hold the formatted time string to show on the screen |
385 | 32 | property string currentTimeFormatted | 32 | property string currentTimeFormatted |
386 | @@ -113,13 +113,27 @@ | |||
387 | 113 | contentWidth: parent.width | 113 | contentWidth: parent.width |
388 | 114 | contentHeight: clockFace.height + clockFace.anchors.topMargin + savedWorldClock.height + savedWorldClock.anchors.topMargin + units.gu(3) | 114 | contentHeight: clockFace.height + clockFace.anchors.topMargin + savedWorldClock.height + savedWorldClock.anchors.topMargin + units.gu(3) |
389 | 115 | 115 | ||
392 | 116 | // Qml Element to draw the analogue clock face along with its hour, minute and second hands. | 116 | // QML Element to draw the analogue clock face along with its hour, minute and second hands. |
393 | 117 | AnalogClockFace { | 117 | ClockBase { |
394 | 118 | id: clockFace | 118 | id: clockFace |
395 | 119 | 119 | ||
397 | 120 | anchors { top: parent.top; topMargin: units.gu(10); horizontalCenter: parent.horizontalCenter } | 120 | anchors { |
398 | 121 | top: parent.top | ||
399 | 122 | topMargin: units.gu(10) | ||
400 | 123 | horizontalCenter: parent.horizontalCenter | ||
401 | 124 | } | ||
402 | 125 | |||
403 | 121 | innerLabel.text: currentTimeFormatted | 126 | innerLabel.text: currentTimeFormatted |
405 | 122 | innerLabel.objectName: "currentTimeLabel" | 127 | |
406 | 128 | hours: new Date().getHours() * 5 | ||
407 | 129 | minutes: new Date().getMinutes() | ||
408 | 130 | seconds: new Date().getUTCSeconds() | ||
409 | 131 | |||
410 | 132 | function timeChanged(now) { | ||
411 | 133 | hours = now.getHours() * 5 | ||
412 | 134 | minutes = now.getMinutes() | ||
413 | 135 | seconds = now.getUTCSeconds(); | ||
414 | 136 | } | ||
415 | 123 | 137 | ||
416 | 124 | onClicked: { | 138 | onClicked: { |
417 | 125 | if (easterEggCircle.isReady == XmlListModel.Ready && worldModel.city !== "undefined") | 139 | if (easterEggCircle.isReady == XmlListModel.Ready && worldModel.city !== "undefined") |
418 | @@ -131,8 +145,9 @@ | |||
419 | 131 | 145 | ||
420 | 132 | EasterEgg { | 146 | EasterEgg { |
421 | 133 | id: easterEggCircle | 147 | id: easterEggCircle |
422 | 148 | parent: clockFace.centerItem | ||
423 | 134 | anchors.centerIn: parent | 149 | anchors.centerIn: parent |
425 | 135 | width: clockFace.innerCircle.width; height: width; | 150 | width: clockFace.centerItem.width; height: width; |
426 | 136 | radius: width / 2; | 151 | radius: width / 2; |
427 | 137 | } | 152 | } |
428 | 138 | 153 | ||
429 | 139 | 154 | ||
430 | === removed file 'common/AnalogClockHand.qml' | |||
431 | --- common/AnalogClockHand.qml 2013-07-14 11:36:59 +0000 | |||
432 | +++ common/AnalogClockHand.qml 1970-01-01 00:00:00 +0000 | |||
433 | @@ -1,50 +0,0 @@ | |||
434 | 1 | /* | ||
435 | 2 | * Copyright (C) 2013 Canonical Ltd | ||
436 | 3 | * | ||
437 | 4 | * This program is free software: you can redistribute it and/or modify | ||
438 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
439 | 6 | * published by the Free Software Foundation. | ||
440 | 7 | * | ||
441 | 8 | * This program is distributed in the hope that it will be useful, | ||
442 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
443 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
444 | 11 | * GNU General Public License for more details. | ||
445 | 12 | * | ||
446 | 13 | * You should have received a copy of the GNU General Public License | ||
447 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
448 | 15 | * | ||
449 | 16 | * Authored by: Nekhelesh Ramananthan <krnekhelesh@gmail.com> | ||
450 | 17 | */ | ||
451 | 18 | |||
452 | 19 | import QtQuick 2.0 | ||
453 | 20 | |||
454 | 21 | // Qml component to draw the analog clock hand | ||
455 | 22 | Rectangle{ | ||
456 | 23 | id: analogClockHandContainer | ||
457 | 24 | |||
458 | 25 | property alias handHeight: analogClockHand.height | ||
459 | 26 | property alias handWidth: analogClockHand.width | ||
460 | 27 | property alias handRotationAnimation: analogClockHandRotation.enabled | ||
461 | 28 | |||
462 | 29 | radius: width / 2 | ||
463 | 30 | anchors.fill: parent | ||
464 | 31 | transformOrigin: Item.Center | ||
465 | 32 | color: "transparent"; | ||
466 | 33 | |||
467 | 34 | Rectangle { | ||
468 | 35 | id: analogClockHand | ||
469 | 36 | |||
470 | 37 | x: (parent.width / 2) - (width / 2); y: (parent.height / 2) - height; z: 2; | ||
471 | 38 | width: units.gu(1); height: units.gu(14); | ||
472 | 39 | radius: units.gu(1) | ||
473 | 40 | color: Theme.palette.normal.baseText | ||
474 | 41 | antialiasing: true | ||
475 | 42 | } | ||
476 | 43 | |||
477 | 44 | Behavior on rotation { | ||
478 | 45 | id: analogClockHandRotation | ||
479 | 46 | enabled: true; | ||
480 | 47 | RotationAnimation { direction: RotationAnimation.Shortest } | ||
481 | 48 | } | ||
482 | 49 | } | ||
483 | 50 | |||
484 | 51 | 0 | ||
485 | === removed file 'common/AnalogFaceBase.qml' | |||
486 | --- common/AnalogFaceBase.qml 2013-10-26 13:20:54 +0000 | |||
487 | +++ common/AnalogFaceBase.qml 1970-01-01 00:00:00 +0000 | |||
488 | @@ -1,149 +0,0 @@ | |||
489 | 1 | /* | ||
490 | 2 | * Copyright (C) 2013 Canonical Ltd | ||
491 | 3 | * | ||
492 | 4 | * This program is free software: you can redistribute it and/or modify | ||
493 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
494 | 6 | * published by the Free Software Foundation. | ||
495 | 7 | * | ||
496 | 8 | * This program is distributed in the hope that it will be useful, | ||
497 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
498 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
499 | 11 | * GNU General Public License for more details. | ||
500 | 12 | * | ||
501 | 13 | * You should have received a copy of the GNU General Public License | ||
502 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
503 | 15 | * | ||
504 | 16 | * Authored by: Juha Ristolainen <juha.ristolainen@codemancers.fi> | ||
505 | 17 | * Nick LeppΓ€nen Larsson <frals@frals.se> | ||
506 | 18 | */ | ||
507 | 19 | |||
508 | 20 | import QtQuick 2.0 | ||
509 | 21 | import Ubuntu.Components 0.1 | ||
510 | 22 | import QtGraphicalEffects 1.0 | ||
511 | 23 | |||
512 | 24 | // FIXME: Replace Rectangle with UbuntuShape when the new widget lands in the Ubuntu SDK. | ||
513 | 25 | Rectangle { | ||
514 | 26 | id: clockRoot | ||
515 | 27 | |||
516 | 28 | property alias innerCircle: innerCircle | ||
517 | 29 | property alias innerLabel: currentTimeLabel | ||
518 | 30 | property real offset : units.gu(0.2) | ||
519 | 31 | |||
520 | 32 | width: units.gu(32); height: units.gu(32) | ||
521 | 33 | radius: width / 2 | ||
522 | 34 | antialiasing: true | ||
523 | 35 | |||
524 | 36 | // Current time label | ||
525 | 37 | Label { | ||
526 | 38 | id: currentTimeLabel | ||
527 | 39 | |||
528 | 40 | z: innerCircle.z + 1 | ||
529 | 41 | width: innerCircle.width; height: width; | ||
530 | 42 | anchors.centerIn: parent | ||
531 | 43 | horizontalAlignment: Text.AlignHCenter | ||
532 | 44 | verticalAlignment: Text.AlignVCenter | ||
533 | 45 | color: Theme.palette.normal.baseText | ||
534 | 46 | font.pixelSize: units.dp(41) | ||
535 | 47 | } | ||
536 | 48 | |||
537 | 49 | gradient: Gradient { | ||
538 | 50 | GradientStop { position: 0.0; color: "#512F48" } | ||
539 | 51 | GradientStop { position: 0.25; color: "#583048" } | ||
540 | 52 | GradientStop { position: 0.5; color: "#653449" } | ||
541 | 53 | GradientStop { position: 0.75; color: "#6D384A" } | ||
542 | 54 | GradientStop { position: 1.0; color: "#753B4A" } | ||
543 | 55 | } | ||
544 | 56 | |||
545 | 57 | // Draws the outter shadow/highlight | ||
546 | 58 | Rectangle { | ||
547 | 59 | id: sourceOutter | ||
548 | 60 | anchors { fill: parent; margins: -offset } | ||
549 | 61 | radius: (width / 2) | ||
550 | 62 | antialiasing: true | ||
551 | 63 | gradient: Gradient { | ||
552 | 64 | GradientStop { position: 0.0; color: "black" } | ||
553 | 65 | GradientStop { position: 0.5; color: "transparent" } | ||
554 | 66 | GradientStop { position: 1.0; color: "white" } | ||
555 | 67 | } | ||
556 | 68 | } | ||
557 | 69 | |||
558 | 70 | // Mask for outer 3D effect | ||
559 | 71 | Rectangle { | ||
560 | 72 | id: maskOutter | ||
561 | 73 | anchors.fill: sourceOutter | ||
562 | 74 | color: "transparent" | ||
563 | 75 | radius: (width / 2) | ||
564 | 76 | antialiasing: true | ||
565 | 77 | border { width: offset; color: "black" } | ||
566 | 78 | } | ||
567 | 79 | |||
568 | 80 | // Outter effect | ||
569 | 81 | OpacityMask { | ||
570 | 82 | anchors.fill: sourceOutter | ||
571 | 83 | opacity: 0.65 | ||
572 | 84 | source: ShaderEffectSource { | ||
573 | 85 | sourceItem: sourceOutter | ||
574 | 86 | hideSource: true | ||
575 | 87 | } | ||
576 | 88 | maskSource: ShaderEffectSource { | ||
577 | 89 | sourceItem: maskOutter | ||
578 | 90 | hideSource: true | ||
579 | 91 | } | ||
580 | 92 | } | ||
581 | 93 | |||
582 | 94 | // FIXME: Replace this with UbuntuShape when the widget has landed in the SDK. | ||
583 | 95 | Rectangle { | ||
584 | 96 | id: innerCircle | ||
585 | 97 | |||
586 | 98 | z: parent.z + 2 | ||
587 | 99 | height: units.gu(19); width: units.gu(19) | ||
588 | 100 | radius: width / 2 | ||
589 | 101 | anchors.centerIn: parent | ||
590 | 102 | antialiasing: true | ||
591 | 103 | |||
592 | 104 | gradient: Gradient { | ||
593 | 105 | GradientStop { position: 0.0; color: "#7A4C68" } | ||
594 | 106 | GradientStop { position: 0.25; color: "#804563" } | ||
595 | 107 | GradientStop { position: 0.5; color: "#864660" } | ||
596 | 108 | GradientStop { position: 0.75; color: "#86465E" } | ||
597 | 109 | GradientStop { position: 1.0; color: "#964E66" } | ||
598 | 110 | } | ||
599 | 111 | |||
600 | 112 | // Draws the inner highlight / shadow | ||
601 | 113 | Rectangle { | ||
602 | 114 | id: sourceInner; | ||
603 | 115 | anchors { fill: parent; margins: -offset } | ||
604 | 116 | radius: (width / 2) | ||
605 | 117 | antialiasing: true | ||
606 | 118 | gradient: Gradient { | ||
607 | 119 | GradientStop { position: 0.0; color: "white" } | ||
608 | 120 | GradientStop { position: 0.5; color: "transparent" } | ||
609 | 121 | GradientStop { position: 1.0; color: "black" } | ||
610 | 122 | } | ||
611 | 123 | } | ||
612 | 124 | |||
613 | 125 | // Mask for inner 3D effect | ||
614 | 126 | Rectangle { | ||
615 | 127 | id: maskInner | ||
616 | 128 | color: "transparent" | ||
617 | 129 | anchors.fill: sourceInner | ||
618 | 130 | radius: (width / 2) | ||
619 | 131 | antialiasing: true | ||
620 | 132 | border { width: offset; color: "black" } | ||
621 | 133 | } | ||
622 | 134 | |||
623 | 135 | // Inner effect | ||
624 | 136 | OpacityMask { | ||
625 | 137 | opacity: 0.65 | ||
626 | 138 | anchors.fill: sourceInner | ||
627 | 139 | source: ShaderEffectSource { | ||
628 | 140 | sourceItem: sourceInner | ||
629 | 141 | hideSource: true | ||
630 | 142 | } | ||
631 | 143 | maskSource: ShaderEffectSource { | ||
632 | 144 | sourceItem: maskInner | ||
633 | 145 | hideSource: true | ||
634 | 146 | } | ||
635 | 147 | } | ||
636 | 148 | } | ||
637 | 149 | } | ||
638 | 150 | 0 | ||
639 | === modified file 'common/AnalogGlowEffect.qml' | |||
640 | --- common/AnalogGlowEffect.qml 2013-08-09 22:11:05 +0000 | |||
641 | +++ common/AnalogGlowEffect.qml 2014-01-10 14:02:26 +0000 | |||
642 | @@ -29,6 +29,6 @@ | |||
643 | 29 | glowRadius: 10 | 29 | glowRadius: 10 |
644 | 30 | spread: 0.8 | 30 | spread: 0.8 |
645 | 31 | color: "orange" | 31 | color: "orange" |
647 | 32 | cornerRadius: fillRectangle.radius | 32 | cornerRadius: fillRectangle.size |
648 | 33 | z: fillRectangle - 1 | 33 | z: fillRectangle - 1 |
649 | 34 | } | 34 | } |
650 | 35 | 35 | ||
651 | === removed file 'common/AnalogTouchHand.qml' | |||
652 | --- common/AnalogTouchHand.qml 2013-09-04 10:35:41 +0000 | |||
653 | +++ common/AnalogTouchHand.qml 1970-01-01 00:00:00 +0000 | |||
654 | @@ -1,108 +0,0 @@ | |||
655 | 1 | /* | ||
656 | 2 | * Copyright (C) 2013 Canonical Ltd | ||
657 | 3 | * | ||
658 | 4 | * This program is free software: you can redistribute it and/or modify | ||
659 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
660 | 6 | * published by the Free Software Foundation. | ||
661 | 7 | * | ||
662 | 8 | * This program is distributed in the hope that it will be useful, | ||
663 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
664 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
665 | 11 | * GNU General Public License for more details. | ||
666 | 12 | * | ||
667 | 13 | * You should have received a copy of the GNU General Public License | ||
668 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
669 | 15 | * | ||
670 | 16 | * Authored by: Nekhelesh Ramananthan <krnekhelesh@gmail.com> | ||
671 | 17 | */ | ||
672 | 18 | |||
673 | 19 | import QtQuick 2.0 | ||
674 | 20 | import Ubuntu.Components 0.1 | ||
675 | 21 | import "../common" | ||
676 | 22 | |||
677 | 23 | // Qml item to enable touch input to the AnalogClockHand component | ||
678 | 24 | Item { | ||
679 | 25 | id: touchHand; | ||
680 | 26 | |||
681 | 27 | z: parent.z; | ||
682 | 28 | width: parent.width; height: width; | ||
683 | 29 | anchors.centerIn: parent; | ||
684 | 30 | |||
685 | 31 | property int totalValue: 60; | ||
686 | 32 | property int perAngle: 6; | ||
687 | 33 | |||
688 | 34 | /*! | ||
689 | 35 | Enable/Disable rotation animation. Disable it while dragging the clock hand to avoid | ||
690 | 36 | receiving inaccurate input values. | ||
691 | 37 | */ | ||
692 | 38 | property alias animateFlag: hand.handRotationAnimation | ||
693 | 39 | |||
694 | 40 | /*! | ||
695 | 41 | Set if the dial should be rotated by the seconds, minutes or hours. This generally needs to be | ||
696 | 42 | multiplied by 6 to convert it into degrees per second/hour/minute. | ||
697 | 43 | */ | ||
698 | 44 | property alias rotationValue: hand.rotation; | ||
699 | 45 | |||
700 | 46 | // Set the touch/mouse grab area height and top margin | ||
701 | 47 | property alias grabHeight: grabArea.height; | ||
702 | 48 | property int grabMargin: units.gu(0); | ||
703 | 49 | |||
704 | 50 | // Height and width of the clock hand | ||
705 | 51 | property alias handHeight: hand.handHeight; | ||
706 | 52 | property alias handWidth: hand.handWidth; | ||
707 | 53 | |||
708 | 54 | // internal properties required for the functioning of the AnalogTouchHand | ||
709 | 55 | property int timerValue: 0 | ||
710 | 56 | property real centerX : width / 2 | ||
711 | 57 | property real centerY : height / 2 | ||
712 | 58 | |||
713 | 59 | // Clock hand which lies above the rotating dial. This is stationary w.r.t to the rotating dial. | ||
714 | 60 | AnalogClockHand { | ||
715 | 61 | id: hand | ||
716 | 62 | |||
717 | 63 | handHeight: units.gu(0); handWidth: units.gu(0); | ||
718 | 64 | |||
719 | 65 | /*! | ||
720 | 66 | Element to define the grab area of the clock hand. This allows us to define small clock hand | ||
721 | 67 | which are still easier to grab. | ||
722 | 68 | */ | ||
723 | 69 | Rectangle { | ||
724 | 70 | id: grabArea | ||
725 | 71 | color: "transparent" | ||
726 | 72 | width: units.gu(5); height: width; | ||
727 | 73 | anchors { top: hand.top; topMargin: touchHand.grabMargin; horizontalCenter: hand.horizontalCenter } | ||
728 | 74 | } | ||
729 | 75 | |||
730 | 76 | MouseArea{ | ||
731 | 77 | anchors.fill: grabArea; | ||
732 | 78 | preventStealing: true; | ||
733 | 79 | enabled: true; | ||
734 | 80 | onPositionChanged: { | ||
735 | 81 | var point = mapToItem (touchHand, mouse.x, mouse.y); | ||
736 | 82 | var diffX = (point.x - touchHand.centerX); | ||
737 | 83 | var diffY = -1 * (point.y - touchHand.centerY); | ||
738 | 84 | var rad = Math.atan (diffY / diffX); | ||
739 | 85 | var deg = (rad * 180 / Math.PI); | ||
740 | 86 | |||
741 | 87 | if (diffX > 0 && diffY > 0) { | ||
742 | 88 | hand.rotation = 90 - Math.abs (deg); | ||
743 | 89 | } | ||
744 | 90 | else if (diffX > 0 && diffY < 0) { | ||
745 | 91 | hand.rotation = 90 + Math.abs (deg); | ||
746 | 92 | } | ||
747 | 93 | else if (diffX < 0 && diffY > 0) { | ||
748 | 94 | hand.rotation = 270 + Math.abs (deg); | ||
749 | 95 | } | ||
750 | 96 | else if (diffX < 0 && diffY < 0) { | ||
751 | 97 | hand.rotation = 270 - Math.abs (deg); | ||
752 | 98 | } | ||
753 | 99 | |||
754 | 100 | if (Math.round(hand.rotation/perAngle) === totalValue) { | ||
755 | 101 | touchHand.timerValue = 0 | ||
756 | 102 | } else { | ||
757 | 103 | touchHand.timerValue = Math.round(hand.rotation/perAngle); | ||
758 | 104 | } | ||
759 | 105 | } | ||
760 | 106 | } | ||
761 | 107 | } | ||
762 | 108 | } | ||
763 | 109 | 0 | ||
764 | === added file 'common/ClockBase.qml' | |||
765 | --- common/ClockBase.qml 1970-01-01 00:00:00 +0000 | |||
766 | +++ common/ClockBase.qml 2014-01-10 14:02:26 +0000 | |||
767 | @@ -0,0 +1,94 @@ | |||
768 | 1 | /* | ||
769 | 2 | * Copyright (C) 2013 Canonical Ltd | ||
770 | 3 | * | ||
771 | 4 | * This program is free software: you can redistribute it and/or modify | ||
772 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
773 | 6 | * published by the Free Software Foundation. | ||
774 | 7 | * | ||
775 | 8 | * This program is distributed in the hope that it will be useful, | ||
776 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
777 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
778 | 11 | * GNU General Public License for more details. | ||
779 | 12 | * | ||
780 | 13 | * You should have received a copy of the GNU General Public License | ||
781 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
782 | 15 | * | ||
783 | 16 | * Authored by: Nekhelesh Ramananthan <krnekhelesh@gmail.com> | ||
784 | 17 | */ | ||
785 | 18 | |||
786 | 19 | import QtQuick 2.0 | ||
787 | 20 | import Ubuntu.Components 0.1 | ||
788 | 21 | import Ubuntu.Components.Pickers 0.1 | ||
789 | 22 | |||
790 | 23 | /* | ||
791 | 24 | Basic component to draw the analogue clock with hour, minute and second hands. | ||
792 | 25 | */ | ||
793 | 26 | Dialer { | ||
794 | 27 | id: clockRoot | ||
795 | 28 | |||
796 | 29 | // Properties to set the clock hands position | ||
797 | 30 | property alias hours: _hourHand.value | ||
798 | 31 | property alias minutes: _minuteHand.value | ||
799 | 32 | property alias seconds: _secondHand.value | ||
800 | 33 | |||
801 | 34 | // Property to set the label shown in the inner circle | ||
802 | 35 | property alias innerLabel: _currentTimeLabel | ||
803 | 36 | |||
804 | 37 | // Property to individually hide the hour and minute hand in timer and alarm | ||
805 | 38 | property bool showHourHand: true | ||
806 | 39 | property bool showSecondHand: true | ||
807 | 40 | |||
808 | 41 | // Property to enable/disable the mouse area of the inner circle. | ||
809 | 42 | property bool enableMouseArea: true | ||
810 | 43 | |||
811 | 44 | // Property to set if the clock hands are adjustable by the user | ||
812 | 45 | property bool draggable: false | ||
813 | 46 | |||
814 | 47 | signal clicked(var mouse) | ||
815 | 48 | signal pressAndHold(var mouse) | ||
816 | 49 | |||
817 | 50 | minimumValue: 0 | ||
818 | 51 | maximumValue: 60 | ||
819 | 52 | size: units.gu(32) | ||
820 | 53 | |||
821 | 54 | DialerHand { | ||
822 | 55 | id: _hourHand | ||
823 | 56 | objectName: "hourHand" | ||
824 | 57 | hand.draggable: draggable | ||
825 | 58 | hand.visible: showHourHand | ||
826 | 59 | } | ||
827 | 60 | |||
828 | 61 | DialerHand { | ||
829 | 62 | id: _minuteHand | ||
830 | 63 | objectName: "minuteHand" | ||
831 | 64 | hand.draggable: draggable | ||
832 | 65 | } | ||
833 | 66 | |||
834 | 67 | DialerHand { | ||
835 | 68 | id: _secondHand | ||
836 | 69 | objectName: "secondHand" | ||
837 | 70 | hand.draggable: draggable | ||
838 | 71 | hand.visible: showSecondHand | ||
839 | 72 | } | ||
840 | 73 | |||
841 | 74 | centerContent: [ | ||
842 | 75 | Label { | ||
843 | 76 | id: _currentTimeLabel | ||
844 | 77 | objectName: "label" | ||
845 | 78 | anchors.centerIn: parent | ||
846 | 79 | horizontalAlignment: Text.AlignHCenter | ||
847 | 80 | verticalAlignment: Text.AlignVCenter | ||
848 | 81 | font.pixelSize: units.dp(41) | ||
849 | 82 | } | ||
850 | 83 | ] | ||
851 | 84 | |||
852 | 85 | // Mouse area to reveal the clock sunrise/sunset on clicking the clock face | ||
853 | 86 | MouseArea { | ||
854 | 87 | parent: clockRoot.centerItem | ||
855 | 88 | anchors.fill: parent | ||
856 | 89 | enabled: enableMouseArea | ||
857 | 90 | z: parent.z + 1; | ||
858 | 91 | onClicked: clockRoot.clicked(mouse); | ||
859 | 92 | onPressAndHold: clockRoot.pressAndHold(mouse); | ||
860 | 93 | } | ||
861 | 94 | } | ||
862 | 0 | 95 | ||
863 | === modified file 'common/ClockUtils.js' | |||
864 | --- common/ClockUtils.js 2013-09-12 17:22:30 +0000 | |||
865 | +++ common/ClockUtils.js 2014-01-10 14:02:26 +0000 | |||
866 | @@ -43,3 +43,14 @@ | |||
867 | 43 | function numberToLocaleString( num ) { | 43 | function numberToLocaleString( num ) { |
868 | 44 | return Number(num).toLocaleString(Qt.locale(), "f", 0) | 44 | return Number(num).toLocaleString(Qt.locale(), "f", 0) |
869 | 45 | } | 45 | } |
870 | 46 | |||
871 | 47 | // Function to convert hours to clock hand positions. | ||
872 | 48 | // The range of the analogue clock is 0-60 while the hours should be between 00-23. Hence the factor 23/60 | ||
873 | 49 | function hourstoCirclePosition(hours) { | ||
874 | 50 | return Math.round(hours * 23/60) | ||
875 | 51 | } | ||
876 | 52 | |||
877 | 53 | // Function to convert clock hand positions to hours (24-hours) | ||
878 | 54 | function circlePositiontoHours(position) { | ||
879 | 55 | return Math.round(position * 60/23) | ||
880 | 56 | } | ||
881 | 46 | 57 | ||
882 | === removed file 'stopwatch/AnalogStopwatch.qml' | |||
883 | --- stopwatch/AnalogStopwatch.qml 2013-09-14 06:20:48 +0000 | |||
884 | +++ stopwatch/AnalogStopwatch.qml 1970-01-01 00:00:00 +0000 | |||
885 | @@ -1,128 +0,0 @@ | |||
886 | 1 | /* | ||
887 | 2 | * Copyright (C) 2013 Canonical Ltd | ||
888 | 3 | * | ||
889 | 4 | * This program is free software: you can redistribute it and/or modify | ||
890 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
891 | 6 | * published by the Free Software Foundation. | ||
892 | 7 | * | ||
893 | 8 | * This program is distributed in the hope that it will be useful, | ||
894 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
895 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
896 | 11 | * GNU General Public License for more details. | ||
897 | 12 | * | ||
898 | 13 | * You should have received a copy of the GNU General Public License | ||
899 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
900 | 15 | * | ||
901 | 16 | * Authored by: Alessandro Pozzi <signor.hyde@gmail.com> | ||
902 | 17 | * Nekhelesh Ramananthan <krnekhelesh@gmail.com> | ||
903 | 18 | */ | ||
904 | 19 | |||
905 | 20 | import QtQuick 2.0 | ||
906 | 21 | import Ubuntu.Components 0.1 | ||
907 | 22 | import "StopwatchSupport.js" as SScript | ||
908 | 23 | import "../common" | ||
909 | 24 | |||
910 | 25 | // This component draws the stopwatch analog UI and defines different UI modes like normal and easteregg. | ||
911 | 26 | AnalogFaceBase { | ||
912 | 27 | id: analogStopwatch | ||
913 | 28 | |||
914 | 29 | property var startTime: 0; | ||
915 | 30 | property var stopTime: 0; | ||
916 | 31 | property int delay : 0; | ||
917 | 32 | property bool flag: true; | ||
918 | 33 | property int totalTime: 0; | ||
919 | 34 | |||
920 | 35 | property int hours: 0; | ||
921 | 36 | property int minutes: 0; | ||
922 | 37 | property int seconds: 0; | ||
923 | 38 | property int milliseconds: 0; | ||
924 | 39 | property int decimalgradient: 0; | ||
925 | 40 | |||
926 | 41 | // Sets the location and visible (bool) values of the blip (small circle visible when the lap button is pressed) | ||
927 | 42 | property alias blipLocation: blipFist.location; | ||
928 | 43 | property alias blipVisible: blipFist.visible; | ||
929 | 44 | |||
930 | 45 | // Retrieves the status of the stopwatch timer | ||
931 | 46 | property bool timerStatus: stopwatchUIUpdate.running | ||
932 | 47 | |||
933 | 48 | function reset() { | ||
934 | 49 | decimalgradient = totalTime = milliseconds = seconds = minutes = hours = 0 | ||
935 | 50 | SScript.deltaTime[0] = SScript.deltaTime[1] = SScript.deltaTime[2] = SScript.deltaTime[3] = 0 | ||
936 | 51 | startTime = stopTime = delay = 0; | ||
937 | 52 | flag = true; | ||
938 | 53 | } | ||
939 | 54 | |||
940 | 55 | function start() { | ||
941 | 56 | stopwatchUIUpdate.start() | ||
942 | 57 | } | ||
943 | 58 | |||
944 | 59 | function stop() { | ||
945 | 60 | stopwatchUIUpdate.stop() | ||
946 | 61 | } | ||
947 | 62 | |||
948 | 63 | // Timer which runs every 100 microseconds to update the time and also the trailing hand gradient. | ||
949 | 64 | Timer { | ||
950 | 65 | id: stopwatchUIUpdate | ||
951 | 66 | |||
952 | 67 | interval: 100 | ||
953 | 68 | repeat: true | ||
954 | 69 | onTriggered: { | ||
955 | 70 | totalTime = SScript.delta(); | ||
956 | 71 | SScript.deltaTime = SScript.msToTime(totalTime) | ||
957 | 72 | hours = SScript.deltaTime[0]; | ||
958 | 73 | minutes = SScript.deltaTime[1]; | ||
959 | 74 | seconds = SScript.deltaTime[2]; | ||
960 | 75 | milliseconds = SScript.deltaTime[3]; | ||
961 | 76 | decimalgradient = minutes * 10; | ||
962 | 77 | } | ||
963 | 78 | } | ||
964 | 79 | |||
965 | 80 | // This component draws the small orange circle that is visible everytime the lap button is pressed. | ||
966 | 81 | Blip { | ||
967 | 82 | id: blipFist | ||
968 | 83 | } | ||
969 | 84 | |||
970 | 85 | // This component draws the trailing shadow of the second hand. | ||
971 | 86 | HandGradient { | ||
972 | 87 | id: gradientSecond | ||
973 | 88 | rotationAngle: minutes * 6 | ||
974 | 89 | decimalGradient: decimalgradient | ||
975 | 90 | } | ||
976 | 91 | |||
977 | 92 | Repeater { | ||
978 | 93 | id:stopwatchMarkers | ||
979 | 94 | |||
980 | 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"] | ||
981 | 96 | |||
982 | 97 | delegate: AnalogClockMarker { | ||
983 | 98 | number: modelData | ||
984 | 99 | total: 24; | ||
985 | 100 | size: 0.2 | ||
986 | 101 | distance: 0.32 | ||
987 | 102 | } | ||
988 | 103 | } | ||
989 | 104 | |||
990 | 105 | AnalogClockHand { | ||
991 | 106 | id: hourHand | ||
992 | 107 | |||
993 | 108 | z: parent.z | ||
994 | 109 | handHeight: units.gu(12.5); handWidth: units.gu(1); | ||
995 | 110 | rotation: hours * 15; | ||
996 | 111 | } | ||
997 | 112 | |||
998 | 113 | AnalogClockHand { | ||
999 | 114 | id: minuteHand | ||
1000 | 115 | |||
1001 | 116 | z: parent.z | ||
1002 | 117 | handHeight: units.gu(14.5); handWidth: units.gu(0.5); | ||
1003 | 118 | rotation: minutes * 6; | ||
1004 | 119 | } | ||
1005 | 120 | |||
1006 | 121 | AnalogClockHand { | ||
1007 | 122 | id: secondHand | ||
1008 | 123 | |||
1009 | 124 | z: parent.z - 1; | ||
1010 | 125 | handHeight: units.gu(17); handWidth: units.gu(0.5) | ||
1011 | 126 | rotation: seconds * 6; | ||
1012 | 127 | } | ||
1013 | 128 | } | ||
1014 | 129 | 0 | ||
1015 | === added file 'stopwatch/StopwatchFace.qml' | |||
1016 | --- stopwatch/StopwatchFace.qml 1970-01-01 00:00:00 +0000 | |||
1017 | +++ stopwatch/StopwatchFace.qml 2014-01-10 14:02:26 +0000 | |||
1018 | @@ -0,0 +1,91 @@ | |||
1019 | 1 | /* | ||
1020 | 2 | * Copyright (C) 2013 Canonical Ltd | ||
1021 | 3 | * | ||
1022 | 4 | * This program is free software: you can redistribute it and/or modify | ||
1023 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
1024 | 6 | * published by the Free Software Foundation. | ||
1025 | 7 | * | ||
1026 | 8 | * This program is distributed in the hope that it will be useful, | ||
1027 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1028 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1029 | 11 | * GNU General Public License for more details. | ||
1030 | 12 | * | ||
1031 | 13 | * You should have received a copy of the GNU General Public License | ||
1032 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1033 | 15 | * | ||
1034 | 16 | * Authored by: Alessandro Pozzi <signor.hyde@gmail.com> | ||
1035 | 17 | * Nekhelesh Ramananthan <krnekhelesh@gmail.com> | ||
1036 | 18 | */ | ||
1037 | 19 | |||
1038 | 20 | import QtQuick 2.0 | ||
1039 | 21 | import Ubuntu.Components 0.1 | ||
1040 | 22 | import "StopwatchSupport.js" as SScript | ||
1041 | 23 | import "../common" | ||
1042 | 24 | |||
1043 | 25 | ClockBase { | ||
1044 | 26 | id: stopwatchFace | ||
1045 | 27 | |||
1046 | 28 | // Properties to store/set the time variables | ||
1047 | 29 | property var startTime: 0 | ||
1048 | 30 | property var stopTime: 0 | ||
1049 | 31 | property int delay : 0 | ||
1050 | 32 | property bool flag: true | ||
1051 | 33 | property int totalTime: 0 | ||
1052 | 34 | property int milliseconds: 0 | ||
1053 | 35 | |||
1054 | 36 | // Sets the location and visible (bool) values of the blip (small circle visible when the lap button is pressed) | ||
1055 | 37 | property alias blipLocation: blipFist.location | ||
1056 | 38 | property alias blipVisible: blipFist.visible | ||
1057 | 39 | |||
1058 | 40 | // Retrieves the status of the stopwatch timer | ||
1059 | 41 | property bool timerStatus: stopwatchUIUpdate.running | ||
1060 | 42 | |||
1061 | 43 | function reset() { | ||
1062 | 44 | totalTime = milliseconds = seconds = minutes = hours = 0 | ||
1063 | 45 | SScript.deltaTime[0] = SScript.deltaTime[1] = SScript.deltaTime[2] = SScript.deltaTime[3] = 0 | ||
1064 | 46 | startTime = stopTime = delay = 0; | ||
1065 | 47 | flag = true; | ||
1066 | 48 | } | ||
1067 | 49 | |||
1068 | 50 | function start() { | ||
1069 | 51 | stopwatchUIUpdate.start() | ||
1070 | 52 | } | ||
1071 | 53 | |||
1072 | 54 | function stop() { | ||
1073 | 55 | stopwatchUIUpdate.stop() | ||
1074 | 56 | } | ||
1075 | 57 | |||
1076 | 58 | // Timer which runs every 100 microseconds to update the time and also the trailing hand gradient. | ||
1077 | 59 | Timer { | ||
1078 | 60 | id: stopwatchUIUpdate | ||
1079 | 61 | |||
1080 | 62 | interval: 100 | ||
1081 | 63 | repeat: true | ||
1082 | 64 | onTriggered: { | ||
1083 | 65 | totalTime = SScript.delta(); | ||
1084 | 66 | SScript.deltaTime = SScript.msToTime(totalTime) | ||
1085 | 67 | hours = SScript.deltaTime[0]; | ||
1086 | 68 | minutes = SScript.deltaTime[1]; | ||
1087 | 69 | seconds = SScript.deltaTime[2]; | ||
1088 | 70 | milliseconds = SScript.deltaTime[3]; | ||
1089 | 71 | } | ||
1090 | 72 | } | ||
1091 | 73 | |||
1092 | 74 | // This component draws the small white circle that is visible everytime the lap button is pressed. | ||
1093 | 75 | Blip { | ||
1094 | 76 | id: blipFist | ||
1095 | 77 | } | ||
1096 | 78 | |||
1097 | 79 | Repeater { | ||
1098 | 80 | id:stopwatchMarkers | ||
1099 | 81 | |||
1100 | 82 | model: 24 | ||
1101 | 83 | |||
1102 | 84 | delegate: AnalogClockMarker { | ||
1103 | 85 | number: modelData | ||
1104 | 86 | total: 24; | ||
1105 | 87 | size: 0.2 | ||
1106 | 88 | distance: 0.32 | ||
1107 | 89 | } | ||
1108 | 90 | } | ||
1109 | 91 | } | ||
1110 | 0 | 92 | ||
1111 | === modified file 'stopwatch/StopwatchPage.qml' | |||
1112 | --- stopwatch/StopwatchPage.qml 2013-11-05 13:12:48 +0000 | |||
1113 | +++ stopwatch/StopwatchPage.qml 2014-01-10 14:02:26 +0000 | |||
1114 | @@ -63,34 +63,34 @@ | |||
1115 | 63 | contentHeight: analogStopwatch.height + analogStopwatch.anchors.topMargin + listLap.height + listLap.anchors.topMargin + units.gu(3) | 63 | contentHeight: analogStopwatch.height + analogStopwatch.anchors.topMargin + listLap.height + listLap.anchors.topMargin + units.gu(3) |
1116 | 64 | 64 | ||
1117 | 65 | // Component which draws the analog stopwatch face, controls the timer and calculates the time. | 65 | // Component which draws the analog stopwatch face, controls the timer and calculates the time. |
1119 | 66 | AnalogStopwatch { | 66 | StopwatchFace { |
1120 | 67 | id: analogStopwatch | 67 | id: analogStopwatch |
1126 | 68 | objectName: "buttonStopwatch" | 68 | objectName: "stopwatchFace" |
1127 | 69 | 69 | ||
1128 | 70 | anchors { top: parent.top; topMargin: units.gu(10); horizontalCenter: parent.horizontalCenter } | 70 | anchors { |
1129 | 71 | 71 | top: parent.top | |
1130 | 72 | innerLabel.objectName: "labelStopwatch" | 72 | topMargin: units.gu(10) |
1131 | 73 | horizontalCenter: parent.horizontalCenter | ||
1132 | 74 | } | ||
1133 | 75 | |||
1134 | 73 | innerLabel.text: SScript.timeToString(analogStopwatch.hours, analogStopwatch.minutes, analogStopwatch.seconds, analogStopwatch.milliseconds) | 76 | innerLabel.text: SScript.timeToString(analogStopwatch.hours, analogStopwatch.minutes, analogStopwatch.seconds, analogStopwatch.milliseconds) |
1135 | 74 | 77 | ||
1155 | 75 | MouseArea { | 78 | onClicked: { |
1156 | 76 | anchors.fill: analogStopwatch.innerCircle; | 79 | if(analogStopwatch.timerStatus == false) { |
1157 | 77 | onClicked: { | 80 | analogStopwatch.start() |
1158 | 78 | if(analogStopwatch.timerStatus == false) { | 81 | stopWatchLabelUpdate.start() |
1159 | 79 | analogStopwatch.start() | 82 | if (analogStopwatch.flag) { |
1160 | 80 | stopWatchLabelUpdate.start() | 83 | analogStopwatch.startTime = new Date().getTime(); |
1161 | 81 | if (analogStopwatch.flag) { | 84 | analogStopwatch.flag = false; |
1162 | 82 | analogStopwatch.startTime = new Date().getTime(); | 85 | } |
1163 | 83 | analogStopwatch.flag = false; | 86 | else { |
1164 | 84 | } | 87 | analogStopwatch.delay = Math.abs(new Date().getTime() - analogStopwatch.stopTime); |
1165 | 85 | else { | 88 | analogStopwatch.startTime = analogStopwatch.startTime + analogStopwatch.delay; |
1166 | 86 | analogStopwatch.delay = Math.abs(new Date().getTime() - analogStopwatch.stopTime); | 89 | } |
1167 | 87 | analogStopwatch.startTime = analogStopwatch.startTime + analogStopwatch.delay; | 90 | } else { |
1168 | 88 | } | 91 | analogStopwatch.stop() |
1169 | 89 | } else { | 92 | stopWatchLabelUpdate.stop() |
1170 | 90 | analogStopwatch.stop() | 93 | analogStopwatch.stopTime = new Date().getTime(); |
1152 | 91 | stopWatchLabelUpdate.stop() | ||
1153 | 92 | analogStopwatch.stopTime = new Date().getTime(); | ||
1154 | 93 | } | ||
1171 | 94 | } | 94 | } |
1172 | 95 | } | 95 | } |
1173 | 96 | } | 96 | } |
1174 | 97 | 97 | ||
1175 | === modified file 'tests/autopilot/ubuntu_clock_app/emulators.py' | |||
1176 | --- tests/autopilot/ubuntu_clock_app/emulators.py 2013-11-07 16:35:51 +0000 | |||
1177 | +++ tests/autopilot/ubuntu_clock_app/emulators.py 2014-01-10 14:02:26 +0000 | |||
1178 | @@ -66,7 +66,7 @@ | |||
1179 | 66 | 66 | ||
1180 | 67 | def get_time_label(self): | 67 | def get_time_label(self): |
1181 | 68 | """Return the label with the timer countdown""" | 68 | """Return the label with the timer countdown""" |
1183 | 69 | return self.wait_select_single("Label", objectName="currentTimeLabel") | 69 | return self.select_single("ClockPage").wait_select_single("Label", objectName="label") |
1184 | 70 | 70 | ||
1185 | 71 | # WORLD CLOCK Page Emulator Functions | 71 | # WORLD CLOCK Page Emulator Functions |
1186 | 72 | def get_world_cities_page(self): | 72 | def get_world_cities_page(self): |
1187 | @@ -108,7 +108,7 @@ | |||
1188 | 108 | 108 | ||
1189 | 109 | def get_timer_minute_hand(self): | 109 | def get_timer_minute_hand(self): |
1190 | 110 | """Returns the hour hand of clock in timer tab""" | 110 | """Returns the hour hand of clock in timer tab""" |
1192 | 111 | return self.wait_select_single("AnalogTouchHand", objectName="minuteHand") | 111 | return self.select_single("TimerPage").wait_select_single("DialerHand", objectName="minuteHand") |
1193 | 112 | 112 | ||
1194 | 113 | def get_preset_label_text(self): | 113 | def get_preset_label_text(self): |
1195 | 114 | """Returns the label with the preset text""" | 114 | """Returns the label with the preset text""" |
1196 | @@ -122,7 +122,7 @@ | |||
1197 | 122 | 122 | ||
1198 | 123 | def get_label_timer(self): | 123 | def get_label_timer(self): |
1199 | 124 | """Return the label with the timer countdown""" | 124 | """Return the label with the timer countdown""" |
1201 | 125 | return self.wait_select_single("Label", objectName="labelTimer") | 125 | return self.select_single("TimerPage").wait_select_single("Label", objectName="label") |
1202 | 126 | 126 | ||
1203 | 127 | def get_first_preset_list_item(self): | 127 | def get_first_preset_list_item(self): |
1204 | 128 | """Returns the first preset list item in the timer page.""" | 128 | """Returns the first preset list item in the timer page.""" |
1205 | @@ -136,12 +136,12 @@ | |||
1206 | 136 | # STOPWATCH Page Emulator Functions | 136 | # STOPWATCH Page Emulator Functions |
1207 | 137 | def get_stopwatch_label(self): | 137 | def get_stopwatch_label(self): |
1208 | 138 | """Returns the select for the stopwatch label""" | 138 | """Returns the select for the stopwatch label""" |
1210 | 139 | return self.wait_select_single("Label", objectName="labelStopwatch") | 139 | return self.select_single("StopwatchPage").wait_select_single("Label", objectName="label") |
1211 | 140 | 140 | ||
1212 | 141 | def get_stopwatch_button(self): | 141 | def get_stopwatch_button(self): |
1213 | 142 | """Returns the select for the stopwatch button""" | 142 | """Returns the select for the stopwatch button""" |
1216 | 143 | return self.wait_select_single("AnalogStopwatch", | 143 | return self.wait_select_single("StopwatchFace", |
1217 | 144 | objectName="buttonStopwatch") | 144 | objectName="stopwatchFace") |
1218 | 145 | 145 | ||
1219 | 146 | def get_lap_button(self): | 146 | def get_lap_button(self): |
1220 | 147 | """Returns the select for the lap button""" | 147 | """Returns the select for the lap button""" |
1221 | @@ -233,13 +233,13 @@ | |||
1222 | 233 | 233 | ||
1223 | 234 | def get_alarm_minute_hand(self): | 234 | def get_alarm_minute_hand(self): |
1224 | 235 | """Returns the hour hand of clock in alarm tab""" | 235 | """Returns the hour hand of clock in alarm tab""" |
1227 | 236 | return self.select_single("AnalogClockHand", | 236 | return self.select_single("AlarmPage").select_single("DialerHand", |
1228 | 237 | objectName="alarmMinuteHand") | 237 | objectName="minuteHand") |
1229 | 238 | 238 | ||
1230 | 239 | def get_alarm_hour_hand(self): | 239 | def get_alarm_hour_hand(self): |
1231 | 240 | """Returns the hour hand of clock in alarm tab""" | 240 | """Returns the hour hand of clock in alarm tab""" |
1234 | 241 | return self.select_single("AnalogClockHand", | 241 | return self.select_single("AlarmPage").select_single("DialerHand", |
1235 | 242 | objectName="alarmHourHand") | 242 | objectName="hourHand") |
1236 | 243 | 243 | ||
1237 | 244 | def set_alarm_week(self, day, test_case): | 244 | def set_alarm_week(self, day, test_case): |
1238 | 245 | #TODO: add support for setting days of week | 245 | #TODO: add support for setting days of week |
1239 | 246 | 246 | ||
1240 | === removed file 'timer/AnalogTimer.qml' | |||
1241 | --- timer/AnalogTimer.qml 2013-10-26 12:20:55 +0000 | |||
1242 | +++ timer/AnalogTimer.qml 1970-01-01 00:00:00 +0000 | |||
1243 | @@ -1,121 +0,0 @@ | |||
1244 | 1 | /* | ||
1245 | 2 | * Copyright (C) 2013 Canonical Ltd | ||
1246 | 3 | * | ||
1247 | 4 | * This program is free software: you can redistribute it and/or modify | ||
1248 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
1249 | 6 | * published by the Free Software Foundation. | ||
1250 | 7 | * | ||
1251 | 8 | * This program is distributed in the hope that it will be useful, | ||
1252 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1253 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1254 | 11 | * GNU General Public License for more details. | ||
1255 | 12 | * | ||
1256 | 13 | * You should have received a copy of the GNU General Public License | ||
1257 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1258 | 15 | * | ||
1259 | 16 | * Authored by: Nekhelesh Ramananthan <krnekhelesh@gmail.com> | ||
1260 | 17 | */ | ||
1261 | 18 | |||
1262 | 19 | import QtQuick 2.0 | ||
1263 | 20 | import Ubuntu.Components 0.1 | ||
1264 | 21 | import "../common" | ||
1265 | 22 | |||
1266 | 23 | // Component which draws the analog timer face. | ||
1267 | 24 | AnalogFaceBase { | ||
1268 | 25 | id: clockOuterCircle | ||
1269 | 26 | |||
1270 | 27 | property var startTime: 0; | ||
1271 | 28 | property var remTime: 0; | ||
1272 | 29 | |||
1273 | 30 | // Properties to store/set the time variables | ||
1274 | 31 | property int seconds: 0; | ||
1275 | 32 | property int minutes: 0; | ||
1276 | 33 | property int totalTime: 0; | ||
1277 | 34 | property int pauseTime: 0; | ||
1278 | 35 | |||
1279 | 36 | // Property to activate/deactivate the timer | ||
1280 | 37 | property bool timerOn: false; | ||
1281 | 38 | property bool inProgressFlag | ||
1282 | 39 | |||
1283 | 40 | // Timer function called by the main clock loop | ||
1284 | 41 | function onTimerUpdate () { | ||
1285 | 42 | if( timerOn ) { | ||
1286 | 43 | inProgressFlag = true; | ||
1287 | 44 | remTime = totalTime - Math.floor((new Date() - startTime)/ 1000) - pauseTime; | ||
1288 | 45 | |||
1289 | 46 | if (remTime < 0) { | ||
1290 | 47 | timerOn = false | ||
1291 | 48 | totalTime = -1; | ||
1292 | 49 | } else { | ||
1293 | 50 | ssToTime(remTime); | ||
1294 | 51 | } | ||
1295 | 52 | } | ||
1296 | 53 | } | ||
1297 | 54 | |||
1298 | 55 | // Function to convert time (in seconds) to hh:mm:ss format | ||
1299 | 56 | function ssToTime(time) { | ||
1300 | 57 | seconds = time % 60 | ||
1301 | 58 | time = Math.floor(time / 60) | ||
1302 | 59 | minutes = time % 60 | ||
1303 | 60 | secondHand.rotationValue = seconds * 6; | ||
1304 | 61 | minuteHand.rotationValue = minutes * 6; | ||
1305 | 62 | } | ||
1306 | 63 | |||
1307 | 64 | // Function to disable timer and reset time | ||
1308 | 65 | Timer { | ||
1309 | 66 | id: reset_timer | ||
1310 | 67 | |||
1311 | 68 | interval: 200 | ||
1312 | 69 | repeat: false | ||
1313 | 70 | onTriggered: { | ||
1314 | 71 | inProgressFlag = true; | ||
1315 | 72 | minuteHand.rotationValue = secondHand.rotationValue = 0; | ||
1316 | 73 | inProgressFlag = false; | ||
1317 | 74 | } | ||
1318 | 75 | } | ||
1319 | 76 | |||
1320 | 77 | function reset() { | ||
1321 | 78 | reset_timer.start(); | ||
1322 | 79 | timerOn = false; | ||
1323 | 80 | state = ""; | ||
1324 | 81 | startTime = remTime = pauseTime = 0; | ||
1325 | 82 | minutes = seconds = totalTime = 0; | ||
1326 | 83 | minuteHand.timerValue = secondHand.timerValue = 0; | ||
1327 | 84 | } | ||
1328 | 85 | |||
1329 | 86 | Repeater { | ||
1330 | 87 | model: 12 | ||
1331 | 88 | delegate: AnalogClockMarker { | ||
1332 | 89 | number: index | ||
1333 | 90 | size: 0.5 | ||
1334 | 91 | distance: 0.48 | ||
1335 | 92 | } | ||
1336 | 93 | } | ||
1337 | 94 | |||
1338 | 95 | // Minute hand with touch/mouse drag support | ||
1339 | 96 | AnalogTouchHand { | ||
1340 | 97 | id: minuteHand | ||
1341 | 98 | objectName: "minuteHand" | ||
1342 | 99 | |||
1343 | 100 | onTimerValueChanged: minutes = timerValue; | ||
1344 | 101 | |||
1345 | 102 | handHeight: units.gu(14.5); handWidth: units.gu(0.5); | ||
1346 | 103 | animateFlag: inProgressFlag; | ||
1347 | 104 | enabled: !inProgressFlag; | ||
1348 | 105 | grabMargin: units.gu(0) | ||
1349 | 106 | grabHeight: units.gu(7) | ||
1350 | 107 | } | ||
1351 | 108 | |||
1352 | 109 | // Second hand with touch/mouse drag support | ||
1353 | 110 | AnalogTouchHand { | ||
1354 | 111 | id: secondHand | ||
1355 | 112 | |||
1356 | 113 | onTimerValueChanged: seconds = timerValue; | ||
1357 | 114 | |||
1358 | 115 | handHeight: units.gu(17); handWidth: units.gu(0.5); | ||
1359 | 116 | z: parent.z - 1; | ||
1360 | 117 | animateFlag: inProgressFlag; | ||
1361 | 118 | enabled: !inProgressFlag; | ||
1362 | 119 | grabMargin: -units.gu(2) | ||
1363 | 120 | } | ||
1364 | 121 | } | ||
1365 | 122 | 0 | ||
1366 | === added file 'timer/TimerFace.qml' | |||
1367 | --- timer/TimerFace.qml 1970-01-01 00:00:00 +0000 | |||
1368 | +++ timer/TimerFace.qml 2014-01-10 14:02:26 +0000 | |||
1369 | @@ -0,0 +1,99 @@ | |||
1370 | 1 | /* | ||
1371 | 2 | * Copyright (C) 2013 Canonical Ltd | ||
1372 | 3 | * | ||
1373 | 4 | * This program is free software: you can redistribute it and/or modify | ||
1374 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
1375 | 6 | * published by the Free Software Foundation. | ||
1376 | 7 | * | ||
1377 | 8 | * This program is distributed in the hope that it will be useful, | ||
1378 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1379 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1380 | 11 | * GNU General Public License for more details. | ||
1381 | 12 | * | ||
1382 | 13 | * You should have received a copy of the GNU General Public License | ||
1383 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1384 | 15 | * | ||
1385 | 16 | * Authored by: Nekhelesh Ramananthan <krnekhelesh@gmail.com> | ||
1386 | 17 | */ | ||
1387 | 18 | |||
1388 | 19 | import QtQuick 2.0 | ||
1389 | 20 | import Ubuntu.Components 0.1 | ||
1390 | 21 | import "../common" | ||
1391 | 22 | |||
1392 | 23 | ClockBase { | ||
1393 | 24 | id: timerFace | ||
1394 | 25 | |||
1395 | 26 | // Properties to store/set the time variables | ||
1396 | 27 | property var startTime: 0; | ||
1397 | 28 | property var remTime: 0; | ||
1398 | 29 | property int totalTime: 0; | ||
1399 | 30 | property int pauseTime: 0; | ||
1400 | 31 | |||
1401 | 32 | // Property to activate/deactivate the timer | ||
1402 | 33 | property bool timerOn: false; | ||
1403 | 34 | property bool inProgressFlag | ||
1404 | 35 | |||
1405 | 36 | // Property to expose the timer outer glow effect to outside objects | ||
1406 | 37 | property alias glowEffect: _glowEffect | ||
1407 | 38 | |||
1408 | 39 | showHourHand: false | ||
1409 | 40 | draggable: !inProgressFlag | ||
1410 | 41 | |||
1411 | 42 | // Timer function called by the main clock loop | ||
1412 | 43 | function onTimerUpdate () { | ||
1413 | 44 | if( timerOn ) { | ||
1414 | 45 | inProgressFlag = true; | ||
1415 | 46 | remTime = totalTime - Math.floor((new Date() - startTime)/ 1000) - pauseTime; | ||
1416 | 47 | |||
1417 | 48 | if (remTime < 0) { | ||
1418 | 49 | timerOn = false | ||
1419 | 50 | totalTime = -1; | ||
1420 | 51 | } else { | ||
1421 | 52 | ssToTime(remTime); | ||
1422 | 53 | } | ||
1423 | 54 | } | ||
1424 | 55 | } | ||
1425 | 56 | |||
1426 | 57 | // Function to convert time (in seconds) to hh:mm:ss format | ||
1427 | 58 | function ssToTime(time) { | ||
1428 | 59 | seconds = time % 60 | ||
1429 | 60 | time = Math.floor(time / 60) | ||
1430 | 61 | minutes = time % 60 | ||
1431 | 62 | } | ||
1432 | 63 | |||
1433 | 64 | // This timer to required to avoid rare occurences of the timer hand being stuck at the place where it was stopped | ||
1434 | 65 | // when the reset button is pressed while the timer is running. | ||
1435 | 66 | Timer { | ||
1436 | 67 | id: reset_timer | ||
1437 | 68 | interval: 200 | ||
1438 | 69 | repeat: false | ||
1439 | 70 | onTriggered: { | ||
1440 | 71 | inProgressFlag = true; | ||
1441 | 72 | inProgressFlag = false; | ||
1442 | 73 | } | ||
1443 | 74 | } | ||
1444 | 75 | |||
1445 | 76 | function reset() { | ||
1446 | 77 | reset_timer.start() | ||
1447 | 78 | timerOn = false; | ||
1448 | 79 | state = ""; | ||
1449 | 80 | startTime = remTime = pauseTime = 0; | ||
1450 | 81 | minutes = seconds = totalTime = 0; | ||
1451 | 82 | } | ||
1452 | 83 | |||
1453 | 84 | AnalogGlowEffect { | ||
1454 | 85 | id: _glowEffect | ||
1455 | 86 | z: parent.z - 1 | ||
1456 | 87 | visible: false; | ||
1457 | 88 | fillRectangle: parent | ||
1458 | 89 | } | ||
1459 | 90 | |||
1460 | 91 | Repeater { | ||
1461 | 92 | model: 12 | ||
1462 | 93 | delegate: AnalogClockMarker { | ||
1463 | 94 | number: index | ||
1464 | 95 | size: 0.5 | ||
1465 | 96 | distance: 0.48 | ||
1466 | 97 | } | ||
1467 | 98 | } | ||
1468 | 99 | } | ||
1469 | 0 | 100 | ||
1470 | === modified file 'timer/TimerPage.qml' | |||
1471 | --- timer/TimerPage.qml 2013-11-26 15:36:37 +0000 | |||
1472 | +++ timer/TimerPage.qml 2014-01-10 14:02:26 +0000 | |||
1473 | @@ -58,7 +58,7 @@ | |||
1474 | 58 | }, | 58 | }, |
1475 | 59 | State { | 59 | State { |
1476 | 60 | name: "addPreset" | 60 | name: "addPreset" |
1478 | 61 | PropertyChanges { target: timerMouseArea; enabled: false } | 61 | PropertyChanges { target: analogTimer; enableMouseArea: false } |
1479 | 62 | PropertyChanges { target: listPreset; visible: false } | 62 | PropertyChanges { target: listPreset; visible: false } |
1480 | 63 | PropertyChanges { target: namePreset; visible: true } | 63 | PropertyChanges { target: namePreset; visible: true } |
1481 | 64 | PropertyChanges { target: addPresetToolbarButton; visible: false } | 64 | PropertyChanges { target: addPresetToolbarButton; visible: false } |
1482 | @@ -84,7 +84,7 @@ | |||
1483 | 84 | listPreset.listIndex = -1; | 84 | listPreset.listIndex = -1; |
1484 | 85 | namePreset.text = ""; | 85 | namePreset.text = ""; |
1485 | 86 | tempNamePreset = ""; | 86 | tempNamePreset = ""; |
1487 | 87 | } | 87 | } |
1488 | 88 | 88 | ||
1489 | 89 | Component.onCompleted: { | 89 | Component.onCompleted: { |
1490 | 90 | Utils.log("TimerPage loaded"); | 90 | Utils.log("TimerPage loaded"); |
1491 | @@ -112,81 +112,70 @@ | |||
1492 | 112 | 112 | ||
1493 | 113 | Behavior on contentY { | 113 | Behavior on contentY { |
1494 | 114 | UbuntuNumberAnimation { duration: UbuntuAnimation.SlowDuration } | 114 | UbuntuNumberAnimation { duration: UbuntuAnimation.SlowDuration } |
1496 | 115 | } | 115 | } |
1497 | 116 | 116 | ||
1498 | 117 | // Main element which draws the timer face and manages time. | 117 | // Main element which draws the timer face and manages time. |
1500 | 118 | AnalogTimer { | 118 | TimerFace { |
1501 | 119 | id: analogTimer | 119 | id: analogTimer |
1502 | 120 | 120 | ||
1504 | 121 | innerLabel.objectName: "labelTimer" | 121 | anchors { |
1505 | 122 | top: parent.top | ||
1506 | 123 | topMargin: units.gu(10) | ||
1507 | 124 | horizontalCenter: parent.horizontalCenter | ||
1508 | 125 | } | ||
1509 | 126 | |||
1510 | 122 | innerLabel.text: intervalToString(minutes, seconds); | 127 | innerLabel.text: intervalToString(minutes, seconds); |
1511 | 128 | |||
1512 | 123 | Timer { | 129 | Timer { |
1513 | 124 | id: seconds_timer | 130 | id: seconds_timer |
1516 | 125 | 131 | interval: 250 | |
1515 | 126 | interval: 500 | ||
1517 | 127 | repeat: true | 132 | repeat: true |
1518 | 128 | onTriggered: analogTimer.innerLabel.text = intervalToString(minutes, seconds); | 133 | onTriggered: analogTimer.innerLabel.text = intervalToString(minutes, seconds); |
1519 | 129 | } | 134 | } |
1520 | 130 | 135 | ||
1531 | 131 | AnalogGlowEffect { | 136 | inProgressFlag: (timerOn === true || analogTimer.state === "DONE") ? true : false; |
1532 | 132 | id: glowEffect | 137 | onMinutesChanged: innerLabel.text = intervalToString(minutes, seconds); |
1523 | 133 | |||
1524 | 134 | z: parent.z - 1 | ||
1525 | 135 | visible: false; | ||
1526 | 136 | fillRectangle: parent | ||
1527 | 137 | } | ||
1528 | 138 | |||
1529 | 139 | anchors { top: parent.top; topMargin: units.gu(10); horizontalCenter: parent.horizontalCenter } | ||
1530 | 140 | inProgressFlag: (timerOn == true || analogTimer.state == "DONE") ? true : false; | ||
1533 | 141 | onSecondsChanged: if (timerOn == true) seconds_timer.restart() | 138 | onSecondsChanged: if (timerOn == true) seconds_timer.restart() |
1534 | 142 | else innerLabel.text = intervalToString(minutes, seconds); | 139 | else innerLabel.text = intervalToString(minutes, seconds); |
1535 | 143 | |||
1536 | 144 | onMinutesChanged: innerLabel.text = intervalToString(minutes, seconds); | ||
1537 | 145 | |||
1538 | 146 | states:[ | 140 | states:[ |
1539 | 147 | State { name: "STOP" }, | 141 | State { name: "STOP" }, |
1540 | 148 | State { name: "PAUSE"}, | 142 | State { name: "PAUSE"}, |
1541 | 149 | State { | 143 | State { |
1542 | 150 | name: "DONE" | 144 | name: "DONE" |
1543 | 151 | when: (totalTime == -1 && timerOn == false) | 145 | when: (totalTime == -1 && timerOn == false) |
1546 | 152 | PropertyChanges { target: glowEffect; visible: true } | 146 | PropertyChanges { target: analogTimer.glowEffect; visible: true } |
1547 | 153 | PropertyChanges { target: glowEffect; color: "#03CB4A" } | 147 | PropertyChanges { target: analogTimer.glowEffect; color: "#03CB4A" } |
1548 | 154 | } | 148 | } |
1549 | 155 | ] | 149 | ] |
1550 | 156 | 150 | ||
1579 | 157 | MouseArea { | 151 | onClicked: { |
1580 | 158 | id: timerMouseArea | 152 | switch (analogTimer.state) { |
1581 | 159 | anchors.fill: analogTimer.innerCircle | 153 | |
1582 | 160 | enabled: true | 154 | case "": |
1583 | 161 | onClicked: { | 155 | if ((seconds != 0 || minutes != 0) || timerOn) { |
1584 | 162 | switch (analogTimer.state) { | 156 | totalTime = (Math.round(minutes) * 60) + seconds; |
1557 | 163 | |||
1558 | 164 | case "": | ||
1559 | 165 | if ((seconds != 0 || minutes != 0) || timerOn) { | ||
1560 | 166 | totalTime = (minutes * 60) + seconds; | ||
1561 | 167 | analogTimer.startTime = new Date(); | ||
1562 | 168 | timerOn = true; | ||
1563 | 169 | analogTimer.state = "STOP"; | ||
1564 | 170 | } | ||
1565 | 171 | break; | ||
1566 | 172 | |||
1567 | 173 | case "STOP": | ||
1568 | 174 | timerOn = false; | ||
1569 | 175 | analogTimer.pauseTime = analogTimer.totalTime - analogTimer.remTime + 1; // +1 is necessary to start immediately the timer when finish a pause | ||
1570 | 176 | analogTimer.state = "PAUSE"; | ||
1571 | 177 | break; | ||
1572 | 178 | |||
1573 | 179 | case "DONE": | ||
1574 | 180 | reset(); | ||
1575 | 181 | analogTimer.state = ""; | ||
1576 | 182 | break; | ||
1577 | 183 | |||
1578 | 184 | case "PAUSE": | ||
1585 | 185 | analogTimer.startTime = new Date(); | 157 | analogTimer.startTime = new Date(); |
1586 | 186 | timerOn = true; | 158 | timerOn = true; |
1587 | 187 | analogTimer.state = "STOP"; | 159 | analogTimer.state = "STOP"; |
1588 | 188 | break; | ||
1589 | 189 | } | 160 | } |
1590 | 161 | break; | ||
1591 | 162 | |||
1592 | 163 | case "STOP": | ||
1593 | 164 | timerOn = false; | ||
1594 | 165 | analogTimer.pauseTime = analogTimer.totalTime - analogTimer.remTime + 1; // +1 is necessary to start immediately the timer when finish a pause | ||
1595 | 166 | analogTimer.state = "PAUSE"; | ||
1596 | 167 | break; | ||
1597 | 168 | |||
1598 | 169 | case "DONE": | ||
1599 | 170 | reset(); | ||
1600 | 171 | analogTimer.state = ""; | ||
1601 | 172 | break; | ||
1602 | 173 | |||
1603 | 174 | case "PAUSE": | ||
1604 | 175 | analogTimer.startTime = new Date(); | ||
1605 | 176 | timerOn = true; | ||
1606 | 177 | analogTimer.state = "STOP"; | ||
1607 | 178 | break; | ||
1608 | 190 | } | 179 | } |
1609 | 191 | } | 180 | } |
1610 | 192 | } | 181 | } |
PASSED: Continuous integration, rev:289 91.189. 93.70:8080/ job/ubuntu- clock-app- ci/134/ 91.189. 93.70:8080/ job/generic- mediumtests- trusty/ 599 91.189. 93.70:8080/ job/ubuntu- clock-app- raring- amd64-ci/ 134 91.189. 93.70:8080/ job/ubuntu- clock-app- saucy-amd64- ci/134 91.189. 93.70:8080/ job/ubuntu- clock-app- trusty- amd64-ci/ 52
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/ubuntu- clock-app- ci/134/ rebuild
http://