Merge lp:~nik90/ubuntu-clock-app/fix-bug-1172865 into lp:ubuntu-clock-app/saucy

Proposed by Nekhelesh Ramananthan
Status: Merged
Approved by: Nekhelesh Ramananthan
Approved revision: 47
Merged at revision: 41
Proposed branch: lp:~nik90/ubuntu-clock-app/fix-bug-1172865
Merge into: lp:ubuntu-clock-app/saucy
Diff against target: 394 lines (+156/-59)
2 files modified
timer/TimerPage.qml (+136/-53)
timer/TimerScript.js (+20/-6)
To merge this branch: bzr merge lp:~nik90/ubuntu-clock-app/fix-bug-1172865
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Ubuntu Clock Developers Pending
Review via email: mp+161288@code.launchpad.net

Commit message

Fixes issues related to the timer label, button timer preset and a high priority bug related to the timer stopping/resetting when the user views the saved presets.

Description of the change

Fixes issues related to the timer label, button timer preset and a high priority bug related to the timer stopping/resetting when the user views the saved presets. This MP fixes 3 bugs because they interconnected to one other.

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)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'timer/TimerPage.qml'
2--- timer/TimerPage.qml 2013-04-24 19:38:06 +0000
3+++ timer/TimerPage.qml 2013-04-27 12:34:27 +0000
4@@ -36,6 +36,7 @@
5 property int timerValue: 0;
6 property int lastindex: -1;
7 property string selectItemPreset: "";
8+ property string viewState: "TIMER"
9
10 Component.onCompleted: {
11 Utils.log("TimerPage loaded");
12@@ -75,8 +76,8 @@
13 }
14
15 onReleased: {
16+ // Swipe up condition
17 if (yStart - mouseY > timerSwipeArea.swipeLength) {
18- TScript.resetAll();
19 TScript.showTimerPage(false);
20 TScript.showAddPresetPage(false);
21 TScript.showViewPresetPage(true);
22@@ -91,10 +92,15 @@
23 toolbarTimer.active = false;
24 }
25
26+ // Swipe down condition
27 if (yStart - mouseY < -timerSwipeArea.swipeLength) {
28- TScript.resetAll();
29 TScript.showAddPresetPage(false);
30 TScript.showViewPresetPage(false);
31+
32+ if(!timerOn) {
33+ TScript.resetAll()
34+ }
35+
36 TScript.showTimerPage(true);
37
38 addPreset.visible = true;
39@@ -126,7 +132,7 @@
40 // flag boolean variable to determine if the timer hand adjusts the hours or not
41 property bool flag: false
42
43- color: Constants.normalGrey
44+ color: Constants.darkGrey
45 fontSize: "x-large"
46 text: i18n.tr("00")
47 visible: {
48@@ -142,13 +148,15 @@
49 anchors.fill: parent
50
51 onClicked: {
52- timerHand.rotationAngle = hours * 6;
53- hourslabelTimer.color = Constants.ubuntuOrange;
54- hourslabelTimer.flag = true;
55- secondslabelTimer.color = Constants.normalGrey;
56- secondslabelTimer.flag = false;
57- minuteslabelTimer.color = Constants.normalGrey;
58- minuteslabelTimer.flag = false;
59+ if (!timerOn && viewState != "SAVEDPRESETS") {
60+ timerHand.rotationAngle = hours * 6;
61+ hourslabelTimer.color = Constants.ubuntuOrange;
62+ hourslabelTimer.flag = true;
63+ secondslabelTimer.color = Constants.darkGrey;
64+ secondslabelTimer.flag = false;
65+ minuteslabelTimer.color = Constants.darkGrey;
66+ minuteslabelTimer.flag = false;
67+ }
68 }
69 }
70 }
71@@ -156,7 +164,7 @@
72 Label {
73 id: colonTimer1
74
75- color: Constants.normalGrey
76+ color: Constants.darkGrey
77 visible: {
78 if (hourslabelTimer.visible) {
79 true
80@@ -176,7 +184,7 @@
81 // flag boolean variable to determine if the timer hand adjusts the minutes or not
82 property bool flag: false
83
84- color: Constants.normalGrey
85+ color: Constants.darkGrey
86 fontSize: "x-large"
87
88 text: i18n.tr("00")
89@@ -185,13 +193,15 @@
90 anchors.fill: parent
91
92 onClicked: {
93- timerHand.rotationAngle = minutes * 6;
94- minuteslabelTimer.color = Constants.ubuntuOrange;
95- minuteslabelTimer.flag = true;
96- secondslabelTimer.color = Constants.normalGrey;
97- secondslabelTimer.flag = false;
98- hourslabelTimer.color = Constants.normalGrey;
99- hourslabelTimer.flag = false;
100+ if (!timerOn && viewState != "SAVEDPRESETS") {
101+ timerHand.rotationAngle = minutes * 6;
102+ minuteslabelTimer.color = Constants.ubuntuOrange;
103+ minuteslabelTimer.flag = true;
104+ secondslabelTimer.color = Constants.darkGrey;
105+ secondslabelTimer.flag = false;
106+ hourslabelTimer.color = Constants.darkGrey;
107+ hourslabelTimer.flag = false;
108+ }
109 }
110 }
111 }
112@@ -199,7 +209,7 @@
113 Label {
114 id: colonTimer2
115
116- color: Constants.normalGrey
117+ color: Constants.darkGrey
118 fontSize: "x-large"
119
120 text: i18n.tr(":")
121@@ -220,13 +230,15 @@
122 anchors.fill: parent
123
124 onClicked: {
125- timerHand.rotationAngle = seconds * 6;
126- secondslabelTimer.color = Constants.ubuntuOrange;
127- secondslabelTimer.flag = true;
128- minuteslabelTimer.color = Constants.normalGrey;
129- minuteslabelTimer.flag = false;
130- hourslabelTimer.color = Constants.normalGrey;
131- hourslabelTimer.flag = false;
132+ if (!timerOn && viewState != "SAVEDPRESETS") {
133+ timerHand.rotationAngle = seconds * 6;
134+ secondslabelTimer.color = Constants.ubuntuOrange;
135+ secondslabelTimer.flag = true;
136+ minuteslabelTimer.color = Constants.darkGrey;
137+ minuteslabelTimer.flag = false;
138+ hourslabelTimer.color = Constants.darkGrey;
139+ hourslabelTimer.flag = false;
140+ }
141 }
142 }
143 }
144@@ -666,16 +678,19 @@
145 if (totalTime > 0) {
146 timerPage.timerOn = true;
147 state = "STOP";
148+ buttonTimerPreset.state = "STOP"
149 }
150 break;
151 case "Stop":
152 timerPage.timerOn = false;
153+ state = "PRESETS";
154+ buttonTimerPreset.state = "PRESETS"
155 TScript.resetAll();
156- state = "PRESETS";
157 break;
158 case "Done":
159+ state = "PRESETS";
160+ buttonTimerPreset.state = "PRESETS"
161 TScript.resetAll();
162- state = "PRESETS";
163 break;
164 }
165 }
166@@ -691,18 +706,47 @@
167 top: parent.top
168 topMargin: units.gu(14)
169 }
170- color: Constants.ubuntuOrange
171-
172- text: i18n.tr("Start")
173+ color: Constants.brightWhite
174+
175+ text: i18n.tr("Presets")
176+
177+ states:[
178+ State {
179+ name: "PRESETS"
180+ PropertyChanges { target: buttonTimerPreset; color: Constants.brightWhite; text: i18n.tr("Presets") }
181+ PropertyChanges { target: hourslabelTimer; color: Constants.darkGrey }
182+ PropertyChanges { target: minuteslabelTimer; color: Constants.darkGrey }
183+ PropertyChanges { target: secondslabelTimer; color: Constants.darkGrey }
184+ PropertyChanges { target: colonTimer1; color: Constants.darkGrey }
185+ PropertyChanges { target: colonTimer2; color: Constants.darkGrey }
186+ },
187+
188+ State {
189+ name: "START"
190+ PropertyChanges { target: buttonTimerPreset; color: Constants.ubuntuOrange; text: i18n.tr("Start") }
191+ },
192+
193+ State {
194+ name: "STOP"
195+ PropertyChanges { target: buttonTimerPreset; color: Constants.darkGrey; text: i18n.tr("Stop") }
196+ },
197+
198+ State {
199+ name: "DONE"
200+ PropertyChanges { target: buttonTimerPreset; color: Constants.green; text: i18n.tr("Done") }
201+ }
202+ ]
203
204 onClicked: {
205- TScript.prepareStartTimer();
206- if (hourslabelTimer.text != '00' || minuteslabelTimer.text != '00' || secondslabelTimer.text != '00') {
207- timerPage.timerOn = true;
208- buttonTimer.state = "STOP";
209-
210+ switch (text) {
211+ case "Presets":
212 TScript.showAddPresetPage(false);
213 TScript.showViewPresetPage(false);
214+
215+ if (!timerOn) {
216+ TScript.resetAll();
217+ }
218+
219 TScript.showTimerPage(true);
220
221 addPreset.visible = true;
222@@ -712,6 +756,38 @@
223 toolbarTimer.back.visible = false;
224 toolbarTimer.lock = false;
225 toolbarTimer.active = false;
226+ break;
227+ case "Start":
228+ if (hourslabelTimer.text != '00' || minuteslabelTimer.text != '00' || secondslabelTimer.text != '00') {
229+ TScript.prepareStartTimer();
230+ timerPage.timerOn = true;
231+ buttonTimer.state = "STOP";
232+ buttonTimerPreset.state = "STOP";
233+
234+ TScript.showAddPresetPage(false);
235+ TScript.showViewPresetPage(false);
236+ TScript.showTimerPage(true);
237+
238+ addPreset.visible = true;
239+ editPreset.visible = true;
240+ deletePreset.visible = false;
241+
242+ toolbarTimer.back.visible = false;
243+ toolbarTimer.lock = false;
244+ toolbarTimer.active = false;
245+ }
246+ break;
247+ case "Stop":
248+ timerPage.timerOn = false;
249+ buttonTimer.state = "PRESETS";
250+ buttonTimerPreset.state = "PRESETS"
251+ TScript.resetAll();
252+ TScript.showViewPresetPage(true)
253+ break;
254+ case "Done":
255+ buttonTimer.state = "PRESETS";
256+ buttonTimerPreset.state = "PRESETS"
257+ break;
258 }
259 }
260 }
261@@ -741,16 +817,19 @@
262 value: TScript.getstringTimer(secondstimer)
263 selected: select
264 onClicked: {
265- TScript.setlabelTimer(secondstimer);
266- if (lastindex == -1) {
267- listModel.setProperty(index, "select", true)
268- lastindex = index;
269- } else if (lastindex != index) {
270- listModel.setProperty(lastindex, "select", false)
271- listModel.setProperty(index, "select", true)
272- lastindex = index;
273+ if (!timerOn) {
274+ buttonTimerPreset.state = "START";
275+ TScript.setlabelTimer(secondstimer);
276+ if (lastindex == -1) {
277+ listModel.setProperty(index, "select", true)
278+ lastindex = index;
279+ } else if (lastindex != index) {
280+ listModel.setProperty(lastindex, "select", false)
281+ listModel.setProperty(index, "select", true)
282+ lastindex = index;
283+ }
284+ selectItemPreset = text;
285 }
286- selectItemPreset = text;
287 }
288 }
289 }
290@@ -834,13 +913,14 @@
291 visible: false
292
293 onTriggered: {
294- if (selectItemPreset != "") {
295- storageTimer.delTimerValue(selectItemPreset);
296- TScript.populatePreset();
297+ if (!timerOn) {
298+ if (selectItemPreset != "") {
299+ storageTimer.delTimerValue(selectItemPreset);
300+ TScript.populatePreset();
301+ }
302+ TScript.resetAll();
303+ TScript.showViewPresetPage(true);
304 }
305- TScript.resetAll();
306- TScript.showViewPresetPage(true);
307-
308 }
309 }
310
311@@ -851,7 +931,10 @@
312 TScript.showAddPresetPage(false);
313 TScript.showViewPresetPage(false);
314 TScript.showTimerPage(true);
315- TScript.resetAll();
316+
317+ if (!timerOn) {
318+ TScript.resetAll();
319+ }
320
321 addPreset.visible = true;
322 editPreset.visible = true;
323
324=== modified file 'timer/TimerScript.js'
325--- timer/TimerScript.js 2013-04-22 10:35:46 +0000
326+++ timer/TimerScript.js 2013-04-27 12:34:27 +0000
327@@ -43,6 +43,7 @@
328 setlabelTimer(timerPage.totalTime);
329 } else {
330 buttonTimer.state = "DONE";
331+ buttonTimerPreset.state = "DONE";
332 timerPage.timerOn = false;
333 }
334 }
335@@ -85,19 +86,19 @@
336 // Restore timer to its original state
337 function resetAll () {
338 hourslabelTimer.text = "00";
339- hourslabelTimer.color = normalGrey;
340+ hourslabelTimer.color = darkGrey;
341 hourslabelTimer.flag = false;
342
343 minuteslabelTimer.text = "00";
344- minuteslabelTimer.color = normalGrey;
345+ minuteslabelTimer.color = darkGrey;
346 minuteslabelTimer.flag = false;
347
348 secondslabelTimer.text = "00";
349 secondslabelTimer.color = ubuntuOrange;
350 secondslabelTimer.flag = true;
351
352- colonTimer1.color = normalGrey;
353- colonTimer2.color = normalGrey;
354+ colonTimer1.color = darkGrey;
355+ colonTimer2.color = darkGrey;
356
357 timerPage.hours = 0;
358 timerPage.minutes = 0;
359@@ -116,6 +117,10 @@
360 function showTimerPage ( mode ) {
361 clockOuterCircle.visible = mode;
362 buttonTimer.visible = mode;
363+
364+ if (mode) {
365+ timerPage.viewState = "TIMER";
366+ }
367 }
368
369 // Show/Hide Add Preset Page
370@@ -123,14 +128,23 @@
371 clockOuterCircle.visible = mode;
372 addPresetCircleDone.visible = mode;
373 namePreset.visible = mode;
374+
375+ if (mode) {
376+ timerPage.viewState = "ADDPRESET";
377+ }
378 }
379
380 // Show/Hide View Preset Page
381 function showViewPresetPage ( mode ) {
382 buttonTimerPreset.visible = mode;
383 listPreset.visible = mode;
384- if (mode == true) {
385- secondslabelTimer.color = normalGrey;
386+
387+ if (mode) {
388+ timerPage.viewState = "SAVEDPRESETS";
389+ }
390+
391+ if (mode == true && !timerOn) {
392+ secondslabelTimer.color = darkGrey;
393 }
394 }
395

Subscribers

People subscribed via source and target branches