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
=== added file 'app/alarm/AlarmModelComponent.qml'
--- app/alarm/AlarmModelComponent.qml 1970-01-01 00:00:00 +0000
+++ app/alarm/AlarmModelComponent.qml 2014-10-11 11:46:50 +0000
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd
3 *
4 * This file is part of Ubuntu Clock App
5 *
6 * Ubuntu Clock App is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 3 as
8 * published by the Free Software Foundation.
9 *
10 * Ubuntu Clock App is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19import QtQuick 2.3
20import Ubuntu.Components 1.1
21
22AlarmModel {
23 id: alarmModel
24 Component.onCompleted: console.log("[LOG]: Alarm Database loaded")
25}
026
=== modified file 'app/alarm/AlarmPage.qml'
--- app/alarm/AlarmPage.qml 2014-10-11 10:18:38 +0000
+++ app/alarm/AlarmPage.qml 2014-10-11 11:46:50 +0000
@@ -23,8 +23,6 @@
23Page {23Page {
24 id: alarmPage24 id: alarmPage
2525
26 property var alarmModel
27
28 title: i18n.tr("Alarms")26 title: i18n.tr("Alarms")
29 objectName: 'AlarmPage'27 objectName: 'AlarmPage'
3028
@@ -133,7 +131,7 @@
133 }131 }
134132
135 EmptyState {133 EmptyState {
136 visible: alarmModel.count === 0134 visible: alarmModel ? alarmModel.count === 0 : true
137 anchors.verticalCenter: parent.verticalCenter135 anchors.verticalCenter: parent.verticalCenter
138136
139 iconName: "alarm-clock"137 iconName: "alarm-clock"
140138
=== modified file 'app/alarm/EditAlarmPage.qml'
--- app/alarm/EditAlarmPage.qml 2014-10-09 16:40:31 +0000
+++ app/alarm/EditAlarmPage.qml 2014-10-11 11:46:50 +0000
@@ -34,6 +34,7 @@
34 // Property to store the index of the alarm to be edited34 // Property to store the index of the alarm to be edited
35 property int alarmIndex35 property int alarmIndex
3636
37 // Temporary alarm used to read saved alarm and modify them
37 property var tempAlarm38 property var tempAlarm
3839
39 title: isNewAlarm ? i18n.tr("New alarm") : i18n.tr("Edit alarm")40 title: isNewAlarm ? i18n.tr("New alarm") : i18n.tr("Edit alarm")
4041
=== modified file 'app/clock/ClockPage.qml'
--- app/clock/ClockPage.qml 2014-10-10 14:54:31 +0000
+++ app/clock/ClockPage.qml 2014-10-11 11:46:50 +0000
@@ -40,7 +40,7 @@
4040
41 Component.onCompleted: {41 Component.onCompleted: {
42 console.log("[LOG]: Clock Page loaded")42 console.log("[LOG]: Clock Page loaded")
43 _clockPage.setBottomEdgePage(Qt.resolvedUrl("../alarm/AlarmPage.qml"), { alarmModel: alarmModel })43 _clockPage.setBottomEdgePage(Qt.resolvedUrl("../alarm/AlarmPage.qml"), {})
44 }44 }
4545
46 AlarmUtils {46 AlarmUtils {
4747
=== modified file 'app/clock/MainClock.qml'
--- app/clock/MainClock.qml 2014-10-09 10:16:42 +0000
+++ app/clock/MainClock.qml 2014-10-11 11:46:50 +0000
@@ -89,4 +89,22 @@
89 }89 }
90 }90 }
91 }91 }
92
93 /*
94 Only when the startup animation is complete, proceed to load the
95 alarm model
96 */
97 Connections {
98 target: digitalModeLoader.item
99 onAnimationComplete: {
100 alarmModelLoader.source = Qt.resolvedUrl("../alarm/AlarmModelComponent.qml")
101 }
102 }
103
104 Connections {
105 target: analogModeLoader.item
106 onAnimationComplete: {
107 alarmModelLoader.source = Qt.resolvedUrl("../alarm/AlarmModelComponent.qml")
108 }
109 }
92}110}
93111
=== modified file 'app/components/AnalogMode.qml'
--- app/components/AnalogMode.qml 2014-10-07 08:01:14 +0000
+++ app/components/AnalogMode.qml 2014-10-11 11:46:50 +0000
@@ -28,6 +28,8 @@
28 // Property to show/hide the seconds hand28 // Property to show/hide the seconds hand
29 property bool showSeconds29 property bool showSeconds
3030
31 signal animationComplete()
32
31 function startAnimation() {33 function startAnimation() {
32 _animationTimer.start()34 _animationTimer.start()
33 }35 }
@@ -90,12 +92,20 @@
90 source: "../graphics/Knob.png"92 source: "../graphics/Knob.png"
91 }93 }
9294
93 PropertyAnimation {95 SequentialAnimation {
94 id: _innerCircleAnimation96 id: _innerCircleAnimation
95 target: _innerCircleAnalog97
96 property: "width"98 PropertyAnimation {
97 from: units.gu(0)99 target: _innerCircleAnalog
98 to: maxWidth100 property: "width"
99 duration: 900101 from: units.gu(0)
102 to: maxWidth
103 duration: 900
104 }
105
106 // Fire signal that the animation is complete.
107 ScriptAction {
108 script: animationComplete()
109 }
100 }110 }
101}111}
102112
=== modified file 'app/components/Background.qml'
--- app/components/Background.qml 2014-09-20 10:47:21 +0000
+++ app/components/Background.qml 2014-10-11 11:46:50 +0000
@@ -26,6 +26,7 @@
26Image {26Image {
27 id: _background27 id: _background
2828
29 asynchronous: true
29 anchors.fill: parent30 anchors.fill: parent
30 source: "../graphics/Background_Texture.jpg"31 source: "../graphics/Background_Texture.jpg"
31}32}
3233
=== modified file 'app/components/DigitalMode.qml'
--- app/components/DigitalMode.qml 2014-08-24 12:47:50 +0000
+++ app/components/DigitalMode.qml 2014-10-11 11:46:50 +0000
@@ -33,6 +33,8 @@
33 property int maxTimeFontSize33 property int maxTimeFontSize
34 property int maxPeriodFontSize34 property int maxPeriodFontSize
3535
36 signal animationComplete()
37
36 function startAnimation() {38 function startAnimation() {
37 _animationTimer.start()39 _animationTimer.start()
38 }40 }
@@ -94,31 +96,38 @@
94 }96 }
95 }97 }
9698
97 ParallelAnimation {99 SequentialAnimation {
98 id: _innerCircleAnimation100 id: _innerCircleAnimation
99101
100 PropertyAnimation {102 ParallelAnimation {
101 target: _innerCircle103 PropertyAnimation {
102 property: "width"104 target: _innerCircle
103 from: units.gu(0)105 property: "width"
104 to: maxWidth106 from: units.gu(0)
105 duration: 900107 to: maxWidth
106 }108 duration: 900
107109 }
108 PropertyAnimation {110
109 target: _digitalTime111 PropertyAnimation {
110 property: "font.pixelSize"112 target: _digitalTime
111 from: units.dp(1)113 property: "font.pixelSize"
112 to: maxTimeFontSize114 from: units.dp(1)
113 duration: 900115 to: maxTimeFontSize
114 }116 duration: 900
115117 }
116 PropertyAnimation {118
117 target: _digitalTimePeriod119 PropertyAnimation {
118 property: "font.pixelSize"120 target: _digitalTimePeriod
119 from: units.dp(1)121 property: "font.pixelSize"
120 to: maxPeriodFontSize122 from: units.dp(1)
121 duration: 900123 to: maxPeriodFontSize
124 duration: 900
125 }
126 }
127
128 // Fire signal that the animation is complete.
129 ScriptAction {
130 script: animationComplete()
122 }131 }
123 }132 }
124}133}
125134
=== modified file 'app/ubuntu-clock-app.qml'
--- app/ubuntu-clock-app.qml 2014-10-09 17:04:41 +0000
+++ app/ubuntu-clock-app.qml 2014-10-11 11:46:50 +0000
@@ -71,11 +71,6 @@
71 defaults: { "digitalMode": false }71 defaults: { "digitalMode": false }
72 }72 }
7373
74 AlarmModel {
75 id: alarmModel
76 Component.onCompleted: console.log("[LOG]: Alarm Database loaded")
77 }
78
79 DateTime {74 DateTime {
80 id: localTimeSource75 id: localTimeSource
81 updateInterval: 100076 updateInterval: 1000
@@ -93,6 +88,11 @@
93 ClockPage {88 ClockPage {
94 id: clockPage89 id: clockPage
9590
91 Loader {
92 id: alarmModelLoader
93 asynchronous: false
94 }
95
96 /*96 /*
97 #FIXME: When the SDK support hiding the header, then enable the97 #FIXME: When the SDK support hiding the header, then enable the
98 clock page title. This will then set the correct window title on98 clock page title. This will then set the correct window title on
@@ -116,7 +116,8 @@
116 possible to receive a datetime object directly instead of using this hack.116 possible to receive a datetime object directly instead of using this hack.
117 */117 */
118118
119 alarmModel: alarmModel119 alarmModel: alarmModelLoader.item
120 bottomEdgeEnabled: alarmModelLoader.status === Loader.Ready
120 clockTime: new Date121 clockTime: new Date
121 (122 (
122 localTimeSource.localDateString.split(":")[0],123 localTimeSource.localDateString.split(":")[0],
123124
=== modified file 'app/upstreamcomponents/PageWithBottomEdge.qml'
--- app/upstreamcomponents/PageWithBottomEdge.qml 2014-10-02 21:53:50 +0000
+++ app/upstreamcomponents/PageWithBottomEdge.qml 2014-10-11 11:46:50 +0000
@@ -148,6 +148,8 @@
148 property bool hiden: (activeFocus === false) ||148 property bool hiden: (activeFocus === false) ||
149 ((bottomEdge.y - units.gu(1)) < tip.y)149 ((bottomEdge.y - units.gu(1)) < tip.y)
150150
151 property bool isAnimating: true
152
151 enabled: mouseArea.enabled153 enabled: mouseArea.enabled
152 visible: page.bottomEdgeEnabled154 visible: page.bottomEdgeEnabled
153 anchors {155 anchors {
@@ -163,6 +165,9 @@
163 UbuntuNumberAnimation {165 UbuntuNumberAnimation {
164 duration: UbuntuAnimation.SnapDuration166 duration: UbuntuAnimation.SnapDuration
165 }167 }
168 ScriptAction {
169 script: tip.isAnimating = false
170 }
166 }171 }
167 }172 }
168 }173 }
169174
=== modified file 'debian/changelog'
--- debian/changelog 2014-10-11 10:19:26 +0000
+++ debian/changelog 2014-10-11 11:46:50 +0000
@@ -10,6 +10,7 @@
10 only. (LP: #1377538)10 only. (LP: #1377538)
11 * Tweaked bottom edge to show the time to the next active alarm (LP: #1290793)11 * Tweaked bottom edge to show the time to the next active alarm (LP: #1290793)
12 * Synced ListItemWithActions with upstream12 * Synced ListItemWithActions with upstream
13 * Delayed loading of AlarmModel to improve app startup time (LP: #1362140)
13 * Fixed alarm page header width warning and corrected icon spacing.14 * Fixed alarm page header width warning and corrected icon spacing.
1415
15 [Akiva Shammai Avraham]16 [Akiva Shammai Avraham]
1617
=== modified file 'tests/autopilot/ubuntu_clock_app/emulators.py'
--- tests/autopilot/ubuntu_clock_app/emulators.py 2014-10-10 01:54:53 +0000
+++ tests/autopilot/ubuntu_clock_app/emulators.py 2014-10-11 11:46:50 +0000
@@ -54,7 +54,7 @@
54 clockPage = self.open_clock()54 clockPage = self.open_clock()
55 clockPage.reveal_bottom_edge_page()55 clockPage.reveal_bottom_edge_page()
56 self.get_header().visible.wait_for(True)56 self.get_header().visible.wait_for(True)
57 return self.wait_select_single(AlarmPage)57 return self.wait_select_single(Page11)
5858
59 def get_AlarmList(self):59 def get_AlarmList(self):
60 """ Get the AlarmList object. """60 """ Get the AlarmList object. """
@@ -93,6 +93,7 @@
93 action_item = self.wait_select_single(objectName='bottomEdgeTip')93 action_item = self.wait_select_single(objectName='bottomEdgeTip')
94 action_item.hiden.wait_for(False)94 action_item.hiden.wait_for(False)
95 action_item.enabled.wait_for(True)95 action_item.enabled.wait_for(True)
96 action_item.isAnimating.wait_for(False)
96 start_x = (action_item.globalRect.x +97 start_x = (action_item.globalRect.x +
97 (action_item.globalRect.width * 0.5))98 (action_item.globalRect.width * 0.5))
98 start_y = (action_item.globalRect.y +99 start_y = (action_item.globalRect.y +
@@ -178,7 +179,7 @@
178 self.pointing_device.click_object(deleteButton)179 self.pointing_device.click_object(deleteButton)
179180
180181
181class AlarmPage(Page):182class Page11(Page):
182 """Autopilot helper for the Alarm page."""183 """Autopilot helper for the Alarm page."""
183184
184 @autopilot_logging.log_action(logger.info)185 @autopilot_logging.log_action(logger.info)
185186
=== modified file 'tests/unit/tst_alarm.qml'
--- tests/unit/tst_alarm.qml 2014-10-10 10:16:50 +0000
+++ tests/unit/tst_alarm.qml 2014-10-11 11:46:50 +0000
@@ -61,7 +61,6 @@
6161
62 AlarmPage {62 AlarmPage {
63 id: alarmPage63 id: alarmPage
64 alarmModel: alarmModel
65 }64 }
6665
67 UbuntuTestCase {66 UbuntuTestCase {

Subscribers

People subscribed via source and target branches