Merge lp:~nik90/ubuntu-clock-app/unload-innerclocktexture into lp:ubuntu-clock-app

Proposed by Nekhelesh Ramananthan
Status: Superseded
Proposed branch: lp:~nik90/ubuntu-clock-app/unload-innerclocktexture
Merge into: lp:ubuntu-clock-app
Diff against target: 431 lines (+153/-117)
8 files modified
app/alarm/AlarmPage.qml (+77/-64)
app/alarm/AlarmSettingsPage.qml (+4/-4)
app/alarm/AlarmSound.qml (+0/-1)
app/alarm/EditAlarmPage.qml (+0/-1)
app/components/ClockCircle.qml (+12/-6)
app/components/EmptyState.qml (+7/-1)
app/worldclock/WorldCityList.qml (+49/-40)
debian/changelog (+4/-0)
To merge this branch: bzr merge lp:~nik90/ubuntu-clock-app/unload-innerclocktexture
Reviewer Review Type Date Requested Status
Ubuntu Clock Developers Pending
Review via email: mp+238629@code.launchpad.net

This proposal has been superseded by a proposal from 2014-10-16.

Commit message

Unloaded inner clock background texture when not required and set its smoothness to false to improve start up animation.

Description of the change

Unloaded inner clock background texture when not required and set its smoothness to false to improve start up animation.

To post a comment you must log in.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/alarm/AlarmPage.qml'
2--- app/alarm/AlarmPage.qml 2014-10-11 11:46:39 +0000
3+++ app/alarm/AlarmPage.qml 2014-10-16 21:47:31 +0000
4@@ -61,68 +61,76 @@
5 }
6 }
7
8- contents: Item {
9+ contents: Loader {
10+ id: selectionStateLoader
11+ active: alarmPage.state === "selection"
12+ sourceComponent: selectionStateComponent
13+ height: parent ? parent.height : undefined
14 anchors.right: parent ? parent.right: undefined
15- height: parent ? parent.height : undefined
16-
17- HeaderButton {
18- id: selectButton
19-
20- anchors {
21- right: deleteButton.left
22- rightMargin: units.gu(1)
23- }
24-
25- text: {
26- if(alarmListView.selectedItems.count === alarmListView.count) {
27- return i18n.tr("Select None")
28- } else {
29- return i18n.tr("Select All")
30- }
31- }
32-
33- iconSource: {
34- if(alarmListView.selectedItems.count === alarmListView.count) {
35- return Qt.resolvedUrl("../graphics/select-none.svg")
36- } else {
37- return Qt.resolvedUrl("../graphics/select.svg")
38- }
39- }
40-
41- onTriggered: {
42- if(alarmListView.selectedItems.count === alarmListView.count) {
43- alarmListView.clearSelection()
44- } else {
45- alarmListView.selectAll()
46- }
47- }
48- }
49-
50- HeaderButton {
51- id: deleteButton
52-
53- anchors.right: parent.right
54- anchors.rightMargin: units.gu(2)
55-
56- iconName: "delete"
57- text: i18n.tr("Delete")
58- enabled: alarmListView.selectedItems.count !== 0
59-
60- onTriggered: {
61- var items = alarmListView.selectedItems
62-
63- for(var i=0; i < items.count; i++) {
64- var alarm = alarmModel.get(items.get(i).itemsIndex)
65- alarm.cancel()
66- }
67-
68- alarmListView.endSelection()
69- }
70- }
71 }
72 }
73 ]
74
75+ Component {
76+ id: selectionStateComponent
77+ Item {
78+ HeaderButton {
79+ id: selectButton
80+
81+ anchors {
82+ right: deleteButton.left
83+ rightMargin: units.gu(1)
84+ }
85+
86+ text: {
87+ if(alarmListView.selectedItems.count === alarmListView.count) {
88+ return i18n.tr("Select None")
89+ } else {
90+ return i18n.tr("Select All")
91+ }
92+ }
93+
94+ iconSource: {
95+ if(alarmListView.selectedItems.count === alarmListView.count) {
96+ return Qt.resolvedUrl("../graphics/select-none.svg")
97+ } else {
98+ return Qt.resolvedUrl("../graphics/select.svg")
99+ }
100+ }
101+
102+ onTriggered: {
103+ if(alarmListView.selectedItems.count === alarmListView.count) {
104+ alarmListView.clearSelection()
105+ } else {
106+ alarmListView.selectAll()
107+ }
108+ }
109+ }
110+
111+ HeaderButton {
112+ id: deleteButton
113+
114+ anchors.right: parent.right
115+ anchors.rightMargin: units.gu(2)
116+
117+ iconName: "delete"
118+ text: i18n.tr("Delete")
119+ enabled: alarmListView.selectedItems.count !== 0
120+
121+ onTriggered: {
122+ var items = alarmListView.selectedItems
123+
124+ for(var i=0; i < items.count; i++) {
125+ var alarm = alarmModel.get(items.get(i).itemsIndex)
126+ alarm.cancel()
127+ }
128+
129+ alarmListView.endSelection()
130+ }
131+ }
132+ }
133+ }
134+
135 AlarmList {
136 id: alarmListView
137 listModel: alarmModel
138@@ -130,12 +138,17 @@
139 localTime: clockTime
140 }
141
142- EmptyState {
143- visible: alarmModel ? alarmModel.count === 0 : true
144- anchors.verticalCenter: parent.verticalCenter
145-
146- iconName: "alarm-clock"
147- title: i18n.tr("No saved alarms")
148- subTitle: i18n.tr("Tap the + icon to add an alarm")
149+ Loader {
150+ id: emptyStateLoader
151+ anchors.centerIn: parent
152+ active: alarmModel ? alarmModel.count === 0 : true
153+ Component.onCompleted: {
154+ setSource(Qt.resolvedUrl("../components/EmptyState.qml"),
155+ {
156+ "iconName": "alarm-clock",
157+ "title": i18n.tr("No saved alarms"),
158+ "subTitle": i18n.tr("Tap the + icon to add an alarm")
159+ })
160+ }
161 }
162 }
163
164=== modified file 'app/alarm/AlarmSettingsPage.qml'
165--- app/alarm/AlarmSettingsPage.qml 2014-10-15 20:59:05 +0000
166+++ app/alarm/AlarmSettingsPage.qml 2014-10-16 21:47:31 +0000
167@@ -28,7 +28,7 @@
168
169 title: i18n.tr("Settings")
170 visible: false
171- flickable: null
172+ flickable: settingsPlugin
173
174 Connections {
175 target: clockApp
176@@ -74,7 +74,6 @@
177
178 contentHeight: _settingsColumn.height
179 anchors.fill: parent
180- clip: true
181
182 Column {
183 id: _settingsColumn
184@@ -169,11 +168,12 @@
185
186 ListView {
187 id: _resultsList
188- clip: true
189+
190 interactive: false
191 model: durationModel
192 width: parent.width
193 height: units.gu(24)
194+
195 delegate: ListItem.Standard {
196 text: model.text
197 onClicked: {
198@@ -237,7 +237,7 @@
199
200 ListView {
201 id: _snoozeResultsList
202- clip: true
203+
204 interactive: false
205 model: snoozeModel
206 width: parent.width
207
208=== modified file 'app/alarm/AlarmSound.qml'
209--- app/alarm/AlarmSound.qml 2014-09-25 11:26:43 +0000
210+++ app/alarm/AlarmSound.qml 2014-10-16 21:47:31 +0000
211@@ -53,7 +53,6 @@
212 Flickable {
213 id: _pageFlickable
214
215- clip: true
216 anchors.fill: parent
217 contentHeight: soundModel.count * units.gu(7)
218
219
220=== modified file 'app/alarm/EditAlarmPage.qml'
221--- app/alarm/EditAlarmPage.qml 2014-10-15 09:52:24 +0000
222+++ app/alarm/EditAlarmPage.qml 2014-10-16 21:47:31 +0000
223@@ -262,7 +262,6 @@
224 margins: units.gu(-2)
225 }
226
227- clip: true
228 mode: "Hours|Minutes"
229 date: {
230 if(isNewAlarm) {
231
232=== modified file 'app/components/ClockCircle.qml'
233--- app/components/ClockCircle.qml 2014-09-20 10:47:21 +0000
234+++ app/components/ClockCircle.qml 2014-10-16 21:47:31 +0000
235@@ -78,13 +78,19 @@
236 }
237 }
238
239- Image {
240+ Loader {
241+ id: _innerBackgroundLoader
242+ anchors.fill: parent
243+ sourceComponent: !isOuter ? _innerBackground : undefined
244+ }
245+
246+ Component {
247 id: _innerBackground
248-
249- visible: !isOuter
250- anchors.fill: parent
251- fillMode: Image.PreserveAspectFit
252- source: "../graphics/Inner_Clock_Texture.png"
253+ Image {
254+ smooth: false
255+ fillMode: Image.PreserveAspectFit
256+ source: "../graphics/Inner_Clock_Texture.png"
257+ }
258 }
259
260 /*
261
262=== modified file 'app/components/EmptyState.qml'
263--- app/components/EmptyState.qml 2014-09-12 15:36:38 +0000
264+++ app/components/EmptyState.qml 2014-10-16 21:47:31 +0000
265@@ -19,14 +19,20 @@
266 import QtQuick 2.3
267 import Ubuntu.Components 1.1
268
269+/*
270+ Component which displays an empty state (approved by design). It offers an
271+ icon, title and subtitle to describe the empty state.
272+*/
273+
274 Item {
275+ id: emptyState
276
277+ // Public APIs
278 property alias iconName: emptyIcon.name
279 property alias title: emptyLabel.text
280 property alias subTitle: emptySublabel.text
281
282 height: childrenRect.height
283- width: parent.width
284
285 Icon {
286 id: emptyIcon
287
288=== modified file 'app/worldclock/WorldCityList.qml'
289--- app/worldclock/WorldCityList.qml 2014-10-15 20:42:24 +0000
290+++ app/worldclock/WorldCityList.qml 2014-10-16 21:47:31 +0000
291@@ -64,8 +64,9 @@
292 text: i18n.tr("City")
293 onTriggered: {
294 worldCityList.state = "search"
295+ searchComponentLoader.sourceComponent = searchComponent
296 jsonTimeZoneModelLoader.sourceComponent = jsonTimeZoneModelComponent
297- searchField.forceActiveFocus()
298+ searchComponentLoader.item.forceActiveFocus()
299 }
300 }
301 ]
302@@ -79,59 +80,66 @@
303 text: i18n.tr("Back")
304 onTriggered: {
305 cityList.forceActiveFocus()
306- searchField.text = ""
307+ searchComponentLoader.item.text = ""
308 worldCityList.state = "default"
309 isOnlineMode = false
310+ searchComponentLoader.sourceComponent = undefined
311 jsonTimeZoneModelLoader.sourceComponent = undefined
312 }
313 }
314
315- contents: TextField {
316- id: searchField
317- objectName: "searchField"
318-
319- inputMethodHints: Qt.ImhNoPredictiveText
320- placeholderText: i18n.tr("Search...")
321-
322+ contents: Loader {
323+ id: searchComponentLoader
324 anchors {
325 left: parent ? parent.left : undefined
326 right: parent ? parent.right : undefined
327 rightMargin: units.gu(2)
328 }
329-
330- Timer {
331- id: search_timer
332- interval: isOnlineMode ? 1 : 500
333- repeat: false
334- onTriggered: {
335- isOnlineMode = false
336- console.log("Search string: " + searchField.text)
337-
338- if(!isOnlineMode && sortedTimeZoneModel.count === 0) {
339- console.log("Enabling online mode")
340- isOnlineMode = true
341- }
342-
343- if(isOnlineMode) {
344- var url = String("%1%2%3")
345- .arg("http://geoname-lookup.ubuntu.com/?query=")
346- .arg(searchField.text)
347- .arg("&app=com.ubuntu.clock&version=3.2.x")
348- console.log("Online URL: " + url)
349- if (jsonTimeZoneModelLoader.status === Loader.Ready) {
350- jsonTimeZoneModel.source = Qt.resolvedUrl(url)
351- }
352- }
353- }
354- }
355-
356- onTextChanged: {
357- search_timer.restart()
358- }
359 }
360 }
361 ]
362
363+ Component {
364+ id: searchComponent
365+ TextField {
366+ id: searchField
367+ objectName: "searchField"
368+
369+ inputMethodHints: Qt.ImhNoPredictiveText
370+ placeholderText: i18n.tr("Search...")
371+
372+ Timer {
373+ id: search_timer
374+ interval: isOnlineMode ? 1 : 500
375+ repeat: false
376+ onTriggered: {
377+ isOnlineMode = false
378+ console.log("Search string: " + searchField.text)
379+
380+ if(!isOnlineMode && sortedTimeZoneModel.count === 0) {
381+ console.log("Enabling online mode")
382+ isOnlineMode = true
383+ }
384+
385+ if(isOnlineMode) {
386+ var url = String("%1%2%3")
387+ .arg("http://geoname-lookup.ubuntu.com/?query=")
388+ .arg(searchField.text)
389+ .arg("&app=com.ubuntu.clock&version=3.2.x")
390+ console.log("Online URL: " + url)
391+ if (jsonTimeZoneModelLoader.status === Loader.Ready) {
392+ jsonTimeZoneModel.source = Qt.resolvedUrl(url)
393+ }
394+ }
395+ }
396+ }
397+
398+ onTextChanged: {
399+ search_timer.restart()
400+ }
401+ }
402+ }
403+
404 Connections {
405 target: clockApp
406 onApplicationStateChanged: {
407@@ -193,7 +201,8 @@
408 sort.property: "city"
409 sort.order: Qt.AscendingOrder
410 filter.property: "city"
411- filter.pattern: RegExp(searchField.text, "gi")
412+ filter.pattern: searchComponentLoader.status === Loader.Ready ? RegExp(searchComponentLoader.item.text, "gi")
413+ : RegExp("", "gi")
414 }
415
416 Label {
417
418=== modified file 'debian/changelog'
419--- debian/changelog 2014-10-15 21:01:31 +0000
420+++ debian/changelog 2014-10-16 21:47:31 +0000
421@@ -21,6 +21,10 @@
422 dynamically (LP: #1381429)
423 * Replaced ListItem.Base with ListItem.Empty throughout the clock app to reduce
424 creation time (performance).
425+ * Dynamically load/unload the search mode in world city list and multiselect view in
426+ alarm page which reduces the creation time by a few ms.
427+ * Unload the inner clock texture when not required. Inner clock texture smooth is
428+ now set to false to improve startup animation.
429 * Customised splash screen (white background) (LP: #1377638)
430
431 [Akiva Shammai Avraham]

Subscribers

People subscribed via source and target branches