Merge lp:~nik90/ubuntu-clock-app/delay-alarm-model-startup into lp:ubuntu-clock-app

Proposed by Nekhelesh Ramananthan
Status: Merged
Approved by: Nekhelesh Ramananthan
Approved revision: 148
Merged at revision: 142
Proposed branch: lp:~nik90/ubuntu-clock-app/delay-alarm-model-startup
Merge into: lp:ubuntu-clock-app
Diff against target: 345 lines (+111/-42)
13 files modified
app/alarm/AlarmModelComponent.qml (+25/-0)
app/alarm/AlarmPage.qml (+1/-3)
app/alarm/EditAlarmPage.qml (+1/-0)
app/clock/ClockPage.qml (+1/-1)
app/clock/MainClock.qml (+18/-0)
app/components/AnalogMode.qml (+16/-6)
app/components/Background.qml (+1/-0)
app/components/DigitalMode.qml (+32/-23)
app/ubuntu-clock-app.qml (+7/-6)
app/upstreamcomponents/PageWithBottomEdge.qml (+5/-0)
debian/changelog (+1/-0)
tests/autopilot/ubuntu_clock_app/emulators.py (+3/-2)
tests/unit/tst_alarm.qml (+0/-1)
To merge this branch: bzr merge lp:~nik90/ubuntu-clock-app/delay-alarm-model-startup
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Riccardo Padovani Approve
Ubuntu Clock Developers Pending
Review via email: mp+238031@code.launchpad.net

Commit message

Improve startup time by delaying the loading the alarm model at app startup.

Description of the change

Improve startup time by delaying the loading the alarm model at app startup.

The improvements reduces the start time by 647.8 ms (~23.73%)! There is still room for improvement, but I will experiment on that in my next MP.

@Riccardo, this is the exact same MP that you previously approved at https://code.launchpad.net/~nik90/ubuntu-clock-app/conditionally-load-alarmmodel/+merge/232412. I had to reject the old one since it was out of sync from trunk and the branches had diverged. Also there was a corner case where it caused the clock app to freeze which I have fixed in this MP.

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: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
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)
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Tested: no way to freeze it during the startup, and code looks good!

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://91.189.93.70:8080/job/ubuntu-clock-app-autolanding/200/
Executed test runs:
    FAILURE: http://91.189.93.70:8080/job/generic-mediumtests-utopic-python3/883/console

review: Needs Fixing (continuous-integration)
148. By Nekhelesh Ramananthan

Merged with trunk

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'app/alarm/AlarmModelComponent.qml'
2--- app/alarm/AlarmModelComponent.qml 1970-01-01 00:00:00 +0000
3+++ app/alarm/AlarmModelComponent.qml 2014-10-11 11:46:50 +0000
4@@ -0,0 +1,25 @@
5+/*
6+ * Copyright (C) 2014 Canonical Ltd
7+ *
8+ * This file is part of Ubuntu Clock App
9+ *
10+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
11+ * it under the terms of the GNU General Public License version 3 as
12+ * published by the Free Software Foundation.
13+ *
14+ * Ubuntu Clock App is distributed in the hope that it will be useful,
15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+ * GNU General Public License for more details.
18+ *
19+ * You should have received a copy of the GNU General Public License
20+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21+ */
22+
23+import QtQuick 2.3
24+import Ubuntu.Components 1.1
25+
26+AlarmModel {
27+ id: alarmModel
28+ Component.onCompleted: console.log("[LOG]: Alarm Database loaded")
29+}
30
31=== modified file 'app/alarm/AlarmPage.qml'
32--- app/alarm/AlarmPage.qml 2014-10-11 10:18:38 +0000
33+++ app/alarm/AlarmPage.qml 2014-10-11 11:46:50 +0000
34@@ -23,8 +23,6 @@
35 Page {
36 id: alarmPage
37
38- property var alarmModel
39-
40 title: i18n.tr("Alarms")
41 objectName: 'AlarmPage'
42
43@@ -133,7 +131,7 @@
44 }
45
46 EmptyState {
47- visible: alarmModel.count === 0
48+ visible: alarmModel ? alarmModel.count === 0 : true
49 anchors.verticalCenter: parent.verticalCenter
50
51 iconName: "alarm-clock"
52
53=== modified file 'app/alarm/EditAlarmPage.qml'
54--- app/alarm/EditAlarmPage.qml 2014-10-09 16:40:31 +0000
55+++ app/alarm/EditAlarmPage.qml 2014-10-11 11:46:50 +0000
56@@ -34,6 +34,7 @@
57 // Property to store the index of the alarm to be edited
58 property int alarmIndex
59
60+ // Temporary alarm used to read saved alarm and modify them
61 property var tempAlarm
62
63 title: isNewAlarm ? i18n.tr("New alarm") : i18n.tr("Edit alarm")
64
65=== modified file 'app/clock/ClockPage.qml'
66--- app/clock/ClockPage.qml 2014-10-10 14:54:31 +0000
67+++ app/clock/ClockPage.qml 2014-10-11 11:46:50 +0000
68@@ -40,7 +40,7 @@
69
70 Component.onCompleted: {
71 console.log("[LOG]: Clock Page loaded")
72- _clockPage.setBottomEdgePage(Qt.resolvedUrl("../alarm/AlarmPage.qml"), { alarmModel: alarmModel })
73+ _clockPage.setBottomEdgePage(Qt.resolvedUrl("../alarm/AlarmPage.qml"), {})
74 }
75
76 AlarmUtils {
77
78=== modified file 'app/clock/MainClock.qml'
79--- app/clock/MainClock.qml 2014-10-09 10:16:42 +0000
80+++ app/clock/MainClock.qml 2014-10-11 11:46:50 +0000
81@@ -89,4 +89,22 @@
82 }
83 }
84 }
85+
86+ /*
87+ Only when the startup animation is complete, proceed to load the
88+ alarm model
89+ */
90+ Connections {
91+ target: digitalModeLoader.item
92+ onAnimationComplete: {
93+ alarmModelLoader.source = Qt.resolvedUrl("../alarm/AlarmModelComponent.qml")
94+ }
95+ }
96+
97+ Connections {
98+ target: analogModeLoader.item
99+ onAnimationComplete: {
100+ alarmModelLoader.source = Qt.resolvedUrl("../alarm/AlarmModelComponent.qml")
101+ }
102+ }
103 }
104
105=== modified file 'app/components/AnalogMode.qml'
106--- app/components/AnalogMode.qml 2014-10-07 08:01:14 +0000
107+++ app/components/AnalogMode.qml 2014-10-11 11:46:50 +0000
108@@ -28,6 +28,8 @@
109 // Property to show/hide the seconds hand
110 property bool showSeconds
111
112+ signal animationComplete()
113+
114 function startAnimation() {
115 _animationTimer.start()
116 }
117@@ -90,12 +92,20 @@
118 source: "../graphics/Knob.png"
119 }
120
121- PropertyAnimation {
122+ SequentialAnimation {
123 id: _innerCircleAnimation
124- target: _innerCircleAnalog
125- property: "width"
126- from: units.gu(0)
127- to: maxWidth
128- duration: 900
129+
130+ PropertyAnimation {
131+ target: _innerCircleAnalog
132+ property: "width"
133+ from: units.gu(0)
134+ to: maxWidth
135+ duration: 900
136+ }
137+
138+ // Fire signal that the animation is complete.
139+ ScriptAction {
140+ script: animationComplete()
141+ }
142 }
143 }
144
145=== modified file 'app/components/Background.qml'
146--- app/components/Background.qml 2014-09-20 10:47:21 +0000
147+++ app/components/Background.qml 2014-10-11 11:46:50 +0000
148@@ -26,6 +26,7 @@
149 Image {
150 id: _background
151
152+ asynchronous: true
153 anchors.fill: parent
154 source: "../graphics/Background_Texture.jpg"
155 }
156
157=== modified file 'app/components/DigitalMode.qml'
158--- app/components/DigitalMode.qml 2014-08-24 12:47:50 +0000
159+++ app/components/DigitalMode.qml 2014-10-11 11:46:50 +0000
160@@ -33,6 +33,8 @@
161 property int maxTimeFontSize
162 property int maxPeriodFontSize
163
164+ signal animationComplete()
165+
166 function startAnimation() {
167 _animationTimer.start()
168 }
169@@ -94,31 +96,38 @@
170 }
171 }
172
173- ParallelAnimation {
174+ SequentialAnimation {
175 id: _innerCircleAnimation
176
177- PropertyAnimation {
178- target: _innerCircle
179- property: "width"
180- from: units.gu(0)
181- to: maxWidth
182- duration: 900
183- }
184-
185- PropertyAnimation {
186- target: _digitalTime
187- property: "font.pixelSize"
188- from: units.dp(1)
189- to: maxTimeFontSize
190- duration: 900
191- }
192-
193- PropertyAnimation {
194- target: _digitalTimePeriod
195- property: "font.pixelSize"
196- from: units.dp(1)
197- to: maxPeriodFontSize
198- duration: 900
199+ ParallelAnimation {
200+ PropertyAnimation {
201+ target: _innerCircle
202+ property: "width"
203+ from: units.gu(0)
204+ to: maxWidth
205+ duration: 900
206+ }
207+
208+ PropertyAnimation {
209+ target: _digitalTime
210+ property: "font.pixelSize"
211+ from: units.dp(1)
212+ to: maxTimeFontSize
213+ duration: 900
214+ }
215+
216+ PropertyAnimation {
217+ target: _digitalTimePeriod
218+ property: "font.pixelSize"
219+ from: units.dp(1)
220+ to: maxPeriodFontSize
221+ duration: 900
222+ }
223+ }
224+
225+ // Fire signal that the animation is complete.
226+ ScriptAction {
227+ script: animationComplete()
228 }
229 }
230 }
231
232=== modified file 'app/ubuntu-clock-app.qml'
233--- app/ubuntu-clock-app.qml 2014-10-09 17:04:41 +0000
234+++ app/ubuntu-clock-app.qml 2014-10-11 11:46:50 +0000
235@@ -71,11 +71,6 @@
236 defaults: { "digitalMode": false }
237 }
238
239- AlarmModel {
240- id: alarmModel
241- Component.onCompleted: console.log("[LOG]: Alarm Database loaded")
242- }
243-
244 DateTime {
245 id: localTimeSource
246 updateInterval: 1000
247@@ -93,6 +88,11 @@
248 ClockPage {
249 id: clockPage
250
251+ Loader {
252+ id: alarmModelLoader
253+ asynchronous: false
254+ }
255+
256 /*
257 #FIXME: When the SDK support hiding the header, then enable the
258 clock page title. This will then set the correct window title on
259@@ -116,7 +116,8 @@
260 possible to receive a datetime object directly instead of using this hack.
261 */
262
263- alarmModel: alarmModel
264+ alarmModel: alarmModelLoader.item
265+ bottomEdgeEnabled: alarmModelLoader.status === Loader.Ready
266 clockTime: new Date
267 (
268 localTimeSource.localDateString.split(":")[0],
269
270=== modified file 'app/upstreamcomponents/PageWithBottomEdge.qml'
271--- app/upstreamcomponents/PageWithBottomEdge.qml 2014-10-02 21:53:50 +0000
272+++ app/upstreamcomponents/PageWithBottomEdge.qml 2014-10-11 11:46:50 +0000
273@@ -148,6 +148,8 @@
274 property bool hiden: (activeFocus === false) ||
275 ((bottomEdge.y - units.gu(1)) < tip.y)
276
277+ property bool isAnimating: true
278+
279 enabled: mouseArea.enabled
280 visible: page.bottomEdgeEnabled
281 anchors {
282@@ -163,6 +165,9 @@
283 UbuntuNumberAnimation {
284 duration: UbuntuAnimation.SnapDuration
285 }
286+ ScriptAction {
287+ script: tip.isAnimating = false
288+ }
289 }
290 }
291 }
292
293=== modified file 'debian/changelog'
294--- debian/changelog 2014-10-11 10:19:26 +0000
295+++ debian/changelog 2014-10-11 11:46:50 +0000
296@@ -10,6 +10,7 @@
297 only. (LP: #1377538)
298 * Tweaked bottom edge to show the time to the next active alarm (LP: #1290793)
299 * Synced ListItemWithActions with upstream
300+ * Delayed loading of AlarmModel to improve app startup time (LP: #1362140)
301 * Fixed alarm page header width warning and corrected icon spacing.
302
303 [Akiva Shammai Avraham]
304
305=== modified file 'tests/autopilot/ubuntu_clock_app/emulators.py'
306--- tests/autopilot/ubuntu_clock_app/emulators.py 2014-10-10 01:54:53 +0000
307+++ tests/autopilot/ubuntu_clock_app/emulators.py 2014-10-11 11:46:50 +0000
308@@ -54,7 +54,7 @@
309 clockPage = self.open_clock()
310 clockPage.reveal_bottom_edge_page()
311 self.get_header().visible.wait_for(True)
312- return self.wait_select_single(AlarmPage)
313+ return self.wait_select_single(Page11)
314
315 def get_AlarmList(self):
316 """ Get the AlarmList object. """
317@@ -93,6 +93,7 @@
318 action_item = self.wait_select_single(objectName='bottomEdgeTip')
319 action_item.hiden.wait_for(False)
320 action_item.enabled.wait_for(True)
321+ action_item.isAnimating.wait_for(False)
322 start_x = (action_item.globalRect.x +
323 (action_item.globalRect.width * 0.5))
324 start_y = (action_item.globalRect.y +
325@@ -178,7 +179,7 @@
326 self.pointing_device.click_object(deleteButton)
327
328
329-class AlarmPage(Page):
330+class Page11(Page):
331 """Autopilot helper for the Alarm page."""
332
333 @autopilot_logging.log_action(logger.info)
334
335=== modified file 'tests/unit/tst_alarm.qml'
336--- tests/unit/tst_alarm.qml 2014-10-10 10:16:50 +0000
337+++ tests/unit/tst_alarm.qml 2014-10-11 11:46:50 +0000
338@@ -61,7 +61,6 @@
339
340 AlarmPage {
341 id: alarmPage
342- alarmModel: alarmModel
343 }
344
345 UbuntuTestCase {

Subscribers

People subscribed via source and target branches