Merge lp:~nik90/ubuntu-clock-app/new-timer-design into lp:ubuntu-clock-app/saucy
- new-timer-design
- Merge into saucy
Proposed by
Nekhelesh Ramananthan
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Nekhelesh Ramananthan | ||||||||
Approved revision: | 120 | ||||||||
Merged at revision: | 114 | ||||||||
Proposed branch: | lp:~nik90/ubuntu-clock-app/new-timer-design | ||||||||
Merge into: | lp:ubuntu-clock-app/saucy | ||||||||
Prerequisite: | lp:~nik90/ubuntu-clock-app/new-stopwatch-design | ||||||||
Diff against target: |
778 lines (+262/-360) 3 files modified
timer/AnalogTimer.qml (+63/-247) timer/AnalogTouchHand.qml (+128/-0) timer/TimerPage.qml (+71/-113) |
||||||||
To merge this branch: | bzr merge lp:~nik90/ubuntu-clock-app/new-timer-design | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Ubuntu Clock Developers | Pending | ||
Review via email: mp+171410@code.launchpad.net |
Commit message
Implements the new visual designs of timer (just the skeleton layout) without background gradients or ubuntu shape.
Description of the change
Implements the new visual designs of timer (just the skeleton layout) without background gradients or ubuntu shape.
To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
review:
Approve
(continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:120
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
review:
Approve
(continuous-integration)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'timer/AnalogTimer.qml' |
2 | --- timer/AnalogTimer.qml 2013-06-03 21:39:09 +0000 |
3 | +++ timer/AnalogTimer.qml 2013-06-25 21:45:33 +0000 |
4 | @@ -33,21 +33,14 @@ |
5 | property int minutes: 0; |
6 | property int hours: 0; |
7 | property int totalTime: 0; |
8 | - property int timerValue: 0; |
9 | |
10 | // Property to activate/deactivate the timer |
11 | property bool timerOn: false; |
12 | - |
13 | - // Properties to get/set the timer hand properties |
14 | - property alias timerHandColor: timerHand.colortop; |
15 | - property alias timerHandRotation: timerHand.rotationAngle; |
16 | - |
17 | - // Properties to set/determine the input focus |
18 | - property bool secondsFlag |
19 | - property bool minutesFlag |
20 | - property bool hoursFlag |
21 | property bool inProgressFlag |
22 | |
23 | + property alias innerDimension: innerCircle.width; |
24 | + signal clicked(var mouse) |
25 | + |
26 | // Timer function called by the main clock loop |
27 | function onTimerUpdate () { |
28 | if( timerOn ) { |
29 | @@ -58,7 +51,6 @@ |
30 | totalTime = -1; |
31 | } else { |
32 | ssToTime(remTime); |
33 | - timerHand.rotationAngle = seconds * 6; |
34 | } |
35 | } |
36 | } |
37 | @@ -69,259 +61,83 @@ |
38 | time = Math.floor(time / 60) |
39 | minutes = time % 60 |
40 | hours = Math.floor(time / 60) |
41 | + secondHand.rotationValue = seconds * 6; |
42 | + minuteHand.rotationValue = minutes * 6; |
43 | + hourHand.rotationValue = hours * 6; |
44 | } |
45 | |
46 | // Function to disable timer and reset time |
47 | function reset() { |
48 | timerOn = false; |
49 | startTime = remTime = 0; |
50 | - hours = minutes = seconds = totalTime = timerValue = timerHand.rotationAngle = 0; |
51 | + hourHand.rotationValue = minuteHand.rotationValue = secondHand.rotationValue = 0; |
52 | + hours = minutes = seconds = totalTime = 0; |
53 | + hourHand.timerValue = minuteHand.timerValue = secondHand.timerValue = 0; |
54 | } |
55 | |
56 | - AnalogHand { |
57 | - id: timerHand |
58 | - |
59 | - widthhand: units.gu(2); heighthand: units.gu(16); heighttop: units.gu(5) |
60 | - rotationAngle: seconds * 6 |
61 | - colorhand: Constants.brightWhite |
62 | - colortop: Constants.ubuntuOrange |
63 | - } |
64 | - |
65 | + // inner circle which also acts as the button to start/stop the timer |
66 | Rectangle { |
67 | - id: secondsCircle |
68 | - |
69 | - width: units.gu(5); height: units.gu(5) |
70 | - radius: width / 2 |
71 | - anchors.centerIn: parent |
72 | - color: Constants.brightWhite |
73 | - antialiasing: true |
74 | - z: parent.z + 100 |
75 | - } |
76 | - |
77 | - Repeater { |
78 | - model: ["0", "15", "30", "45"] |
79 | - delegate: AnalogClockMarker { |
80 | - number: modelData |
81 | - distance: 0.60 |
82 | - textDisplay: true |
83 | + id: innerCircle; |
84 | + objectName: "buttonTimer" |
85 | + |
86 | + z: parent.z + 1; |
87 | + height: units.gu(19); width: units.gu(19); |
88 | + radius: width / 2; |
89 | + anchors.centerIn: parent; |
90 | + color: Constants.coolGrey; |
91 | + antialiasing: true; |
92 | + |
93 | + MouseArea { |
94 | + anchors.fill: parent |
95 | + onClicked: clockOuterCircle.clicked(mouse) |
96 | } |
97 | } |
98 | - |
99 | + |
100 | Repeater { |
101 | model: 12 |
102 | delegate: AnalogClockMarker { |
103 | number: index |
104 | size: 0.5 |
105 | - distance: 0.55 |
106 | - color: Constants.pitchBlack |
107 | + distance: 0.48 |
108 | + color: Constants.coolGrey |
109 | } |
110 | } |
111 | - |
112 | - // Implements touch support |
113 | - MouseArea { |
114 | - id: timerbackmousearea |
115 | - |
116 | - property real truex: mouseX - clockOuterCircle.width/2 |
117 | - property real truey: clockOuterCircle.height/2 - mouseY |
118 | - property real angle: Math.atan2(truex, truey) |
119 | - property real strictangle: parseInt(angle * 180 / Math.PI) |
120 | - property real modulo: strictangle % 6 |
121 | - property int seconds_up_flag: 0 |
122 | - property int seconds_down_flag: 0 |
123 | - property int minutes_up_flag: 0 |
124 | - property int minutes_down_flag: 0 |
125 | - property int temp_seconds: 0 |
126 | - property int temp_minutes: 0 |
127 | - |
128 | - enabled: !inProgressFlag |
129 | - anchors.fill: parent |
130 | - preventStealing: true |
131 | - |
132 | - onPositionChanged: if (timerbackmousearea.angle < 0) { |
133 | - timerHand.rotationAngle = strictangle - modulo + 360; |
134 | - timerValue = parseInt(timerHand.rotationAngle/6); |
135 | - |
136 | - if (secondsFlag) { |
137 | - seconds = timerValue; |
138 | - |
139 | - // FIXME: This whole code section below should be implemented in a more logical fashion. |
140 | - if (seconds == 0) { |
141 | - if (temp_seconds - seconds > 58) { |
142 | - // increasing minutes |
143 | - seconds_up_flag = 1 |
144 | - temp_seconds = 0 |
145 | - } |
146 | - else if (temp_seconds - seconds > 0) { |
147 | - // decreasing minutes |
148 | - seconds_down_flag = 1 |
149 | - temp_seconds = 0 |
150 | - } |
151 | - else {} |
152 | - |
153 | - if (seconds_up_flag == 1) { |
154 | - if (minutes == 59) { |
155 | - hours += 1 |
156 | - minutes = 0 |
157 | - } |
158 | - else { |
159 | - minutes += 1 |
160 | - } |
161 | - seconds_up_flag = 0; |
162 | - } |
163 | - } |
164 | - |
165 | - if (seconds == 1) { |
166 | - temp_seconds = seconds |
167 | - } |
168 | - |
169 | - if (seconds == 59) { |
170 | - temp_seconds = seconds |
171 | - if (seconds_down_flag == 1) { |
172 | - if (minutes == 0) { |
173 | - minutes = 59 |
174 | - hours -= 1 |
175 | - } |
176 | - else { |
177 | - minutes -= 1 |
178 | - } |
179 | - seconds_down_flag = 0; |
180 | - } |
181 | - } |
182 | - |
183 | - |
184 | - } |
185 | - |
186 | - if (minutesFlag) { |
187 | - minutes = timerValue; |
188 | - |
189 | - if (minutes == 0) { |
190 | - if (temp_minutes - minutes > 58) { |
191 | - // increasing hours |
192 | - minutes_up_flag = 1 |
193 | - temp_minutes = 0 |
194 | - } |
195 | - else if (temp_minutes - minutes > 0) { |
196 | - // decreasing hours |
197 | - minutes_down_flag = 1 |
198 | - temp_minutes = 0 |
199 | - } |
200 | - else {} |
201 | - |
202 | - if (minutes_up_flag == 1 && hours != 59) { |
203 | - hours += 1 |
204 | - minutes_up_flag = 0; |
205 | - } |
206 | - } |
207 | - |
208 | - if (minutes == 1) { |
209 | - temp_minutes = minutes |
210 | - } |
211 | - |
212 | - if (minutes == 59) { |
213 | - temp_minutes = minutes |
214 | - if (minutes_down_flag == 1 && hours != 0) { |
215 | - hours -= 1 |
216 | - minutes_down_flag = 0; |
217 | - } |
218 | - } |
219 | - } |
220 | - |
221 | - if (hoursFlag) { |
222 | - hours = timerValue; |
223 | - } |
224 | - } |
225 | - else { |
226 | - timerHand.rotationAngle = strictangle - modulo + 6; |
227 | - timerValue = parseInt(timerHand.rotationAngle/6); |
228 | - |
229 | - if (secondsFlag) { |
230 | - seconds = timerValue; |
231 | - |
232 | - if (seconds == 0) { |
233 | - if (temp_seconds - seconds > 58) { |
234 | - // increasing minutes |
235 | - seconds_up_flag = 1 |
236 | - temp_seconds = 0 |
237 | - } |
238 | - else if (temp_seconds - seconds > 0) { |
239 | - // decreasing minutes |
240 | - seconds_down_flag = 1 |
241 | - temp_seconds = 0 |
242 | - } |
243 | - else {} |
244 | - |
245 | - if (seconds_up_flag == 1) { |
246 | - if (minutes == 59) { |
247 | - hours += 1 |
248 | - minutes = 0 |
249 | - } |
250 | - else { |
251 | - minutes += 1 |
252 | - } |
253 | - seconds_up_flag = 0; |
254 | - } |
255 | - } |
256 | - |
257 | - if (seconds == 1) { |
258 | - temp_seconds = seconds |
259 | - } |
260 | - |
261 | - if (seconds == 59) { |
262 | - temp_seconds = seconds |
263 | - if (seconds_down_flag == 1) { |
264 | - if (minutes == 0) { |
265 | - minutes = 59 |
266 | - hours -= 1 |
267 | - } |
268 | - else { |
269 | - minutes -= 1 |
270 | - } |
271 | - seconds_down_flag = 0; |
272 | - } |
273 | - } |
274 | - |
275 | - |
276 | - } |
277 | - |
278 | - if (minutesFlag) { |
279 | - minutes = timerValue; |
280 | - |
281 | - if (minutes == 0) { |
282 | - if (temp_minutes - minutes > 58) { |
283 | - // increasing hours |
284 | - minutes_up_flag = 1 |
285 | - temp_minutes = 0 |
286 | - } |
287 | - else if (temp_minutes - minutes > 0) { |
288 | - // decreasing hours |
289 | - minutes_down_flag = 1 |
290 | - temp_minutes = 0 |
291 | - } |
292 | - else {} |
293 | - |
294 | - if (minutes_up_flag == 1 && hours != 59) { |
295 | - hours += 1 |
296 | - minutes_up_flag = 0; |
297 | - } |
298 | - } |
299 | - |
300 | - if (minutes == 1) { |
301 | - temp_minutes = minutes |
302 | - } |
303 | - |
304 | - if (minutes == 59) { |
305 | - temp_minutes = minutes |
306 | - if (minutes_down_flag == 1 && hours != 0) { |
307 | - hours -= 1 |
308 | - minutes_down_flag = 0; |
309 | - } |
310 | - } |
311 | - } |
312 | - |
313 | - if (hoursFlag) { |
314 | - hours = timerValue; |
315 | - } |
316 | - } |
317 | + |
318 | + // Hour hand with touch/mouse drag support |
319 | + AnalogTouchHand { |
320 | + id: hourHand |
321 | + |
322 | + onTimerValueChanged: hours = timerValue; |
323 | + |
324 | + handHeight: units.gu(12.5); handWidth: units.gu(1); |
325 | + zOrder: minuteHand.z + 1; |
326 | + animateFlag: inProgressFlag; |
327 | + enabled: !inProgressFlag; |
328 | + } |
329 | + |
330 | + // Minute hand with touch/mouse drag support |
331 | + AnalogTouchHand { |
332 | + id: minuteHand |
333 | + |
334 | + onTimerValueChanged: minutes = timerValue; |
335 | + |
336 | + handHeight: units.gu(14.5); handWidth: units.gu(0.5); |
337 | + animateFlag: inProgressFlag; |
338 | + enabled: !inProgressFlag; |
339 | + grabMargin: -units.gu(1) |
340 | + grabHeight: units.gu(7) |
341 | + } |
342 | + |
343 | + // Second hand with touch/mouse drag support |
344 | + AnalogTouchHand { |
345 | + id: secondHand |
346 | + |
347 | + onTimerValueChanged: seconds = timerValue; |
348 | + |
349 | + handHeight: units.gu(17); handWidth: units.gu(0.5); |
350 | + zOrder: parent.z - 1; |
351 | + animateFlag: inProgressFlag; |
352 | + enabled: !inProgressFlag; |
353 | + grabMargin: -units.gu(2) |
354 | } |
355 | } |
356 | - |
357 | |
358 | === added file 'timer/AnalogTouchHand.qml' |
359 | --- timer/AnalogTouchHand.qml 1970-01-01 00:00:00 +0000 |
360 | +++ timer/AnalogTouchHand.qml 2013-06-25 21:45:33 +0000 |
361 | @@ -0,0 +1,128 @@ |
362 | +/* |
363 | + * Copyright (C) 2013 Canonical Ltd |
364 | + * |
365 | + * This program is free software: you can redistribute it and/or modify |
366 | + * it under the terms of the GNU General Public License version 3 as |
367 | + * published by the Free Software Foundation. |
368 | + * |
369 | + * This program is distributed in the hope that it will be useful, |
370 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
371 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
372 | + * GNU General Public License for more details. |
373 | + * |
374 | + * You should have received a copy of the GNU General Public License |
375 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
376 | + * |
377 | + * Authored by: Nekhelesh Ramananthan <krnekhelesh@gmail.com> |
378 | + */ |
379 | + |
380 | +import QtQuick 2.0 |
381 | +import Ubuntu.Components 0.1 |
382 | +import "../common" |
383 | + |
384 | +// Qml item to enable touch input to the AnalogClockHand component |
385 | +Item { |
386 | + id: touchHand; |
387 | + |
388 | + z: parent.z; |
389 | + width: parent.width; height: width; |
390 | + anchors.centerIn: parent; |
391 | + |
392 | + /*! |
393 | + Enable/Disable rotation animation. Disable it while dragging the clock hand to avoid |
394 | + receiving inaccurate input values. |
395 | + */ |
396 | + property alias animateFlag: rotation.enabled; |
397 | + |
398 | + /*! |
399 | + Set if the dial should be rotated by the seconds, minutes or hours. This generally needs to be |
400 | + multiplied by 6 to convert it into degrees per second/hour/minute. |
401 | + */ |
402 | + property alias rotationValue: rotatingDial.rotation; |
403 | + |
404 | + |
405 | + // Set the touch/mouse grab area height and top margin |
406 | + property alias grabHeight: grabArea.height; |
407 | + property int grabMargin: units.gu(0); |
408 | + |
409 | + // Height and width of the clock hand |
410 | + property alias handHeight: hand.height; |
411 | + property alias handWidth: hand.width; |
412 | + |
413 | + // z order of the clock hand |
414 | + property alias zOrder: touchHand.z; |
415 | + |
416 | + // internal properties required for the functioning of the AnalogTouchHand |
417 | + property int timerValue: 0; |
418 | + property real centerX : (width / 2); |
419 | + property real centerY : (height / 2); |
420 | + |
421 | + // Dial which covers the clock hand and does the actual rotatio |
422 | + Rectangle{ |
423 | + id: rotatingDial; |
424 | + |
425 | + color: "transparent"; |
426 | + transformOrigin: Item.Center; |
427 | + radius: (width / 2); |
428 | + antialiasing: true; |
429 | + anchors.fill: parent; |
430 | + |
431 | + // Clock hand which lies above the rotating dial. This is stationary w.r.t to the rotating dial. |
432 | + AnalogClockHand { |
433 | + id: hand |
434 | + |
435 | + height: units.gu(0); width: units.gu(0); |
436 | + antialiasing: true; |
437 | + |
438 | + /*! |
439 | + Element to define the grab area of the clock hand. This allows us to define small clock hand |
440 | + which are still easier to grab. |
441 | + */ |
442 | + Rectangle { |
443 | + id: grabArea |
444 | + color: "transparent" |
445 | + width: units.gu(5); height: width; |
446 | + anchors { top: hand.top; topMargin: touchHand.grabMargin; horizontalCenter: hand.horizontalCenter } |
447 | + } |
448 | + |
449 | + MouseArea{ |
450 | + anchors.fill: grabArea; |
451 | + preventStealing: true; |
452 | + enabled: true; |
453 | + onPositionChanged: { |
454 | + var point = mapToItem (touchHand, mouse.x, mouse.y); |
455 | + var diffX = (point.x - touchHand.centerX); |
456 | + var diffY = -1 * (point.y - touchHand.centerY); |
457 | + var rad = Math.atan (diffY / diffX); |
458 | + var deg = (rad * 180 / Math.PI); |
459 | + |
460 | + if (diffX > 0 && diffY > 0) { |
461 | + rotatingDial.rotation = 90 - Math.abs (deg); |
462 | + } |
463 | + else if (diffX > 0 && diffY < 0) { |
464 | + rotatingDial.rotation = 90 + Math.abs (deg); |
465 | + } |
466 | + else if (diffX < 0 && diffY > 0) { |
467 | + rotatingDial.rotation = 270 + Math.abs (deg); |
468 | + } |
469 | + else if (diffX < 0 && diffY < 0) { |
470 | + rotatingDial.rotation = 270 - Math.abs (deg); |
471 | + } |
472 | + |
473 | + if (Math.round(rotatingDial.rotation/6) == 60) { |
474 | + touchHand.timerValue == 0 |
475 | + } else { |
476 | + touchHand.timerValue = Math.round(rotatingDial.rotation/6); |
477 | + } |
478 | + |
479 | + } |
480 | + } |
481 | + } |
482 | + |
483 | + Behavior on rotation { |
484 | + id: rotation; |
485 | + enabled: false; |
486 | + RotationAnimation { direction: RotationAnimation.Shortest } |
487 | + } |
488 | + } |
489 | +} |
490 | |
491 | === modified file 'timer/TimerPage.qml' |
492 | --- timer/TimerPage.qml 2013-06-15 14:21:07 +0000 |
493 | +++ timer/TimerPage.qml 2013-06-25 21:45:33 +0000 |
494 | @@ -31,7 +31,6 @@ |
495 | property alias minutes: analogTimer.minutes; |
496 | property alias seconds: analogTimer.seconds; |
497 | property alias totalTime: analogTimer.totalTime; |
498 | - property alias timerValue: analogTimer.timerValue; |
499 | property alias timerOn: analogTimer.timerOn; |
500 | |
501 | function onTimerUpdate() { |
502 | @@ -48,6 +47,18 @@ |
503 | return( (hou * 60 * 60) + (min * 60) + sec ); |
504 | } |
505 | |
506 | + // Function to print timer label (format mm:ss and hh:mm:ss when hh > 0) at top |
507 | + function intervalToString(hours, minutes, seconds) |
508 | + { |
509 | + var locale = Qt.locale(); |
510 | + |
511 | + if (hours > 0) { |
512 | + return Utils.zeroleft(hours, 2) + ":" + Utils.zeroleft(minutes, 2) + ":" + Utils.zeroleft(seconds, 2); |
513 | + } else { |
514 | + return Utils.zeroleft(minutes, 2) + ":" + Utils.zeroleft(seconds, 2); |
515 | + } |
516 | + } |
517 | + |
518 | // Function to calculate and print the hours, minutes and seconds from the total time as a string |
519 | function getstringTimer(time) { |
520 | var hours, minutes, seconds; |
521 | @@ -64,8 +75,6 @@ |
522 | Utils.log("TimerPage loaded"); |
523 | } |
524 | |
525 | - anchors.margins: units.gu(2) |
526 | - |
527 | PresetTimersModel { |
528 | id: presetModel |
529 | } |
530 | @@ -78,122 +87,61 @@ |
531 | } |
532 | ] |
533 | |
534 | - // Timer label hh:mm:ss |
535 | - TimerLabelRow { |
536 | - id: topTimerRow |
537 | - |
538 | - state: "FOCUS-SEC" |
539 | - timerOn: analogTimer.timerOn; |
540 | - hoursLabel: Utils.zeroleft(hours, 2); |
541 | - minutesLabel: Utils.zeroleft(minutes, 2); |
542 | - secondsLabel: Utils.zeroleft(seconds, 2); |
543 | - |
544 | - states:[ |
545 | - State { |
546 | - name: "FOCUS-SEC" |
547 | - PropertyChanges { target: topTimerRow; secondsLabelFlag: true } |
548 | - PropertyChanges { target: topTimerRow; minutesLabelFlag: false } |
549 | - PropertyChanges { target: topTimerRow; hoursLabelFlag: false } |
550 | - PropertyChanges { target: analogTimer; timerHandRotation: seconds * 6 } |
551 | - }, |
552 | - |
553 | - State { |
554 | - name: "FOCUS-MIN" |
555 | - PropertyChanges { target: topTimerRow; secondsLabelFlag: false } |
556 | - PropertyChanges { target: topTimerRow; minutesLabelFlag: true } |
557 | - PropertyChanges { target: topTimerRow; hoursLabelFlag: false } |
558 | - PropertyChanges { target: analogTimer; timerHandRotation: minutes * 6 } |
559 | - }, |
560 | - |
561 | - State { |
562 | - name: "FOCUS-HOR" |
563 | - PropertyChanges { target: topTimerRow; secondsLabelFlag: false } |
564 | - PropertyChanges { target: topTimerRow; minutesLabelFlag: false } |
565 | - PropertyChanges { target: topTimerRow; hoursLabelFlag: true } |
566 | - PropertyChanges { target: analogTimer; timerHandRotation: hours * 6 } |
567 | - }, |
568 | - |
569 | - State { |
570 | - name: "DISABLED" |
571 | - when: timerOn == true || timerAnimationContainer.state == "SCROLLED" || buttonTimer.state == "DONE" |
572 | - PropertyChanges { target: topTimerRow; secondsLabelFlag: false } |
573 | - PropertyChanges { target: topTimerRow; minutesLabelFlag: false } |
574 | - PropertyChanges { target: topTimerRow; hoursLabelFlag: false } |
575 | - } |
576 | - ] |
577 | - } |
578 | - |
579 | AnimationContainer { |
580 | id: timerAnimationContainer |
581 | |
582 | - // FIXME: The y is given a arbitary value which needs to be fixed by ensuring that the outerglow is not drawn outside the clock face area. |
583 | - initYPos: units.gu(8); |
584 | - finalYPos: -listPreset.height |
585 | + initYPos: units.gu(0); |
586 | + finalYPos: -listTimerPreset.height |
587 | |
588 | - anchors { left: parent.left; top: topTimerRow.bottom; right: parent.right; bottom: parent.bottom } |
589 | + anchors.fill: parent |
590 | |
591 | onStateChanged: if (state == "SCROLLED") listTimerPreset.currentIndex = -1 |
592 | |
593 | + // Label to show the current time |
594 | + Item { |
595 | + id: labelContainer; |
596 | + |
597 | + z: analogTimer.z + 1; |
598 | + width: analogTimer.innerDimension; height: width; |
599 | + anchors.centerIn: analogTimer; |
600 | + |
601 | + Label { |
602 | + id: labelTimer |
603 | + objectName: "labelTimer" |
604 | + |
605 | + anchors.centerIn: parent |
606 | + horizontalAlignment: Text.AlignHCenter |
607 | + verticalAlignment: Text.AlignVCenter |
608 | + color: Constants.brightWhite; |
609 | + |
610 | + fontSize: "x-large" |
611 | + text: labelTimer.text = intervalToString(hours, minutes, seconds); |
612 | + } |
613 | + } |
614 | + |
615 | // Main element which draws the timer face and manages time. |
616 | AnalogTimer { |
617 | id: analogTimer |
618 | |
619 | - anchors { top: parent.top; horizontalCenter: parent.horizontalCenter } |
620 | - |
621 | - secondsFlag: topTimerRow.secondsLabelFlag; |
622 | - minutesFlag: topTimerRow.minutesLabelFlag; |
623 | - hoursFlag: topTimerRow.hoursLabelFlag; |
624 | - inProgressFlag: (timerOn == true || buttonTimer.state == "DONE") ? true : false; |
625 | - |
626 | - onHoursChanged: topTimerRow.hoursLabel = Utils.zeroleft(hours, 2); |
627 | - onMinutesChanged: topTimerRow.minutesLabel = Utils.zeroleft(minutes, 2); |
628 | - onSecondsChanged: topTimerRow.secondsLabel = Utils.zeroleft(seconds, 2); |
629 | - onTimerOnChanged: topTimerRow.timerOn = timerOn; |
630 | - } |
631 | - |
632 | - // Multi-function button (Preset, Start, Stop, Done) |
633 | - Button { |
634 | - id: buttonTimer |
635 | - |
636 | - width: units.gu(12); height: units.gu(5) |
637 | - anchors { top: analogTimer.bottom; topMargin: units.gu(8); horizontalCenter: parent.horizontalCenter } |
638 | - color: Constants.brightWhite |
639 | - visible: timerPage.state == "ADDPRESET" ? false : true; |
640 | - |
641 | - text: i18n.tr("Presets") |
642 | + anchors { top: parent.top; topMargin: units.gu(9); horizontalCenter: parent.horizontalCenter } |
643 | + inProgressFlag: (timerOn == true || analogTimer.state == "DONE") ? true : false; |
644 | + onSecondsChanged: labelTimer.text = intervalToString(hours, minutes, seconds); |
645 | + onMinutesChanged: labelTimer.text = intervalToString(hours, minutes, seconds); |
646 | + onHoursChanged: labelTimer.text = intervalToString(hours, minutes, seconds); |
647 | |
648 | states:[ |
649 | - State { |
650 | - name: "START" |
651 | - when: ((seconds != 0 || minutes != 0 || hours != 0) && timerOn == false) |
652 | - PropertyChanges { target: buttonTimer; color: Constants.ubuntuOrange; text: i18n.tr("Start") } |
653 | - PropertyChanges { target: analogTimer; timerHandColor: Constants.ubuntuOrange } |
654 | - PropertyChanges { target: analogTimer; glowColor: Constants.analogClockFaceGlowColor } |
655 | - }, |
656 | - |
657 | - State { |
658 | - name: "STOP" |
659 | - PropertyChanges { target: buttonTimer; color: Constants.darkGrey; text: i18n.tr("Stop") } |
660 | - PropertyChanges { target: analogTimer; timerHandColor: Constants.ubuntuOrange } |
661 | - PropertyChanges { target: analogTimer; glowColor: Constants.analogClockFaceGlowColor } |
662 | - }, |
663 | - |
664 | + State { name: "STOP" }, |
665 | State { |
666 | name: "DONE" |
667 | when: (totalTime == -1 && timerOn == false) |
668 | - PropertyChanges { target: buttonTimer; color: Constants.green; text: i18n.tr("Done") } |
669 | - PropertyChanges { target: analogTimer; timerHandColor: Constants.green } |
670 | PropertyChanges { target: analogTimer; glowColor: Constants.analogClockFaceGlowColorTimerDown } |
671 | } |
672 | ] |
673 | |
674 | onClicked: { |
675 | - switch (buttonTimer.state) { |
676 | + switch (analogTimer.state) { |
677 | + |
678 | case "": |
679 | - timerAnimationContainer.swipeView() |
680 | - break; |
681 | - |
682 | - case "START": |
683 | totalTime = totalSeconds(hours, minutes, seconds); |
684 | analogTimer.startTime = new Date(); |
685 | timerOn = true; |
686 | @@ -205,12 +153,14 @@ |
687 | break; |
688 | |
689 | case "STOP": |
690 | - timerOn = false; |
691 | + timerOn = false; |
692 | reset(); |
693 | + state = ""; |
694 | break; |
695 | |
696 | case "DONE": |
697 | reset(); |
698 | + state = ""; |
699 | break; |
700 | } |
701 | } |
702 | @@ -222,25 +172,35 @@ |
703 | |
704 | height: childrenRect.height |
705 | visible: timerPage.state == "ADDPRESET" ? false : true; |
706 | - anchors { left: parent.left; right: parent.right; top: buttonTimer.bottom; topMargin: units.gu(5) } |
707 | - |
708 | - ListItem.Divider { } |
709 | - |
710 | - ListItem.Header { text: i18n.tr("Saved Presets") } |
711 | + anchors { left: parent.left; right: parent.right; top: analogTimer.bottom; topMargin: units.gu(13) } |
712 | + |
713 | + ListItem.ThinDivider { } |
714 | + |
715 | + ListItem.Header { |
716 | + Label { |
717 | + text: i18n.tr("Presets") |
718 | + anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: units.gu(2) } |
719 | + fontSize: "medium" |
720 | + } |
721 | + } |
722 | |
723 | ListView { |
724 | id: listTimerPreset |
725 | |
726 | anchors { left: parent.left; right: parent.right } |
727 | - height: units.gu(35) |
728 | + height: units.gu(21) |
729 | model: presetModel |
730 | currentIndex: -1 |
731 | |
732 | delegate: ListItem.Standard { |
733 | - text: label |
734 | + Label { |
735 | + fontSize: "large"; |
736 | + text: label |
737 | + anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: units.gu(3) } |
738 | + } |
739 | |
740 | Label { |
741 | - fontSize: "medium" |
742 | + fontSize: "large" |
743 | text: getstringTimer(seconds); |
744 | anchors { verticalCenter: parent.verticalCenter; right: parent.right; rightMargin: units.gu(2) } |
745 | } |
746 | @@ -259,8 +219,7 @@ |
747 | } |
748 | |
749 | onClicked: { |
750 | - if (!timerOn) { |
751 | - buttonTimer.state = "START"; |
752 | + if (!timerOn) { |
753 | analogTimer.ssToTime(seconds); |
754 | listTimerPreset.currentIndex = index |
755 | } |
756 | @@ -275,18 +234,17 @@ |
757 | |
758 | width: units.gu(12); height: units.gu(12) |
759 | radius: width / 2 |
760 | - anchors.centerIn: analogTimer |
761 | - border.color: Constants.normalGrey |
762 | - color: "#F8F8F8" |
763 | + anchors.centerIn: analogTimer |
764 | + color: "transparent" |
765 | antialiasing: true |
766 | visible: false |
767 | |
768 | Label { |
769 | id: addPresetTextDone |
770 | |
771 | - anchors.centerIn: parent |
772 | + //anchors.centerIn: parent |
773 | color: Constants.green |
774 | - fontSize: "large" |
775 | + fontSize: "x-large" |
776 | |
777 | text: i18n.tr("DONE") |
778 | } |
PASSED: Continuous integration, rev:120 91.189. 93.70:8080/ job/ubuntu- clock-app- ci/1/ 91.189. 93.70:8080/ job/ubuntu- clock-app- quantal- amd64-ci/ 2 91.189. 93.70:8080/ job/ubuntu- clock-app- raring- amd64-ci/ 1
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/ubuntu- clock-app- ci/1/rebuild
http://