Merge lp:~nik90/ubuntu-clock-app/new-timer-design into lp:ubuntu-clock-app/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
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 :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'timer/AnalogTimer.qml'
--- timer/AnalogTimer.qml 2013-06-03 21:39:09 +0000
+++ timer/AnalogTimer.qml 2013-06-25 21:45:33 +0000
@@ -33,21 +33,14 @@
33 property int minutes: 0;33 property int minutes: 0;
34 property int hours: 0;34 property int hours: 0;
35 property int totalTime: 0;35 property int totalTime: 0;
36 property int timerValue: 0;
3736
38 // Property to activate/deactivate the timer37 // Property to activate/deactivate the timer
39 property bool timerOn: false;38 property bool timerOn: false;
40
41 // Properties to get/set the timer hand properties
42 property alias timerHandColor: timerHand.colortop;
43 property alias timerHandRotation: timerHand.rotationAngle;
44
45 // Properties to set/determine the input focus
46 property bool secondsFlag
47 property bool minutesFlag
48 property bool hoursFlag
49 property bool inProgressFlag39 property bool inProgressFlag
5040
41 property alias innerDimension: innerCircle.width;
42 signal clicked(var mouse)
43
51 // Timer function called by the main clock loop44 // Timer function called by the main clock loop
52 function onTimerUpdate () {45 function onTimerUpdate () {
53 if( timerOn ) {46 if( timerOn ) {
@@ -58,7 +51,6 @@
58 totalTime = -1;51 totalTime = -1;
59 } else {52 } else {
60 ssToTime(remTime);53 ssToTime(remTime);
61 timerHand.rotationAngle = seconds * 6;
62 }54 }
63 }55 }
64 }56 }
@@ -69,259 +61,83 @@
69 time = Math.floor(time / 60)61 time = Math.floor(time / 60)
70 minutes = time % 6062 minutes = time % 60
71 hours = Math.floor(time / 60)63 hours = Math.floor(time / 60)
64 secondHand.rotationValue = seconds * 6;
65 minuteHand.rotationValue = minutes * 6;
66 hourHand.rotationValue = hours * 6;
72 }67 }
7368
74 // Function to disable timer and reset time69 // Function to disable timer and reset time
75 function reset() {70 function reset() {
76 timerOn = false;71 timerOn = false;
77 startTime = remTime = 0;72 startTime = remTime = 0;
78 hours = minutes = seconds = totalTime = timerValue = timerHand.rotationAngle = 0;73 hourHand.rotationValue = minuteHand.rotationValue = secondHand.rotationValue = 0;
74 hours = minutes = seconds = totalTime = 0;
75 hourHand.timerValue = minuteHand.timerValue = secondHand.timerValue = 0;
79 }76 }
8077
81 AnalogHand {78 // inner circle which also acts as the button to start/stop the timer
82 id: timerHand
83
84 widthhand: units.gu(2); heighthand: units.gu(16); heighttop: units.gu(5)
85 rotationAngle: seconds * 6
86 colorhand: Constants.brightWhite
87 colortop: Constants.ubuntuOrange
88 }
89
90 Rectangle {79 Rectangle {
91 id: secondsCircle80 id: innerCircle;
92 81 objectName: "buttonTimer"
93 width: units.gu(5); height: units.gu(5)82
94 radius: width / 283 z: parent.z + 1;
95 anchors.centerIn: parent84 height: units.gu(19); width: units.gu(19);
96 color: Constants.brightWhite85 radius: width / 2;
97 antialiasing: true86 anchors.centerIn: parent;
98 z: parent.z + 10087 color: Constants.coolGrey;
99 }88 antialiasing: true;
10089
101 Repeater {90 MouseArea {
102 model: ["0", "15", "30", "45"]91 anchors.fill: parent
103 delegate: AnalogClockMarker {92 onClicked: clockOuterCircle.clicked(mouse)
104 number: modelData
105 distance: 0.60
106 textDisplay: true
107 }93 }
108 }94 }
109 95
110 Repeater {96 Repeater {
111 model: 1297 model: 12
112 delegate: AnalogClockMarker {98 delegate: AnalogClockMarker {
113 number: index99 number: index
114 size: 0.5100 size: 0.5
115 distance: 0.55101 distance: 0.48
116 color: Constants.pitchBlack102 color: Constants.coolGrey
117 }103 }
118 }104 }
119 105
120 // Implements touch support106 // Hour hand with touch/mouse drag support
121 MouseArea {107 AnalogTouchHand {
122 id: timerbackmousearea108 id: hourHand
123 109
124 property real truex: mouseX - clockOuterCircle.width/2110 onTimerValueChanged: hours = timerValue;
125 property real truey: clockOuterCircle.height/2 - mouseY111
126 property real angle: Math.atan2(truex, truey)112 handHeight: units.gu(12.5); handWidth: units.gu(1);
127 property real strictangle: parseInt(angle * 180 / Math.PI)113 zOrder: minuteHand.z + 1;
128 property real modulo: strictangle % 6114 animateFlag: inProgressFlag;
129 property int seconds_up_flag: 0115 enabled: !inProgressFlag;
130 property int seconds_down_flag: 0116 }
131 property int minutes_up_flag: 0117
132 property int minutes_down_flag: 0118 // Minute hand with touch/mouse drag support
133 property int temp_seconds: 0119 AnalogTouchHand {
134 property int temp_minutes: 0120 id: minuteHand
135 121
136 enabled: !inProgressFlag122 onTimerValueChanged: minutes = timerValue;
137 anchors.fill: parent123
138 preventStealing: true124 handHeight: units.gu(14.5); handWidth: units.gu(0.5);
139125 animateFlag: inProgressFlag;
140 onPositionChanged: if (timerbackmousearea.angle < 0) {126 enabled: !inProgressFlag;
141 timerHand.rotationAngle = strictangle - modulo + 360;127 grabMargin: -units.gu(1)
142 timerValue = parseInt(timerHand.rotationAngle/6);128 grabHeight: units.gu(7)
143129 }
144 if (secondsFlag) {130
145 seconds = timerValue;131 // Second hand with touch/mouse drag support
146132 AnalogTouchHand {
147 // FIXME: This whole code section below should be implemented in a more logical fashion.133 id: secondHand
148 if (seconds == 0) {134
149 if (temp_seconds - seconds > 58) {135 onTimerValueChanged: seconds = timerValue;
150 // increasing minutes136
151 seconds_up_flag = 1137 handHeight: units.gu(17); handWidth: units.gu(0.5);
152 temp_seconds = 0138 zOrder: parent.z - 1;
153 }139 animateFlag: inProgressFlag;
154 else if (temp_seconds - seconds > 0) {140 enabled: !inProgressFlag;
155 // decreasing minutes141 grabMargin: -units.gu(2)
156 seconds_down_flag = 1
157 temp_seconds = 0
158 }
159 else {}
160
161 if (seconds_up_flag == 1) {
162 if (minutes == 59) {
163 hours += 1
164 minutes = 0
165 }
166 else {
167 minutes += 1
168 }
169 seconds_up_flag = 0;
170 }
171 }
172
173 if (seconds == 1) {
174 temp_seconds = seconds
175 }
176
177 if (seconds == 59) {
178 temp_seconds = seconds
179 if (seconds_down_flag == 1) {
180 if (minutes == 0) {
181 minutes = 59
182 hours -= 1
183 }
184 else {
185 minutes -= 1
186 }
187 seconds_down_flag = 0;
188 }
189 }
190
191
192 }
193
194 if (minutesFlag) {
195 minutes = timerValue;
196
197 if (minutes == 0) {
198 if (temp_minutes - minutes > 58) {
199 // increasing hours
200 minutes_up_flag = 1
201 temp_minutes = 0
202 }
203 else if (temp_minutes - minutes > 0) {
204 // decreasing hours
205 minutes_down_flag = 1
206 temp_minutes = 0
207 }
208 else {}
209
210 if (minutes_up_flag == 1 && hours != 59) {
211 hours += 1
212 minutes_up_flag = 0;
213 }
214 }
215
216 if (minutes == 1) {
217 temp_minutes = minutes
218 }
219
220 if (minutes == 59) {
221 temp_minutes = minutes
222 if (minutes_down_flag == 1 && hours != 0) {
223 hours -= 1
224 minutes_down_flag = 0;
225 }
226 }
227 }
228
229 if (hoursFlag) {
230 hours = timerValue;
231 }
232 }
233 else {
234 timerHand.rotationAngle = strictangle - modulo + 6;
235 timerValue = parseInt(timerHand.rotationAngle/6);
236
237 if (secondsFlag) {
238 seconds = timerValue;
239
240 if (seconds == 0) {
241 if (temp_seconds - seconds > 58) {
242 // increasing minutes
243 seconds_up_flag = 1
244 temp_seconds = 0
245 }
246 else if (temp_seconds - seconds > 0) {
247 // decreasing minutes
248 seconds_down_flag = 1
249 temp_seconds = 0
250 }
251 else {}
252
253 if (seconds_up_flag == 1) {
254 if (minutes == 59) {
255 hours += 1
256 minutes = 0
257 }
258 else {
259 minutes += 1
260 }
261 seconds_up_flag = 0;
262 }
263 }
264
265 if (seconds == 1) {
266 temp_seconds = seconds
267 }
268
269 if (seconds == 59) {
270 temp_seconds = seconds
271 if (seconds_down_flag == 1) {
272 if (minutes == 0) {
273 minutes = 59
274 hours -= 1
275 }
276 else {
277 minutes -= 1
278 }
279 seconds_down_flag = 0;
280 }
281 }
282
283
284 }
285
286 if (minutesFlag) {
287 minutes = timerValue;
288
289 if (minutes == 0) {
290 if (temp_minutes - minutes > 58) {
291 // increasing hours
292 minutes_up_flag = 1
293 temp_minutes = 0
294 }
295 else if (temp_minutes - minutes > 0) {
296 // decreasing hours
297 minutes_down_flag = 1
298 temp_minutes = 0
299 }
300 else {}
301
302 if (minutes_up_flag == 1 && hours != 59) {
303 hours += 1
304 minutes_up_flag = 0;
305 }
306 }
307
308 if (minutes == 1) {
309 temp_minutes = minutes
310 }
311
312 if (minutes == 59) {
313 temp_minutes = minutes
314 if (minutes_down_flag == 1 && hours != 0) {
315 hours -= 1
316 minutes_down_flag = 0;
317 }
318 }
319 }
320
321 if (hoursFlag) {
322 hours = timerValue;
323 }
324 }
325 }142 }
326}143}
327
328144
=== added file 'timer/AnalogTouchHand.qml'
--- timer/AnalogTouchHand.qml 1970-01-01 00:00:00 +0000
+++ timer/AnalogTouchHand.qml 2013-06-25 21:45:33 +0000
@@ -0,0 +1,128 @@
1/*
2 * Copyright (C) 2013 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Nekhelesh Ramananthan <krnekhelesh@gmail.com>
17 */
18
19import QtQuick 2.0
20import Ubuntu.Components 0.1
21import "../common"
22
23// Qml item to enable touch input to the AnalogClockHand component
24Item {
25 id: touchHand;
26
27 z: parent.z;
28 width: parent.width; height: width;
29 anchors.centerIn: parent;
30
31 /*!
32 Enable/Disable rotation animation. Disable it while dragging the clock hand to avoid
33 receiving inaccurate input values.
34 */
35 property alias animateFlag: rotation.enabled;
36
37 /*!
38 Set if the dial should be rotated by the seconds, minutes or hours. This generally needs to be
39 multiplied by 6 to convert it into degrees per second/hour/minute.
40 */
41 property alias rotationValue: rotatingDial.rotation;
42
43
44 // Set the touch/mouse grab area height and top margin
45 property alias grabHeight: grabArea.height;
46 property int grabMargin: units.gu(0);
47
48 // Height and width of the clock hand
49 property alias handHeight: hand.height;
50 property alias handWidth: hand.width;
51
52 // z order of the clock hand
53 property alias zOrder: touchHand.z;
54
55 // internal properties required for the functioning of the AnalogTouchHand
56 property int timerValue: 0;
57 property real centerX : (width / 2);
58 property real centerY : (height / 2);
59
60 // Dial which covers the clock hand and does the actual rotatio
61 Rectangle{
62 id: rotatingDial;
63
64 color: "transparent";
65 transformOrigin: Item.Center;
66 radius: (width / 2);
67 antialiasing: true;
68 anchors.fill: parent;
69
70 // Clock hand which lies above the rotating dial. This is stationary w.r.t to the rotating dial.
71 AnalogClockHand {
72 id: hand
73
74 height: units.gu(0); width: units.gu(0);
75 antialiasing: true;
76
77 /*!
78 Element to define the grab area of the clock hand. This allows us to define small clock hand
79 which are still easier to grab.
80 */
81 Rectangle {
82 id: grabArea
83 color: "transparent"
84 width: units.gu(5); height: width;
85 anchors { top: hand.top; topMargin: touchHand.grabMargin; horizontalCenter: hand.horizontalCenter }
86 }
87
88 MouseArea{
89 anchors.fill: grabArea;
90 preventStealing: true;
91 enabled: true;
92 onPositionChanged: {
93 var point = mapToItem (touchHand, mouse.x, mouse.y);
94 var diffX = (point.x - touchHand.centerX);
95 var diffY = -1 * (point.y - touchHand.centerY);
96 var rad = Math.atan (diffY / diffX);
97 var deg = (rad * 180 / Math.PI);
98
99 if (diffX > 0 && diffY > 0) {
100 rotatingDial.rotation = 90 - Math.abs (deg);
101 }
102 else if (diffX > 0 && diffY < 0) {
103 rotatingDial.rotation = 90 + Math.abs (deg);
104 }
105 else if (diffX < 0 && diffY > 0) {
106 rotatingDial.rotation = 270 + Math.abs (deg);
107 }
108 else if (diffX < 0 && diffY < 0) {
109 rotatingDial.rotation = 270 - Math.abs (deg);
110 }
111
112 if (Math.round(rotatingDial.rotation/6) == 60) {
113 touchHand.timerValue == 0
114 } else {
115 touchHand.timerValue = Math.round(rotatingDial.rotation/6);
116 }
117
118 }
119 }
120 }
121
122 Behavior on rotation {
123 id: rotation;
124 enabled: false;
125 RotationAnimation { direction: RotationAnimation.Shortest }
126 }
127 }
128}
0129
=== modified file 'timer/TimerPage.qml'
--- timer/TimerPage.qml 2013-06-15 14:21:07 +0000
+++ timer/TimerPage.qml 2013-06-25 21:45:33 +0000
@@ -31,7 +31,6 @@
31 property alias minutes: analogTimer.minutes;31 property alias minutes: analogTimer.minutes;
32 property alias seconds: analogTimer.seconds;32 property alias seconds: analogTimer.seconds;
33 property alias totalTime: analogTimer.totalTime;33 property alias totalTime: analogTimer.totalTime;
34 property alias timerValue: analogTimer.timerValue;
35 property alias timerOn: analogTimer.timerOn;34 property alias timerOn: analogTimer.timerOn;
3635
37 function onTimerUpdate() {36 function onTimerUpdate() {
@@ -48,6 +47,18 @@
48 return( (hou * 60 * 60) + (min * 60) + sec );47 return( (hou * 60 * 60) + (min * 60) + sec );
49 }48 }
5049
50 // Function to print timer label (format mm:ss and hh:mm:ss when hh > 0) at top
51 function intervalToString(hours, minutes, seconds)
52 {
53 var locale = Qt.locale();
54
55 if (hours > 0) {
56 return Utils.zeroleft(hours, 2) + ":" + Utils.zeroleft(minutes, 2) + ":" + Utils.zeroleft(seconds, 2);
57 } else {
58 return Utils.zeroleft(minutes, 2) + ":" + Utils.zeroleft(seconds, 2);
59 }
60 }
61
51 // Function to calculate and print the hours, minutes and seconds from the total time as a string62 // Function to calculate and print the hours, minutes and seconds from the total time as a string
52 function getstringTimer(time) {63 function getstringTimer(time) {
53 var hours, minutes, seconds;64 var hours, minutes, seconds;
@@ -64,8 +75,6 @@
64 Utils.log("TimerPage loaded");75 Utils.log("TimerPage loaded");
65 }76 }
6677
67 anchors.margins: units.gu(2)
68
69 PresetTimersModel {78 PresetTimersModel {
70 id: presetModel79 id: presetModel
71 }80 }
@@ -78,122 +87,61 @@
78 }87 }
79 ]88 ]
8089
81 // Timer label hh:mm:ss
82 TimerLabelRow {
83 id: topTimerRow
84
85 state: "FOCUS-SEC"
86 timerOn: analogTimer.timerOn;
87 hoursLabel: Utils.zeroleft(hours, 2);
88 minutesLabel: Utils.zeroleft(minutes, 2);
89 secondsLabel: Utils.zeroleft(seconds, 2);
90
91 states:[
92 State {
93 name: "FOCUS-SEC"
94 PropertyChanges { target: topTimerRow; secondsLabelFlag: true }
95 PropertyChanges { target: topTimerRow; minutesLabelFlag: false }
96 PropertyChanges { target: topTimerRow; hoursLabelFlag: false }
97 PropertyChanges { target: analogTimer; timerHandRotation: seconds * 6 }
98 },
99
100 State {
101 name: "FOCUS-MIN"
102 PropertyChanges { target: topTimerRow; secondsLabelFlag: false }
103 PropertyChanges { target: topTimerRow; minutesLabelFlag: true }
104 PropertyChanges { target: topTimerRow; hoursLabelFlag: false }
105 PropertyChanges { target: analogTimer; timerHandRotation: minutes * 6 }
106 },
107
108 State {
109 name: "FOCUS-HOR"
110 PropertyChanges { target: topTimerRow; secondsLabelFlag: false }
111 PropertyChanges { target: topTimerRow; minutesLabelFlag: false }
112 PropertyChanges { target: topTimerRow; hoursLabelFlag: true }
113 PropertyChanges { target: analogTimer; timerHandRotation: hours * 6 }
114 },
115
116 State {
117 name: "DISABLED"
118 when: timerOn == true || timerAnimationContainer.state == "SCROLLED" || buttonTimer.state == "DONE"
119 PropertyChanges { target: topTimerRow; secondsLabelFlag: false }
120 PropertyChanges { target: topTimerRow; minutesLabelFlag: false }
121 PropertyChanges { target: topTimerRow; hoursLabelFlag: false }
122 }
123 ]
124 }
125
126 AnimationContainer {90 AnimationContainer {
127 id: timerAnimationContainer91 id: timerAnimationContainer
12892
129 // 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.93 initYPos: units.gu(0);
130 initYPos: units.gu(8);94 finalYPos: -listTimerPreset.height
131 finalYPos: -listPreset.height
13295
133 anchors { left: parent.left; top: topTimerRow.bottom; right: parent.right; bottom: parent.bottom }96 anchors.fill: parent
13497
135 onStateChanged: if (state == "SCROLLED") listTimerPreset.currentIndex = -198 onStateChanged: if (state == "SCROLLED") listTimerPreset.currentIndex = -1
13699
100 // Label to show the current time
101 Item {
102 id: labelContainer;
103
104 z: analogTimer.z + 1;
105 width: analogTimer.innerDimension; height: width;
106 anchors.centerIn: analogTimer;
107
108 Label {
109 id: labelTimer
110 objectName: "labelTimer"
111
112 anchors.centerIn: parent
113 horizontalAlignment: Text.AlignHCenter
114 verticalAlignment: Text.AlignVCenter
115 color: Constants.brightWhite;
116
117 fontSize: "x-large"
118 text: labelTimer.text = intervalToString(hours, minutes, seconds);
119 }
120 }
121
137 // Main element which draws the timer face and manages time.122 // Main element which draws the timer face and manages time.
138 AnalogTimer {123 AnalogTimer {
139 id: analogTimer124 id: analogTimer
140125
141 anchors { top: parent.top; horizontalCenter: parent.horizontalCenter }126 anchors { top: parent.top; topMargin: units.gu(9); horizontalCenter: parent.horizontalCenter }
142127 inProgressFlag: (timerOn == true || analogTimer.state == "DONE") ? true : false;
143 secondsFlag: topTimerRow.secondsLabelFlag;128 onSecondsChanged: labelTimer.text = intervalToString(hours, minutes, seconds);
144 minutesFlag: topTimerRow.minutesLabelFlag;129 onMinutesChanged: labelTimer.text = intervalToString(hours, minutes, seconds);
145 hoursFlag: topTimerRow.hoursLabelFlag;130 onHoursChanged: labelTimer.text = intervalToString(hours, minutes, seconds);
146 inProgressFlag: (timerOn == true || buttonTimer.state == "DONE") ? true : false;
147
148 onHoursChanged: topTimerRow.hoursLabel = Utils.zeroleft(hours, 2);
149 onMinutesChanged: topTimerRow.minutesLabel = Utils.zeroleft(minutes, 2);
150 onSecondsChanged: topTimerRow.secondsLabel = Utils.zeroleft(seconds, 2);
151 onTimerOnChanged: topTimerRow.timerOn = timerOn;
152 }
153
154 // Multi-function button (Preset, Start, Stop, Done)
155 Button {
156 id: buttonTimer
157
158 width: units.gu(12); height: units.gu(5)
159 anchors { top: analogTimer.bottom; topMargin: units.gu(8); horizontalCenter: parent.horizontalCenter }
160 color: Constants.brightWhite
161 visible: timerPage.state == "ADDPRESET" ? false : true;
162
163 text: i18n.tr("Presets")
164131
165 states:[132 states:[
166 State {133 State { name: "STOP" },
167 name: "START"
168 when: ((seconds != 0 || minutes != 0 || hours != 0) && timerOn == false)
169 PropertyChanges { target: buttonTimer; color: Constants.ubuntuOrange; text: i18n.tr("Start") }
170 PropertyChanges { target: analogTimer; timerHandColor: Constants.ubuntuOrange }
171 PropertyChanges { target: analogTimer; glowColor: Constants.analogClockFaceGlowColor }
172 },
173
174 State {
175 name: "STOP"
176 PropertyChanges { target: buttonTimer; color: Constants.darkGrey; text: i18n.tr("Stop") }
177 PropertyChanges { target: analogTimer; timerHandColor: Constants.ubuntuOrange }
178 PropertyChanges { target: analogTimer; glowColor: Constants.analogClockFaceGlowColor }
179 },
180
181 State {134 State {
182 name: "DONE"135 name: "DONE"
183 when: (totalTime == -1 && timerOn == false)136 when: (totalTime == -1 && timerOn == false)
184 PropertyChanges { target: buttonTimer; color: Constants.green; text: i18n.tr("Done") }
185 PropertyChanges { target: analogTimer; timerHandColor: Constants.green }
186 PropertyChanges { target: analogTimer; glowColor: Constants.analogClockFaceGlowColorTimerDown }137 PropertyChanges { target: analogTimer; glowColor: Constants.analogClockFaceGlowColorTimerDown }
187 }138 }
188 ]139 ]
189140
190 onClicked: {141 onClicked: {
191 switch (buttonTimer.state) {142 switch (analogTimer.state) {
143
192 case "":144 case "":
193 timerAnimationContainer.swipeView()
194 break;
195
196 case "START":
197 totalTime = totalSeconds(hours, minutes, seconds);145 totalTime = totalSeconds(hours, minutes, seconds);
198 analogTimer.startTime = new Date();146 analogTimer.startTime = new Date();
199 timerOn = true;147 timerOn = true;
@@ -205,12 +153,14 @@
205 break;153 break;
206154
207 case "STOP":155 case "STOP":
208 timerOn = false;156 timerOn = false;
209 reset();157 reset();
158 state = "";
210 break;159 break;
211160
212 case "DONE":161 case "DONE":
213 reset();162 reset();
163 state = "";
214 break;164 break;
215 }165 }
216 }166 }
@@ -222,25 +172,35 @@
222172
223 height: childrenRect.height173 height: childrenRect.height
224 visible: timerPage.state == "ADDPRESET" ? false : true;174 visible: timerPage.state == "ADDPRESET" ? false : true;
225 anchors { left: parent.left; right: parent.right; top: buttonTimer.bottom; topMargin: units.gu(5) }175 anchors { left: parent.left; right: parent.right; top: analogTimer.bottom; topMargin: units.gu(13) }
226176
227 ListItem.Divider { }177 ListItem.ThinDivider { }
228178
229 ListItem.Header { text: i18n.tr("Saved Presets") }179 ListItem.Header {
180 Label {
181 text: i18n.tr("Presets")
182 anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: units.gu(2) }
183 fontSize: "medium"
184 }
185 }
230186
231 ListView {187 ListView {
232 id: listTimerPreset188 id: listTimerPreset
233189
234 anchors { left: parent.left; right: parent.right }190 anchors { left: parent.left; right: parent.right }
235 height: units.gu(35)191 height: units.gu(21)
236 model: presetModel192 model: presetModel
237 currentIndex: -1193 currentIndex: -1
238194
239 delegate: ListItem.Standard {195 delegate: ListItem.Standard {
240 text: label196 Label {
197 fontSize: "large";
198 text: label
199 anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: units.gu(3) }
200 }
241201
242 Label {202 Label {
243 fontSize: "medium"203 fontSize: "large"
244 text: getstringTimer(seconds);204 text: getstringTimer(seconds);
245 anchors { verticalCenter: parent.verticalCenter; right: parent.right; rightMargin: units.gu(2) }205 anchors { verticalCenter: parent.verticalCenter; right: parent.right; rightMargin: units.gu(2) }
246 }206 }
@@ -259,8 +219,7 @@
259 }219 }
260220
261 onClicked: {221 onClicked: {
262 if (!timerOn) {222 if (!timerOn) {
263 buttonTimer.state = "START";
264 analogTimer.ssToTime(seconds);223 analogTimer.ssToTime(seconds);
265 listTimerPreset.currentIndex = index224 listTimerPreset.currentIndex = index
266 }225 }
@@ -275,18 +234,17 @@
275234
276 width: units.gu(12); height: units.gu(12)235 width: units.gu(12); height: units.gu(12)
277 radius: width / 2236 radius: width / 2
278 anchors.centerIn: analogTimer237 anchors.centerIn: analogTimer
279 border.color: Constants.normalGrey238 color: "transparent"
280 color: "#F8F8F8"
281 antialiasing: true239 antialiasing: true
282 visible: false240 visible: false
283241
284 Label {242 Label {
285 id: addPresetTextDone243 id: addPresetTextDone
286244
287 anchors.centerIn: parent245 //anchors.centerIn: parent
288 color: Constants.green246 color: Constants.green
289 fontSize: "large"247 fontSize: "x-large"
290248
291 text: i18n.tr("DONE")249 text: i18n.tr("DONE")
292 }250 }

Subscribers

People subscribed via source and target branches