Merge lp:~nik90/ubuntu-clock-app/new-preset-designs into lp:ubuntu-clock-app/saucy
- new-preset-designs
- Merge into saucy
Status: | Merged |
---|---|
Approved by: | Nekhelesh Ramananthan |
Approved revision: | 194 |
Merged at revision: | 179 |
Proposed branch: | lp:~nik90/ubuntu-clock-app/new-preset-designs |
Merge into: | lp:ubuntu-clock-app/saucy |
Diff against target: |
807 lines (+226/-209) 10 files modified
common/AnalogGlowEffect.qml (+1/-1) common/ClockUtils.js (+18/-0) stopwatch/StopwatchPage.qml (+3/-3) stopwatch/StopwatchSupport.js (+2/-2) tests/autopilot/ubuntu_clock_app/emulators.py (+5/-13) tests/autopilot/ubuntu_clock_app/tests/test_timer.py (+30/-17) timer/AnalogTimer.qml (+2/-12) timer/PresetTimersModel.qml (+23/-5) timer/TimerPage.qml (+133/-139) ubuntu-clock-app.qml (+9/-17) |
To merge this branch: | bzr merge lp:~nik90/ubuntu-clock-app/new-preset-designs |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Nicholas Skaggs (community) | Approve | ||
Review via email: mp+179466@code.launchpad.net |
Commit message
Implemented the new timer preset designs.
Description of the change
Implements the new timer preset designs. Only the autopilot tests needs to be fixed now.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:186
http://
Executed test runs:
UNSTABLE: http://
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 : | # |
FAILED: Continuous integration, rev:187
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Nicholas Skaggs (nskaggs) wrote : | # |
Nekhelesh, is this the same issue as before with the saved timer? I remember looking at this. I take it since it's still here unsolved you've done everything you could from an application standpoint and came up empty as to why it fails with a saved timer preset.
I'll review the test and see if something new strikes me
Nicholas Skaggs (nskaggs) wrote : | # |
I'm not sure what the previous issue was, but this is simply a timing issue. I created a loop to fix it; checking the animation on the page isn't enough, so it's ignored
Here's the "loop" version, ideally you should place this in a function since you might be doing similar things elsewhere
label = self.main_
timeout = 0
while label.focus != True and timeout < 10:
timeout += 1
Here's what I meant by checking the animation:
label = self.main_
timeout = 0
while label.focus != True and timeout < 10:
timeout += 1
Implement the polling loop and we should be good to merge
Nicholas Skaggs (nskaggs) wrote : | # |
Sorry, double copy paste hah! Here's the animation check that doesn't work;
timer_page = self.main_
Nekhelesh Ramananthan (nik90) wrote : | # |
> Nekhelesh, is this the same issue as before with the saved timer? I remember
> looking at this. I take it since it's still here unsolved you've done
> everything you could from an application standpoint and came up empty as to
> why it fails with a saved timer preset.
>
> I'll review the test and see if something new strikes me
Yes I looked at it from an application point of view and also looked at autopilot vis as you suggested but was unable to identify the problem. Thanks for the fix. The tests now pass on my computer. How do you identify such issues?
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:189
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Nekhelesh Ramananthan (nik90) wrote : | # |
Top approving to trigger a rebuild.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Nekhelesh Ramananthan (nik90) wrote : | # |
okay so jenkins has 3 failing tests (2 Timer and 1 Stopwatch). On running again on my machine, the stopwatch test is the only one which fails for me despite me not making any changes to stopwatch application code *and* test_stopwatch.py. This is weird.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:190
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Nekhelesh Ramananthan (nik90) wrote : | # |
Top approving to trigger a rebuild.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:191
http://
Executed test runs:
UNSTABLE: http://
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:173
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
David Planella (dpm) wrote : | # |
I don't want to block this from landing, as it's been pending review for a while, but I've noticed a couple of things related to time localization:
31 + var locale = Qt.locale();
It seems the locale variable is not really used in that function.
34 + return zeroleft(hours, 2) + ":" + zeroleft(minutes, 2) + ":" + zeroleft(seconds, 2);
Is there not a more locale-friendly version than zeroleft + hardcoding ":". If we cannot use the locale's default, can we not use a Qt locale string and set a format by default (e.g. "hh:mm:ss") and ask translators to translate that if they require? In my locale, for example, we define HH.MM.SS instead of HH:MM:SS.
David Planella (dpm) wrote : | # |
I've added it as a comment, so that we can track record of it and if necessary fix later, but if possible, it'd be nice to address it in one go.
Nicholas Skaggs (nskaggs) : | # |
Nekhelesh Ramananthan (nik90) wrote : | # |
I need to fix one small thing because of previous merges to trunk.
Nekhelesh Ramananthan (nik90) wrote : | # |
Ready to merge now :)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
Unapproved changes made after approval.
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:194
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'common/AnalogGlowEffect.qml' |
2 | --- common/AnalogGlowEffect.qml 2013-07-14 12:33:25 +0000 |
3 | +++ common/AnalogGlowEffect.qml 2013-09-03 19:22:58 +0000 |
4 | @@ -28,7 +28,7 @@ |
5 | anchors.fill: fillRectangle |
6 | glowRadius: 10 |
7 | spread: 0.8 |
8 | - color: glowColor |
9 | + color: "orange" |
10 | cornerRadius: fillRectangle.radius |
11 | z: fillRectangle - 1 |
12 | } |
13 | |
14 | === modified file 'common/ClockUtils.js' |
15 | --- common/ClockUtils.js 2013-07-23 19:41:29 +0000 |
16 | +++ common/ClockUtils.js 2013-09-03 19:22:58 +0000 |
17 | @@ -51,8 +51,26 @@ |
18 | return Number(num).toLocaleString(Qt.locale(), "f", 0) |
19 | } |
20 | |
21 | +// Function to convert time into a proper string format |
22 | function hmsToString(hours, minutes, seconds) |
23 | { |
24 | var timeString = zeroleft(hours, 2) + ":" + zeroleft(minutes, 2) + ":" + zeroleft(seconds, 2); |
25 | return timeString; |
26 | } |
27 | + |
28 | +// Function to print timer label (format mm:ss and hh:mm:ss when hh > 0) at top |
29 | +function intervalToString(hours, minutes, seconds) |
30 | +{ |
31 | + var locale = Qt.locale(); |
32 | + |
33 | + if (hours > 0) { |
34 | + return zeroleft(hours, 2) + ":" + zeroleft(minutes, 2) + ":" + zeroleft(seconds, 2); |
35 | + } else { |
36 | + return zeroleft(minutes, 2) + ":" + zeroleft(seconds, 2); |
37 | + } |
38 | +} |
39 | + |
40 | +// Function to return total seconds. |
41 | +function totalSeconds(hours, minutes, seconds) { |
42 | + return( (hours * 60 * 60) + (minutes * 60) + seconds ); |
43 | +} |
44 | |
45 | === renamed file 'images/edit_icon@8.png' => 'images/edit_icon@16.png' |
46 | === modified file 'stopwatch/StopwatchPage.qml' |
47 | --- stopwatch/StopwatchPage.qml 2013-09-03 18:51:31 +0000 |
48 | +++ stopwatch/StopwatchPage.qml 2013-09-03 19:22:58 +0000 |
49 | @@ -42,7 +42,7 @@ |
50 | |
51 | interval: 100; |
52 | repeat: true; |
53 | - onTriggered: labelStopwatch.text = SScript.intervalToString(analogStopwatch.hours, analogStopwatch.minutes, analogStopwatch.seconds, analogStopwatch.milliseconds) |
54 | + onTriggered: labelStopwatch.text = SScript.timeToString(analogStopwatch.hours, analogStopwatch.minutes, analogStopwatch.seconds, analogStopwatch.milliseconds) |
55 | } |
56 | |
57 | ListModel { |
58 | @@ -80,7 +80,7 @@ |
59 | color: Theme.palette.normal.baseText |
60 | |
61 | fontSize: "x-large" |
62 | - text: labelStopwatch.text = SScript.intervalToString(analogStopwatch.hours, analogStopwatch.minutes, analogStopwatch.seconds, analogStopwatch.milliseconds) |
63 | + text: labelStopwatch.text = SScript.timeToString(analogStopwatch.hours, analogStopwatch.minutes, analogStopwatch.seconds, analogStopwatch.milliseconds) |
64 | } |
65 | } |
66 | |
67 | @@ -125,7 +125,7 @@ |
68 | onClicked: { |
69 | analogStopwatch.stop() |
70 | analogStopwatch.reset(); |
71 | - labelStopwatch.text = SScript.intervalToString(0, 0, 0, 0); |
72 | + labelStopwatch.text = SScript.timeToString(0, 0, 0, 0); |
73 | lapStart = 0; |
74 | laps.clear(); |
75 | } |
76 | |
77 | === modified file 'stopwatch/StopwatchSupport.js' |
78 | --- stopwatch/StopwatchSupport.js 2013-09-03 14:14:43 +0000 |
79 | +++ stopwatch/StopwatchSupport.js 2013-09-03 19:22:58 +0000 |
80 | @@ -36,7 +36,7 @@ |
81 | } |
82 | |
83 | // Function to print Stopwatch label (format mm:ss.ms and hh:mm:ss.ms when mm > 59) at top |
84 | -function intervalToString(hours, minutes, seconds, milliseconds) |
85 | +function timeToString(hours, minutes, seconds, milliseconds) |
86 | { |
87 | var locale = Qt.locale(); |
88 | |
89 | @@ -55,5 +55,5 @@ |
90 | // Function to calculate the current lap time |
91 | function currentLapLabel(now, lapStart) { |
92 | var current = msToTime(Math.abs(now - lapStart)); |
93 | - return intervalToString(current[0], current[1], current[2], current[3]); |
94 | + return timeToString(current[0], current[1], current[2], current[3]); |
95 | } |
96 | |
97 | === modified file 'tests/autopilot/ubuntu_clock_app/emulators.py' |
98 | --- tests/autopilot/ubuntu_clock_app/emulators.py 2013-08-07 22:16:18 +0000 |
99 | +++ tests/autopilot/ubuntu_clock_app/emulators.py 2013-09-03 19:22:58 +0000 |
100 | @@ -18,10 +18,6 @@ |
101 | |
102 | |
103 | class MainView(toolkit_emulators.MainView): |
104 | - def get_stopwatch_tab_button(self): |
105 | - """Returns the stopwatch tab.""" |
106 | - return self.select_single("AbstractButton", buttonIndex=3) |
107 | - |
108 | def get_stopwatch_label(self): |
109 | """Returns the select for the stopwatch label""" |
110 | return self.select_single("Label", objectName="labelStopwatch") |
111 | @@ -42,10 +38,6 @@ |
112 | """Returns the select for the lap count""" |
113 | return self.select_single("ListModel", objectName="laps") |
114 | |
115 | - def get_timer_tab_button(self): |
116 | - """Returns the timer tab.""" |
117 | - return self.select_single("AbstractButton", buttonIndex=2) |
118 | - |
119 | def get_toolbar_timer(self): |
120 | """Returns the toolbar of timer tab""" |
121 | return self.select_single("ToolbarItems") |
122 | @@ -58,7 +50,11 @@ |
123 | |
124 | def get_toolbar_timer_add_preset_button(self): |
125 | """Returns the button for add preset of toolbar of timer tab""" |
126 | - return self.get_toolbar_timer_button(1) |
127 | + return self.select_single('ActionItem', objectName="addPresetButton") |
128 | + |
129 | + def get_toolbar_timer_save_preset_button(self): |
130 | + """Returns the button for add preset of toolbar of timer tab""" |
131 | + return self.select_single("ActionItem", objectName="savePresetButton") |
132 | |
133 | def get_timer_name_preset(self): |
134 | """Returns the TextField where insert the name of the preset""" |
135 | @@ -68,10 +64,6 @@ |
136 | """Returns the hour hand of clock in timer tab""" |
137 | return self.select_single("AnalogTouchHand", objectName="hourHand") |
138 | |
139 | - def get_timer_clock_center_label(self): |
140 | - """Returns the label in the center of clock""" |
141 | - return self.select_single("Label", objectName="addPresetTextDone") |
142 | - |
143 | def get_preset_label_text(self): |
144 | """Returns the label with the preset text""" |
145 | preset = self.select_many("Label", objectName="presetTextLabel") |
146 | |
147 | === modified file 'tests/autopilot/ubuntu_clock_app/tests/test_timer.py' |
148 | --- tests/autopilot/ubuntu_clock_app/tests/test_timer.py 2013-08-14 02:04:30 +0000 |
149 | +++ tests/autopilot/ubuntu_clock_app/tests/test_timer.py 2013-09-03 19:22:58 +0000 |
150 | @@ -37,10 +37,8 @@ |
151 | self.main_view.visible, Eventually(Equals(True))) |
152 | |
153 | #move to timer tab |
154 | - #ignoring the emulator tab functions until fixed |
155 | self.main_view.switch_to_tab("TimerTab") |
156 | |
157 | - |
158 | def drag_page_up_to_show_input_box(self): |
159 | timerFunc = lambda: self.main_view.select_single("TimerPage") |
160 | self.assertThat(timerFunc, Eventually(Not(Is(None)))) |
161 | @@ -70,6 +68,15 @@ |
162 | timer_page.select_single("AnimationContainer").moving, |
163 | Eventually(Equals(False))) |
164 | |
165 | + def select_name_preset_label(self): |
166 | + label = self.main_view.get_timer_name_preset() |
167 | + timeout = 0 |
168 | + while label.focus != True and timeout < 10: |
169 | + self.pointing_device.click_object(label) |
170 | + sleep(1) |
171 | + timeout += 1 |
172 | + return label |
173 | + |
174 | def test_add_preset(self): |
175 | """Test to check if button to add a preset working""" |
176 | |
177 | @@ -81,15 +88,11 @@ |
178 | add_preset_button = self.main_view.get_toolbar_timer_add_preset_button() |
179 | self.pointing_device.click_object(add_preset_button) |
180 | |
181 | - #For now close the toolbar due to https://bugs.launchpad.net/ubuntu-clock-app/+bug/1209024 |
182 | - self.main_view.close_toolbar() |
183 | - |
184 | # Write in the label |
185 | if model() != "Desktop": |
186 | self.drag_page_up_to_show_input_box() |
187 | self.assertThat(self.main_view.get_timer_name_preset, Eventually(Not(Is(None)))) |
188 | - label = self.main_view.get_timer_name_preset() |
189 | - self.pointing_device.click_object(label) |
190 | + label = self.select_name_preset_label() |
191 | self.assertThat(label.focus, Eventually(Equals(True))) |
192 | self.keyboard.type("test") |
193 | self.assertThat(label.text, Eventually(Equals("test"))) |
194 | @@ -107,10 +110,11 @@ |
195 | |
196 | self.assertThat(self.main_view.get_num_of_presets, Eventually(Not(Is(None)))) |
197 | num_of_presets_old = self.main_view.get_num_of_presets() |
198 | - # Press "Done" button |
199 | - self.assertThat(self.main_view.get_timer_clock_center_label, Eventually(Not(Is(None)))) |
200 | - label = self.main_view.get_timer_clock_center_label() |
201 | - self.pointing_device.click_object(label) |
202 | + |
203 | + # Press "Save" toolbar button |
204 | + self.assertThat(self.main_view.get_toolbar_timer_save_preset_button, Eventually(Not(Is(None)))) |
205 | + save_preset_button = self.main_view.get_toolbar_timer_save_preset_button() |
206 | + self.pointing_device.click_object(save_preset_button) |
207 | |
208 | # Check if the preset has been saved |
209 | self.assertThat(self.main_view.get_num_of_presets, |
210 | @@ -133,11 +137,15 @@ |
211 | x, y, w, h = first_preset.globalRect |
212 | tx = x + (w / 8) |
213 | ty = y + (h / 2) |
214 | - self.pointing_device.drag(tx, ty, w - w / 8, ty) |
215 | + timeout = 0 |
216 | + while self.main_view.get_num_of_presets() != num_of_presets_old-1 and timeout < 10: |
217 | + self.pointing_device.drag(tx, ty, w - w / 8, ty) |
218 | + sleep(1) |
219 | + timeout += 1 |
220 | |
221 | # Check has been deleted |
222 | self.assertThat(self.main_view.get_num_of_presets, |
223 | - Eventually(Equals(num_of_presets_old-1))) |
224 | + Eventually(Equals(num_of_presets_old-1))) |
225 | |
226 | def test_run_preset(self): |
227 | """Tests if a preset can runs""" |
228 | @@ -156,11 +164,16 @@ |
229 | self.drag_page_down_to_previous_state() |
230 | |
231 | # Click to start the preset |
232 | - self.assertThat(self.main_view.get_timer_clock_center_label, Eventually(Not(Is(None)))) |
233 | - label = self.main_view.get_timer_clock_center_label() |
234 | - self.pointing_device.click_object(label) |
235 | - |
236 | + self.assertThat(self.main_view.get_label_timer, Eventually(Not(Is(None)))) |
237 | + timeout = 0 |
238 | + while self.main_view.get_label_timer() == None and timeout < 10: |
239 | + label = self.main_view.get_label_timer() |
240 | + self.pointing_device.click_object(label) |
241 | + sleep(1) |
242 | + timeout += 1 |
243 | + |
244 | # Check if timer is started |
245 | self.assertThat(self.main_view.get_label_timer, Eventually(Not(Is(None)))) |
246 | label_timer = self.main_view.get_label_timer() |
247 | + self.pointing_device.click_object(label_timer) |
248 | self.assertThat(label_timer.text, Eventually(NotEquals("23:00:00"))) |
249 | |
250 | === modified file 'timer/AnalogTimer.qml' |
251 | --- timer/AnalogTimer.qml 2013-07-20 08:06:19 +0000 |
252 | +++ timer/AnalogTimer.qml 2013-09-03 19:22:58 +0000 |
253 | @@ -38,9 +38,6 @@ |
254 | property bool timerOn: false; |
255 | property bool inProgressFlag |
256 | |
257 | - property color glowColor: "orange" |
258 | - property alias showGlow: glowEffect.visible; |
259 | - |
260 | // Timer function called by the main clock loop |
261 | function onTimerUpdate () { |
262 | if( timerOn ) { |
263 | @@ -69,19 +66,12 @@ |
264 | // Function to disable timer and reset time |
265 | function reset() { |
266 | timerOn = false; |
267 | + state = ""; |
268 | startTime = remTime = pauseTime = 0; |
269 | hourHand.rotationValue = minuteHand.rotationValue = secondHand.rotationValue = 0; |
270 | hours = minutes = seconds = totalTime = 0; |
271 | hourHand.timerValue = minuteHand.timerValue = secondHand.timerValue = 0; |
272 | - } |
273 | - |
274 | - AnalogGlowEffect { |
275 | - id: glowEffect |
276 | - |
277 | - z: parent.z - 1 |
278 | - visible: false; |
279 | - fillRectangle: parent |
280 | - } |
281 | + } |
282 | |
283 | Repeater { |
284 | model: 12 |
285 | |
286 | === modified file 'timer/PresetTimersModel.qml' |
287 | --- timer/PresetTimersModel.qml 2013-05-25 11:59:43 +0000 |
288 | +++ timer/PresetTimersModel.qml 2013-09-03 19:22:58 +0000 |
289 | @@ -29,16 +29,34 @@ |
290 | readonly property string dbVersion: "0.1" |
291 | readonly property string dbDescription: "Preset timers" |
292 | |
293 | - property var _db: null |
294 | + property var _db: null |
295 | |
296 | Component.onCompleted: { |
297 | _loadDB() |
298 | } |
299 | |
300 | - function appendPreset(label, seconds) |
301 | + function appendPreset(oldlabel, label, seconds, index) |
302 | { |
303 | - if (_appendDB(label, seconds)) { |
304 | - model.append({"label" : label, "seconds" : seconds}) |
305 | + // Adding a new timer preset |
306 | + if (index == -1) { |
307 | + if (_appendDB(label, seconds)) |
308 | + model.append({"label" : label, "seconds" : seconds}) |
309 | + } |
310 | + |
311 | + // Editing an existing timer preset |
312 | + else { |
313 | + model.set(index, {"label" : label, "seconds" : seconds}); |
314 | + |
315 | + // Checking if name of existing timer preset has been changed. |
316 | + // If not changed, just update existing storage record |
317 | + if (oldlabel == label) { |
318 | + _appendDB(label, seconds) |
319 | + } |
320 | + // If name has been changed, delete old record and create new storage record. |
321 | + else { |
322 | + _removeDB(oldlabel) |
323 | + _appendDB(label, seconds) |
324 | + } |
325 | } |
326 | } |
327 | |
328 | @@ -76,7 +94,7 @@ |
329 | if (res.rows.length > 0) { |
330 | for (var i = 0; i < res.rows.length; i++) { |
331 | model.append({"label" : res.rows.item(i).label, |
332 | - "seconds" : res.rows.item(i).seconds}); |
333 | + "seconds" : res.rows.item(i).seconds}); |
334 | } |
335 | } |
336 | }); |
337 | |
338 | === modified file 'timer/TimerPage.qml' |
339 | --- timer/TimerPage.qml 2013-09-03 17:40:05 +0000 |
340 | +++ timer/TimerPage.qml 2013-09-03 19:22:58 +0000 |
341 | @@ -20,6 +20,7 @@ |
342 | import QtQuick 2.0 |
343 | import Ubuntu.Components 0.1 |
344 | import Ubuntu.Components.ListItems 0.1 as ListItem |
345 | +import Ubuntu.Components.Themes.Ambiance 0.1 |
346 | import "../common" |
347 | import "../common/ClockUtils.js" as Utils |
348 | |
349 | @@ -33,31 +34,40 @@ |
350 | property alias seconds: analogTimer.seconds; |
351 | property alias totalTime: analogTimer.totalTime; |
352 | property alias timerOn: analogTimer.timerOn; |
353 | + property string tempNamePreset |
354 | + property int pagePostion |
355 | + |
356 | + states: [ |
357 | + State { |
358 | + name: "selectPreset" |
359 | + when: listTimerPreset.currentIndex != -1 |
360 | + PropertyChanges { target: namePreset; visible: true } |
361 | + PropertyChanges { target: editPresetToolbarButton; visible: true } |
362 | + PropertyChanges { target: addPresetToolbarButton; visible: false } |
363 | + }, |
364 | + State { |
365 | + name: "addPreset" |
366 | + PropertyChanges { target: timerMouseArea; enabled: false } |
367 | + PropertyChanges { target: listPreset; visible: false } |
368 | + PropertyChanges { target: namePreset; visible: true } |
369 | + PropertyChanges { target: addPresetToolbarButton; visible: false } |
370 | + PropertyChanges { target: editPresetToolbarButton; visible: true } |
371 | + PropertyChanges { target: cancelPresetToolbarButton; visible: true } |
372 | + PropertyChanges { target: toolbarTimer; locked: true } |
373 | + PropertyChanges { target: toolbarTimer; opened: true } |
374 | + PropertyChanges { target: timerAnimationContainer; contentY: 0 } |
375 | + } |
376 | + ] |
377 | |
378 | function onTimerUpdate() { |
379 | analogTimer.onTimerUpdate(); |
380 | } |
381 | |
382 | function reset() { |
383 | - analogTimer.reset(); |
384 | + analogTimer.reset(); |
385 | + listTimerPreset.currentIndex = -1; |
386 | namePreset.text = ""; |
387 | - } |
388 | - |
389 | - // Function to return total seconds. |
390 | - function totalSeconds(hou, min, sec) { |
391 | - return( (hou * 60 * 60) + (min * 60) + sec ); |
392 | - } |
393 | - |
394 | - // Function to print timer label (format mm:ss and hh:mm:ss when hh > 0) at top |
395 | - function intervalToString(hours, minutes, seconds) |
396 | - { |
397 | - var locale = Qt.locale(); |
398 | - |
399 | - if (hours > 0) { |
400 | - return Utils.zeroleft(hours, 2) + ":" + Utils.zeroleft(minutes, 2) + ":" + Utils.zeroleft(seconds, 2); |
401 | - } else { |
402 | - return Utils.zeroleft(minutes, 2) + ":" + Utils.zeroleft(seconds, 2); |
403 | - } |
404 | + tempNamePreset = ""; |
405 | } |
406 | |
407 | // Function to calculate and print the hours, minutes and seconds from the total time as a string |
408 | @@ -76,21 +86,12 @@ |
409 | Utils.log("TimerPage loaded"); |
410 | } |
411 | |
412 | - PresetTimersModel { |
413 | - id: presetModel |
414 | - } |
415 | - |
416 | - states: [ |
417 | - State { |
418 | - name: "ADDPRESET" |
419 | - PropertyChanges { target: addPresetCircleDone; visible: true } |
420 | - PropertyChanges { target: namePreset; visible: true } |
421 | - } |
422 | - ] |
423 | - |
424 | AnimationContainer { |
425 | id: timerAnimationContainer |
426 | |
427 | + //contentY: presetModel.count != 0 ? units.gu(87) - timerPage.height : 0; |
428 | + contentY: pagePostion; |
429 | + |
430 | // Label to show the current time |
431 | Item { |
432 | id: labelContainer; |
433 | @@ -109,7 +110,7 @@ |
434 | color: Theme.palette.normal.baseText |
435 | |
436 | fontSize: "x-large" |
437 | - text: labelTimer.text = intervalToString(hours, minutes, seconds); |
438 | + text: labelTimer.text = Utils.intervalToString(hours, minutes, seconds); |
439 | } |
440 | } |
441 | |
442 | @@ -117,11 +118,19 @@ |
443 | AnalogTimer { |
444 | id: analogTimer |
445 | |
446 | - anchors { top: parent.top; topMargin: units.gu(9); horizontalCenter: parent.horizontalCenter } |
447 | + AnalogGlowEffect { |
448 | + id: glowEffect |
449 | + |
450 | + z: parent.z - 1 |
451 | + visible: false; |
452 | + fillRectangle: parent |
453 | + } |
454 | + |
455 | + anchors { top: parent.top; topMargin: presetModel.count != 0 ? units.gu(9) : units.gu(12); horizontalCenter: parent.horizontalCenter } |
456 | inProgressFlag: (timerOn == true || analogTimer.state == "DONE") ? true : false; |
457 | - onSecondsChanged: labelTimer.text = intervalToString(hours, minutes, seconds); |
458 | - onMinutesChanged: labelTimer.text = intervalToString(hours, minutes, seconds); |
459 | - onHoursChanged: labelTimer.text = intervalToString(hours, minutes, seconds); |
460 | + onSecondsChanged: labelTimer.text = Utils.intervalToString(hours, minutes, seconds); |
461 | + onMinutesChanged: labelTimer.text = Utils.intervalToString(hours, minutes, seconds); |
462 | + onHoursChanged: labelTimer.text = Utils.intervalToString(hours, minutes, seconds); |
463 | |
464 | states:[ |
465 | State { name: "STOP" }, |
466 | @@ -129,27 +138,25 @@ |
467 | State { |
468 | name: "DONE" |
469 | when: (totalTime == -1 && timerOn == false) |
470 | - PropertyChanges { target: analogTimer; showGlow: true } |
471 | - PropertyChanges { target: analogTimer; glowColor: "#03CB4A" } |
472 | + PropertyChanges { target: glowEffect; visible: true } |
473 | + PropertyChanges { target: glowEffect; color: "#03CB4A" } |
474 | } |
475 | ] |
476 | |
477 | MouseArea { |
478 | + id: timerMouseArea |
479 | anchors.fill: analogTimer.innerCircle |
480 | + enabled: true |
481 | onClicked: { |
482 | switch (analogTimer.state) { |
483 | |
484 | case "": |
485 | if ((seconds != 0 || hours != 0 || minutes != 0) || timerOn) { |
486 | - totalTime = totalSeconds(hours, minutes, seconds); |
487 | + totalTime = Utils.totalSeconds(hours, minutes, seconds); |
488 | analogTimer.startTime = new Date(); |
489 | timerOn = true; |
490 | analogTimer.state = "STOP"; |
491 | } |
492 | - |
493 | - if (timerAnimationContainer.state == "SCROLLED") { |
494 | - timerAnimationContainer.swipeView() |
495 | - } |
496 | break; |
497 | |
498 | case "STOP": |
499 | @@ -173,19 +180,44 @@ |
500 | } |
501 | } |
502 | |
503 | + // Element to set the name of a saved preset. |
504 | + TextField { |
505 | + id: namePreset |
506 | + objectName: "namePreset" |
507 | + |
508 | + text: ""; |
509 | + anchors { horizontalCenter: analogTimer.horizontalCenter; top: analogTimer.bottom; topMargin: units.gu(2)} |
510 | + width: analogTimer.width; |
511 | + style: TextFieldStyle { |
512 | + background: Item {} |
513 | + } |
514 | + // #FIXME: The anchoring needs to be done properly |
515 | + primaryItem: Image { |
516 | + fillMode: Image.PreserveAspectFit |
517 | + source: Qt.resolvedUrl("../images/edit_icon.png") |
518 | + } |
519 | + color: Theme.palette.normal.baseText |
520 | + visible: false |
521 | + hasClearButton: false |
522 | + horizontalAlignment: TextInput.AlignHCenter |
523 | + placeholderText: i18n.tr("Preset Name") |
524 | + font.pixelSize: FontUtils.sizeToPixels("large") |
525 | + } |
526 | + |
527 | ImageButton { |
528 | id: resetButtonTimer |
529 | objectName: "resetButtonTimer" |
530 | |
531 | - anchors { top: analogTimer.bottom; topMargin: units.gu(4); horizontalCenter: analogTimer.horizontalCenter; leftMargin: units.gu(4) } |
532 | + anchors { top: analogTimer.bottom; topMargin: units.gu(6); horizontalCenter: analogTimer.horizontalCenter; leftMargin: units.gu(4) } |
533 | buttonImage: Qt.resolvedUrl("../images/reset_icon.svg"); |
534 | buttonLabel: i18n.tr("Reset"); |
535 | - |
536 | + visible: timerOn || (hours != 0 || minutes != 0 || seconds != 0)? true : false; |
537 | enabled: true |
538 | |
539 | onClicked: { |
540 | reset(); |
541 | - analogTimer.state = ""; |
542 | + if (timerPage.state != "addPreset") |
543 | + timerAnimationContainer.contentY = presetModel.count != 0 ? units.gu(87) - timerPage.height : 0; |
544 | } |
545 | } |
546 | |
547 | @@ -194,7 +226,7 @@ |
548 | id: listPreset |
549 | |
550 | height: childrenRect.height |
551 | - visible: timerPage.state == "ADDPRESET" ? false : true; |
552 | + visible: presetModel.count != 0 ? true : false |
553 | anchors { left: parent.left; right: parent.right; top: analogTimer.bottom; topMargin: units.gu(13) } |
554 | |
555 | ListItem.ThinDivider { } |
556 | @@ -224,15 +256,16 @@ |
557 | objectName: "presetTextLabel" + index |
558 | fontSize: "large"; |
559 | text: label |
560 | - anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: units.gu(3) } |
561 | + anchors { verticalCenter: parent.verticalCenter; left: presetTimeLabel.right; leftMargin: units.gu(5) } |
562 | color: Theme.palette.normal.baseText |
563 | } |
564 | |
565 | Label { |
566 | + id: presetTimeLabel |
567 | objectName: "presetTimerLabel" |
568 | fontSize: "large" |
569 | text: getstringTimer(seconds); |
570 | - anchors { verticalCenter: parent.verticalCenter; right: parent.right; rightMargin: units.gu(2) } |
571 | + anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: units.gu(2) } |
572 | color: Theme.palette.normal.baseText |
573 | } |
574 | |
575 | @@ -247,114 +280,75 @@ |
576 | // TODO: Implement different based actions based on the swipe direction. |
577 | onItemRemoved: { |
578 | presetModel.removePreset(index); |
579 | + timerAnimationContainer.contentY = presetModel.count != 0 ? units.gu(87) - timerPage.height : 0; |
580 | } |
581 | |
582 | onClicked: { |
583 | if (!timerOn) { |
584 | analogTimer.ssToTime(seconds); |
585 | listTimerPreset.currentIndex = index |
586 | + timerAnimationContainer.contentY = 0 |
587 | + namePreset.text = label; |
588 | + tempNamePreset = label; |
589 | } |
590 | } |
591 | } |
592 | } |
593 | } |
594 | - |
595 | - // Add preset done circle which is shown when the add preset toolbar button is pressed |
596 | - Rectangle { |
597 | - id: addPresetCircleDone |
598 | - |
599 | - width: units.gu(12); height: units.gu(12) |
600 | - radius: width / 2 |
601 | - anchors.centerIn: analogTimer |
602 | - color: "transparent" |
603 | - antialiasing: true |
604 | - visible: false |
605 | - |
606 | - Label { |
607 | - id: addPresetTextDone |
608 | - objectName: "addPresetTextDone" |
609 | - |
610 | - //anchors.centerIn: parent |
611 | - color: "lightgreen" |
612 | - fontSize: "x-large" |
613 | - |
614 | - text: i18n.tr("DONE") |
615 | - } |
616 | - |
617 | - MouseArea { |
618 | - anchors.fill: parent |
619 | - onClicked: { |
620 | - if (namePreset.text != "" && (hours > 0 || minutes > 0 || seconds > 0)) { |
621 | - presetModel.appendPreset(namePreset.text, totalSeconds(hours, minutes, seconds)); |
622 | - reset(); |
623 | - timerPage.state = "" |
624 | - } |
625 | - } |
626 | - } |
627 | - } |
628 | - |
629 | - // Element to set the name of a saved preset. |
630 | - TextField { |
631 | - id: namePreset |
632 | - objectName: "namePreset" |
633 | - |
634 | - visible: false |
635 | - hasClearButton: true |
636 | - anchors { left: analogTimer.left; right: analogTimer.right; top: analogTimer.bottom; topMargin: units.gu(10)} |
637 | - |
638 | - placeholderText: i18n.tr("Timer One") |
639 | - } |
640 | } |
641 | |
642 | // Various toolbar actions such as add preset, edit and back. |
643 | tools: ToolbarItems { |
644 | id: toolbarTimer |
645 | |
646 | - ToolbarButton { |
647 | - action: Action { |
648 | - id: addPreset |
649 | - |
650 | - iconSource: Qt.resolvedUrl("../images/add_icon.png") |
651 | - text: i18n.tr("Add Preset") |
652 | - onTriggered: { |
653 | - reset() |
654 | - if (timerAnimationContainer.state == "SCROLLED") { |
655 | - timerAnimationContainer.swipeView() |
656 | - } |
657 | - timerPage.state = "ADDPRESET" |
658 | - } |
659 | - } |
660 | - visible: timerPage.state == "ADDPRESET" ? false : true; |
661 | - } |
662 | - |
663 | - ToolbarButton { |
664 | - action: Action { |
665 | - id: deletePreset |
666 | - |
667 | - iconSource: Qt.resolvedUrl("../images/remove_icon.png") |
668 | - text: i18n.tr("Delete") |
669 | - onTriggered: { |
670 | - if (!timerOn) { |
671 | - presetModel.removePreset(listTimerPreset.currentIndex); |
672 | - analogTimer.reset(); |
673 | - } |
674 | - } |
675 | - } |
676 | - visible: timerAnimationContainer.state == "SCROLLED" ? true : false; |
677 | - } |
678 | - |
679 | - back: ToolbarButton { |
680 | - text: "Back"; |
681 | - iconSource: Qt.resolvedUrl("../images/back_icon.png"); |
682 | - visible: timerPage.state == "ADDPRESET" ? true : false; |
683 | - |
684 | - onTriggered: { |
685 | - if (timerAnimationContainer.state == "SCROLLED") { |
686 | - timerAnimationContainer.swipeView() |
687 | - } |
688 | - else if (timerPage.state == "ADDPRESET") { |
689 | - timerPage.state = "" |
690 | - reset() |
691 | + opened: false |
692 | + locked: false |
693 | + |
694 | + ToolbarButton { |
695 | + id: editPresetToolbarButton |
696 | + objectName: "savePresetButton" |
697 | + visible: false |
698 | + action: Action { |
699 | + iconSource: Qt.resolvedUrl("../images/select_icon.png") |
700 | + text: i18n.tr("Save") |
701 | + onTriggered: { |
702 | + presetModel.appendPreset(tempNamePreset, namePreset.text, Utils.totalSeconds(hours, minutes, seconds), listTimerPreset.currentIndex) |
703 | + namePreset.focus = false |
704 | + if (listTimerPreset.currentIndex == -1) { |
705 | + reset() |
706 | + state = ""; |
707 | + timerAnimationContainer.contentY = presetModel.count != 0 ? units.gu(87) - timerPage.height : 0; |
708 | + } |
709 | + toolbarTimer.opened = false; |
710 | + } |
711 | + } |
712 | + } |
713 | + |
714 | + ToolbarButton { |
715 | + id: addPresetToolbarButton |
716 | + objectName: "addPresetButton" |
717 | + action: Action { |
718 | + iconSource: Qt.resolvedUrl("../images/add_icon.png") |
719 | + text: i18n.tr("New") |
720 | + onTriggered: { |
721 | + reset() |
722 | + state = "addPreset" |
723 | + } |
724 | + } |
725 | + } |
726 | + |
727 | + ToolbarButton { |
728 | + id: cancelPresetToolbarButton |
729 | + objectName: "cancelPresetButton" |
730 | + visible: false; |
731 | + action: Action { |
732 | + iconSource: Qt.resolvedUrl("../images/add_icon.png") |
733 | + text: i18n.tr("Cancel") |
734 | + onTriggered: { |
735 | + reset() |
736 | + state = ""; |
737 | + toolbarTimer.opened = false; |
738 | + timerAnimationContainer.contentY = presetModel.count != 0 ? units.gu(87) - timerPage.height : 0; |
739 | } |
740 | } |
741 | } |
742 | |
743 | === modified file 'ubuntu-clock-app.qml' |
744 | --- ubuntu-clock-app.qml 2013-07-23 22:04:33 +0000 |
745 | +++ ubuntu-clock-app.qml 2013-09-03 19:22:58 +0000 |
746 | @@ -28,12 +28,6 @@ |
747 | import "stopwatch" |
748 | import "timer" |
749 | |
750 | -/*! |
751 | - \brief MainView with Tabs element. |
752 | - First Tab has a single Label and |
753 | - second Tab has a single ToolbarAction. |
754 | -*/ |
755 | - |
756 | MainView { |
757 | id: root |
758 | // objectName for functional testing purposes (autopilot-qt5) |
759 | @@ -50,26 +44,15 @@ |
760 | backgroundColor: "#A55263" |
761 | footerColor: "#D75669" |
762 | |
763 | - //////////////////////////////////////////////////////////////////////////////// |
764 | // New properties of this page |
765 | property var now |
766 | |
767 | - //////////////////////////////////////////////////////////////////////////////// |
768 | - // Property changed handlers |
769 | - |
770 | - //////////////////////////////////////////////////////////////////////////////// |
771 | // Initialization after page has loaded |
772 | Component.onCompleted: { |
773 | // Any init here |
774 | Utils.log("MainView loaded"); |
775 | } |
776 | |
777 | - //////////////////////////////////////////////////////////////////////////////// |
778 | - // Helper-functions |
779 | - |
780 | - //////////////////////////////////////////////////////////////////////////////// |
781 | - // Non-UI elements |
782 | - |
783 | // Timer that runs our app |
784 | Timer { |
785 | id: updateTimer |
786 | @@ -110,6 +93,11 @@ |
787 | id: rootTabs |
788 | objectName: "rootTabs" |
789 | |
790 | + onSelectedTabIndexChanged: { |
791 | + if (rootTabs.selectedTabIndex == 2) |
792 | + timerPage.pagePostion = presetModel.count != 0 ? units.gu(87) - timerPage.height : 0; |
793 | + } |
794 | + |
795 | anchors.fill: parent |
796 | |
797 | Tab { |
798 | @@ -155,6 +143,10 @@ |
799 | |
800 | page: TimerPage { |
801 | id: timerPage |
802 | + PresetTimersModel { |
803 | + id: presetModel |
804 | + Component.onCompleted: Utils.log("Timer Preset Database loaded") |
805 | + } |
806 | } |
807 | } |
808 |
FAILED: Continuous integration, rev:184 /code.launchpad .net/~nik90/ ubuntu- clock-app/ new-preset- designs/ +merge/ 179466/ +edit-commit- message
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http:// 91.189. 93.70:8080/ job/ubuntu- clock-app- ci/31/ 91.189. 93.70:8080/ job/generic- mediumtests/ 343 91.189. 93.70:8080/ job/ubuntu- clock-app- precise- amd64-ci/ 17 91.189. 93.70:8080/ job/ubuntu- clock-app- quantal- amd64-ci/ 31 91.189. 93.70:8080/ job/ubuntu- clock-app- raring- amd64-ci/ 31 91.189. 93.70:8080/ job/ubuntu- clock-app- saucy-amd64- ci/17
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/ubuntu- clock-app- ci/31/rebuild
http://