Merge lp:~nik90/ubuntu-clock-app/improve-world-clock-startup into lp:ubuntu-clock-app

Proposed by Nekhelesh Ramananthan
Status: Merged
Approved by: Riccardo Padovani
Approved revision: 148
Merged at revision: 145
Proposed branch: lp:~nik90/ubuntu-clock-app/improve-world-clock-startup
Merge into: lp:ubuntu-clock-app
Diff against target: 139 lines (+66/-13)
2 files modified
app/worldclock/WorldCityList.qml (+64/-13)
debian/changelog (+2/-0)
To merge this branch: bzr merge lp:~nik90/ubuntu-clock-app/improve-world-clock-startup
Reviewer Review Type Date Requested Status
Riccardo Padovani Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+238057@code.launchpad.net

Commit message

Improved the loading (startup) time of the Add World City page by delaying the loading of the xmltimezone model and loading the jsontimezone model only when being in search mode.

Description of the change

Improved the loading (startup) time of the Add World City page by delaying the loading of the xmltimezone model and loading the jsontimezone model only when being in search mode.

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)
145. By Nekhelesh Ramananthan

Added comments

146. By Nekhelesh Ramananthan

reverted pot file change to minimize code diff for review purposes

147. By Nekhelesh Ramananthan

Improved if logic

148. By Nekhelesh Ramananthan

Updated debian changelog

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 on PC. Both code and implementation looks good to me

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/worldclock/WorldCityList.qml'
2--- app/worldclock/WorldCityList.qml 2014-10-10 10:55:27 +0000
3+++ app/worldclock/WorldCityList.qml 2014-10-11 18:41:23 +0000
4@@ -37,6 +37,16 @@
5 objectName: "worldCityList"
6
7 property bool isOnlineMode: false
8+ property alias jsonTimeZoneModel: jsonTimeZoneModelLoader.item
9+ property alias xmlTimeZoneModel: xmlTimeZoneModelLoader.item
10+
11+ Component.onCompleted: {
12+ /*
13+ Load the XML Model *only* after the page has loaded to improve
14+ the loading time preception of the user.
15+ */
16+ xmlTimeZoneModelLoader.sourceComponent = xmlTimeZoneModelComponent
17+ }
18
19 title: i18n.tr("Select a city")
20 visible: false
21@@ -54,6 +64,7 @@
22 text: i18n.tr("City")
23 onTriggered: {
24 worldCityList.state = "search"
25+ jsonTimeZoneModelLoader.sourceComponent = jsonTimeZoneModelComponent
26 searchField.forceActiveFocus()
27 }
28 }
29@@ -71,6 +82,7 @@
30 searchField.text = ""
31 worldCityList.state = "default"
32 isOnlineMode = false
33+ jsonTimeZoneModelLoader.sourceComponent = undefined
34 }
35 }
36
37@@ -106,7 +118,9 @@
38 .arg(searchField.text)
39 .arg("&app=com.ubuntu.clock&version=3.2.x")
40 console.log("Online URL: " + url)
41- jsonTimeZoneModel.source = Qt.resolvedUrl(url)
42+ if (jsonTimeZoneModelLoader.status === Loader.Ready) {
43+ jsonTimeZoneModel.source = Qt.resolvedUrl(url)
44+ }
45 }
46 }
47 }
48@@ -130,20 +144,52 @@
49 }
50 }
51
52- JsonTimeZoneModel {
53- id: jsonTimeZoneModel
54- updateInterval: 60000
55- }
56-
57- XmlTimeZoneModel {
58- id: xmlTimeZoneModel
59- updateInterval: 60000
60- source: Qt.resolvedUrl("world-city-list.xml")
61+ /*
62+ Loader to allow for dynamic loading/unloading of the json model only when
63+ necessary.
64+ */
65+ Loader {
66+ id: jsonTimeZoneModelLoader
67+ asynchronous: true
68+ }
69+
70+ Component {
71+ id: jsonTimeZoneModelComponent
72+ JsonTimeZoneModel {
73+ updateInterval: 60000
74+ }
75+ }
76+
77+ Loader {
78+ id: xmlTimeZoneModelLoader
79+ asynchronous: true
80+ }
81+
82+ Component {
83+ id: xmlTimeZoneModelComponent
84+ XmlTimeZoneModel {
85+ updateInterval: 60000
86+ source: Qt.resolvedUrl("world-city-list.xml")
87+ }
88 }
89
90 SortFilterModel {
91 id: sortedTimeZoneModel
92- model: isOnlineMode ? jsonTimeZoneModel : xmlTimeZoneModel
93+
94+ model: {
95+ if (isOnlineMode && jsonTimeZoneModelLoader.status === Loader.Ready) {
96+ return jsonTimeZoneModel
97+ }
98+
99+ else if (xmlTimeZoneModelLoader.status === Loader.Ready) {
100+ return xmlTimeZoneModel
101+ }
102+
103+ else {
104+ return undefined
105+ }
106+ }
107+
108 sort.property: "city"
109 sort.order: Qt.AscendingOrder
110 filter.property: "city"
111@@ -195,8 +241,13 @@
112 }
113
114 ActivityIndicator {
115- running: jsonTimeZoneModel.status === JsonTimeZoneModel.Loading
116- && isOnlineMode
117+ running: {
118+ if (jsonTimeZoneModelLoader.status === Loader.Ready && isOnlineMode) {
119+ return jsonTimeZoneModel.status === JsonTimeZoneModel.Loading
120+ } else {
121+ return false
122+ }
123+ }
124 anchors {
125 top: onlineStateLabel.bottom
126 topMargin: units.gu(3)
127
128=== modified file 'debian/changelog'
129--- debian/changelog 2014-10-11 11:46:39 +0000
130+++ debian/changelog 2014-10-11 18:41:23 +0000
131@@ -12,6 +12,8 @@
132 * Synced ListItemWithActions with upstream
133 * Delayed loading of AlarmModel to improve app startup time (LP: #1362140)
134 * Fixed alarm page header width warning and corrected icon spacing.
135+ * Delayed loading of xmltimezone model until add world city page is loaded and
136+ dynamically load/unload the jsontimezone model only when necessary.
137
138 [Akiva Shammai Avraham]
139 * Improved the analog clock performance by updating the clock hands every second

Subscribers

People subscribed via source and target branches