Merge lp:~pkunal-parmar/ubuntu-calendar-app/YearMonthPerformance into lp:ubuntu-calendar-app
- YearMonthPerformance
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Mihir Soni |
Approved revision: | 524 |
Merged at revision: | 526 |
Proposed branch: | lp:~pkunal-parmar/ubuntu-calendar-app/YearMonthPerformance |
Merge into: | lp:ubuntu-calendar-app |
Diff against target: |
372 lines (+209/-95) 6 files modified
MonthComponent.qml (+3/-1) MonthComponentDateDelegate.qml.moved (+72/-0) MonthView.qml (+23/-12) YearView.qml (+14/-81) YearViewDelegate.qml (+96/-0) tests/autopilot/calendar_app/__init__.py (+1/-1) |
To merge this branch: | bzr merge lp:~pkunal-parmar/ubuntu-calendar-app/YearMonthPerformance |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Mihir Soni | Approve | ||
Review via email: mp+239261@code.launchpad.net |
Commit message
Loading some components using Loader asynchronous to improve Yearview and MonthView performance
Description of the change
Loading some components using Loader asynchronous to improve Yearview and MonthView performance
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:522
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Mihir Soni (mihirsoni) wrote : | # |
Looks good to me and has improved yearview loading by few seconds.
Wonderful !!
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
Unapproved changes made after approval.
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:523
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
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://
deb: http://
SUCCESS: http://
- 524. By Kunal Parmar
-
temp
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:524
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'MonthComponent.qml' |
2 | --- MonthComponent.qml 2014-10-22 13:41:52 +0000 |
3 | +++ MonthComponent.qml 2014-10-23 12:51:37 +0000 |
4 | @@ -24,6 +24,8 @@ |
5 | id: root |
6 | objectName: "MonthComponent" |
7 | |
8 | + property bool isCurrentItem; |
9 | + |
10 | property bool showEvents: false |
11 | |
12 | property var currentMonth; |
13 | @@ -66,7 +68,7 @@ |
14 | EventListModel { |
15 | id: mainModel |
16 | startPeriod: intern.monthStart.midnight(); |
17 | - endPeriod: intern.monthStart.addDays((monthGrid.weekCount*7)-1).endOfDay() |
18 | + endPeriod: intern.monthStart.addDays((/*monthGrid.weekCount*/ 6 * 7)-1).endOfDay() |
19 | filter: eventModel.filter |
20 | onModelChanged: { |
21 | intern.eventStatus = Qt.binding(function() { return mainModel.containsItems(startPeriod,endPeriod,24*60*60)}); |
22 | |
23 | === added file 'MonthComponentDateDelegate.qml.moved' |
24 | --- MonthComponentDateDelegate.qml.moved 1970-01-01 00:00:00 +0000 |
25 | +++ MonthComponentDateDelegate.qml.moved 2014-10-23 12:51:37 +0000 |
26 | @@ -0,0 +1,72 @@ |
27 | +import QtQuick 2.0 |
28 | +import Ubuntu.Components 1.1 |
29 | + |
30 | +Item{ |
31 | + id: dateRootItem |
32 | + |
33 | + property int date; |
34 | + property bool isCurrentMonth; |
35 | + property bool isToday |
36 | + |
37 | + Loader { |
38 | + width: parent.width < parent.height ? parent.width : parent.height |
39 | + height: width |
40 | + anchors.centerIn: parent |
41 | + sourceComponent: isToday && isCurrentMonth ? highLightComp : undefined |
42 | + } |
43 | + |
44 | + Label { |
45 | + id: dateLabel |
46 | + anchors.centerIn: parent |
47 | + width: parent.width |
48 | + text: date |
49 | + horizontalAlignment: Text.AlignHCenter |
50 | + fontSize: root.dateLabelFontSize |
51 | + color: { |
52 | + if( isCurrentMonth ) { |
53 | + if(isToday) { |
54 | + "white" |
55 | + } else { |
56 | + "#5D5D5D" |
57 | + } |
58 | + } else { |
59 | + "#AEA79F" |
60 | + } |
61 | + } |
62 | + } |
63 | + |
64 | + Loader{ |
65 | + property bool shouldLoad: showEvents |
66 | + && intern.eventStatus !== undefined |
67 | + && intern.eventStatus[index] !== undefined |
68 | + &&intern.eventStatus[index] |
69 | + sourceComponent: shouldLoad ? eventIndicatorComp : undefined |
70 | + anchors.top: dateLabel.bottom |
71 | + anchors.horizontalCenter: dateLabel.horizontalCenter |
72 | + } |
73 | + |
74 | + MouseArea { |
75 | + anchors.fill: parent |
76 | + onPressAndHold: { |
77 | + var selectedDate = new Date(); |
78 | + selectedDate.setFullYear(intern.monthStartYear) |
79 | + selectedDate.setMonth(intern.monthStartMonth + 1) |
80 | + selectedDate.setDate(date) |
81 | + selectedDate.setMinutes(60, 0, 0) |
82 | + pageStack.push(Qt.resolvedUrl("NewEvent.qml"), {"date":selectedDate, "model":eventModel}); |
83 | + } |
84 | + onClicked: { |
85 | + var selectedDate = new Date(intern.monthStartYear, |
86 | + intern.monthStartMonth, |
87 | + intern.monthStartDate + index, 0, 0, 0, 0) |
88 | + //If monthView is clicked then open selected DayView |
89 | + if ( isYearView === false ) { |
90 | + root.dateSelected(selectedDate); |
91 | + } |
92 | + //If yearView is clicked then open selected MonthView |
93 | + else { |
94 | + root.monthSelected(selectedDate); |
95 | + } |
96 | + } |
97 | + } |
98 | +} |
99 | |
100 | === modified file 'MonthView.qml' |
101 | --- MonthView.qml 2014-10-02 13:44:25 +0000 |
102 | +++ MonthView.qml 2014-10-23 12:51:37 +0000 |
103 | @@ -89,21 +89,32 @@ |
104 | return new Date(date.getFullYear(), date.getMonth() + month, 1, 0, 0, 0); |
105 | } |
106 | |
107 | - delegate: MonthComponent { |
108 | - property bool isCurrentItem: index === monthViewPath.currentIndex |
109 | - |
110 | - showEvents: true |
111 | - |
112 | + delegate: Loader { |
113 | width: parent.width - units.gu(4) |
114 | height: parent.height |
115 | |
116 | - currentMonth: monthViewPath.addMonth(monthViewPath.startMonth, |
117 | - monthViewPath.indexType(index)); |
118 | - |
119 | - isYearView: false |
120 | - |
121 | - onDateSelected: { |
122 | - monthViewPage.dateSelected(date); |
123 | + sourceComponent: delegateComponent |
124 | + asynchronous: index !== monthViewPath.currentIndex |
125 | + |
126 | + Component { |
127 | + id: delegateComponent |
128 | + |
129 | + MonthComponent { |
130 | + isCurrentItem: index === monthViewPath.currentIndex |
131 | + |
132 | + showEvents: true |
133 | + |
134 | + anchors.fill: parent |
135 | + |
136 | + currentMonth: monthViewPath.addMonth(monthViewPath.startMonth, |
137 | + monthViewPath.indexType(index)); |
138 | + |
139 | + isYearView: false |
140 | + |
141 | + onDateSelected: { |
142 | + monthViewPage.dateSelected(date); |
143 | + } |
144 | + } |
145 | } |
146 | } |
147 | } |
148 | |
149 | === modified file 'YearView.qml' |
150 | --- YearView.qml 2014-10-02 13:44:25 +0000 |
151 | +++ YearView.qml 2014-10-23 12:51:37 +0000 |
152 | @@ -62,92 +62,25 @@ |
153 | currentYear = currentYear - 1; |
154 | } |
155 | |
156 | - delegate: GridView{ |
157 | - id: yearView |
158 | - clip: true |
159 | - focus: index == yearPathView.currentIndex |
160 | - |
161 | - property int scrollMonth: 0; |
162 | - property bool isCurrentItem: index == yearPathView.currentIndex |
163 | - property int year: (yearViewPage.currentYear + yearPathView.indexType(index)) |
164 | - |
165 | + delegate: Loader { |
166 | width: parent.width |
167 | height: parent.height |
168 | anchors.top: parent.top |
169 | |
170 | - readonly property int minCellWidth: units.gu(30) |
171 | - cellWidth: Math.floor(Math.min.apply(Math, [3, 4].map(function(n) |
172 | - { return ((width / n >= minCellWidth) ? width / n : width / 2) }))) |
173 | - |
174 | - cellHeight: cellWidth * 1.4 |
175 | - |
176 | - model: 12 /* months in a year */ |
177 | - |
178 | - onYearChanged: { |
179 | - scrollMonth = 0; |
180 | - var today = new Date(); |
181 | - if(year == today.getFullYear()) { |
182 | - scrollMonth = today.getMonth(); |
183 | - } |
184 | - yearView.positionViewAtIndex(scrollMonth, GridView.Beginning); |
185 | - } |
186 | - |
187 | - //scroll in case content height changed |
188 | - onHeightChanged: { |
189 | - yearView.positionViewAtIndex(scrollMonth, GridView.Beginning); |
190 | - } |
191 | - |
192 | - Component.onCompleted: { |
193 | - yearView.positionViewAtIndex(scrollMonth, GridView.Beginning); |
194 | - } |
195 | - |
196 | - Connections{ |
197 | - target: yearPathView |
198 | - onScrollUp: { |
199 | - scrollMonth -= 2; |
200 | - if(scrollMonth < 0) { |
201 | - scrollMonth = 0; |
202 | - } |
203 | - yearView.positionViewAtIndex(scrollMonth, GridView.Beginning); |
204 | - } |
205 | - |
206 | - onScrollDown: { |
207 | - scrollMonth += 2; |
208 | - var visibleMonths = yearView.height / cellHeight; |
209 | - if( scrollMonth >= (11 - visibleMonths)) { |
210 | - scrollMonth = (11 - visibleMonths); |
211 | - } |
212 | - yearView.positionViewAtIndex(scrollMonth, GridView.Beginning); |
213 | - } |
214 | - } |
215 | - |
216 | - delegate: Item { |
217 | - width: yearView.cellWidth |
218 | - height: yearView.cellHeight |
219 | - |
220 | - UbuntuShape { |
221 | + asynchronous: index !== yearPathView.currentIndex |
222 | + sourceComponent: delegateComponent |
223 | + |
224 | + Component{ |
225 | + id: delegateComponent |
226 | + |
227 | + YearViewDelegate{ |
228 | + focus: index == yearPathView.currentIndex |
229 | + |
230 | + scrollMonth: 0; |
231 | + isCurrentItem: index == yearPathView.currentIndex |
232 | + year: (yearViewPage.currentYear + yearPathView.indexType(index)) |
233 | + |
234 | anchors.fill: parent |
235 | - anchors.margins: units.gu(0.5) |
236 | - radius: "medium" |
237 | - |
238 | - MonthComponent { |
239 | - id: monthComponent |
240 | - objectName: "monthComponent" + index |
241 | - showEvents: false |
242 | - currentMonth: new Date(yearView.year, index, 1, 0, 0, 0, 0) |
243 | - |
244 | - isYearView: true |
245 | - anchors.fill: parent |
246 | - |
247 | - dayLabelFontSize:"x-small" |
248 | - dateLabelFontSize: "medium" |
249 | - monthLabelFontSize: "medium" |
250 | - yearLabelFontSize: "small" |
251 | - |
252 | - onMonthSelected: { |
253 | - yearViewPage.monthSelected(date); |
254 | - } |
255 | - } |
256 | } |
257 | } |
258 | } |
259 | |
260 | === added file 'YearViewDelegate.qml' |
261 | --- YearViewDelegate.qml 1970-01-01 00:00:00 +0000 |
262 | +++ YearViewDelegate.qml 2014-10-23 12:51:37 +0000 |
263 | @@ -0,0 +1,96 @@ |
264 | +import QtQuick 2.0 |
265 | +import Ubuntu.Components 1.1 |
266 | + |
267 | +GridView{ |
268 | + id: yearView |
269 | + clip: true |
270 | + |
271 | + property int scrollMonth; |
272 | + property bool isCurrentItem; |
273 | + property int year; |
274 | + |
275 | + readonly property int minCellWidth: units.gu(30) |
276 | + cellWidth: Math.floor(Math.min.apply(Math, [3, 4].map(function(n) |
277 | + { return ((width / n >= minCellWidth) ? width / n : width / 2) }))) |
278 | + |
279 | + cellHeight: cellWidth * 1.4 |
280 | + |
281 | + model: 12 /* months in a year */ |
282 | + |
283 | + onYearChanged: { |
284 | + scrollMonth = 0; |
285 | + var today = new Date(); |
286 | + if(year == today.getFullYear()) { |
287 | + scrollMonth = today.getMonth(); |
288 | + } |
289 | + yearView.positionViewAtIndex(scrollMonth, GridView.Beginning); |
290 | + } |
291 | + |
292 | + //scroll in case content height changed |
293 | + onHeightChanged: { |
294 | + yearView.positionViewAtIndex(scrollMonth, GridView.Beginning); |
295 | + } |
296 | + |
297 | + Component.onCompleted: { |
298 | + yearView.positionViewAtIndex(scrollMonth, GridView.Beginning); |
299 | + } |
300 | + |
301 | + Connections{ |
302 | + target: yearPathView |
303 | + onScrollUp: { |
304 | + scrollMonth -= 2; |
305 | + if(scrollMonth < 0) { |
306 | + scrollMonth = 0; |
307 | + } |
308 | + yearView.positionViewAtIndex(scrollMonth, GridView.Beginning); |
309 | + } |
310 | + |
311 | + onScrollDown: { |
312 | + scrollMonth += 2; |
313 | + var visibleMonths = yearView.height / cellHeight; |
314 | + if( scrollMonth >= (11 - visibleMonths)) { |
315 | + scrollMonth = (11 - visibleMonths); |
316 | + } |
317 | + yearView.positionViewAtIndex(scrollMonth, GridView.Beginning); |
318 | + } |
319 | + } |
320 | + |
321 | + delegate: Loader { |
322 | + width: yearView.cellWidth |
323 | + height: yearView.cellHeight |
324 | + |
325 | + sourceComponent: delegateComponent |
326 | + asynchronous: !yearView.focus |
327 | + |
328 | + Component { |
329 | + id: delegateComponent |
330 | + |
331 | + UbuntuShape { |
332 | + anchors.fill: parent |
333 | + anchors.margins: units.gu(0.5) |
334 | + radius: "medium" |
335 | + |
336 | + MonthComponent { |
337 | + id: monthComponent |
338 | + objectName: "monthComponent" + index |
339 | + showEvents: false |
340 | + currentMonth: new Date(yearView.year, index, 1, 0, 0, 0, 0) |
341 | + |
342 | + isCurrentItem: yearView.focus |
343 | + |
344 | + isYearView: true |
345 | + anchors.fill: parent |
346 | + |
347 | + dayLabelFontSize:"x-small" |
348 | + dateLabelFontSize: "medium" |
349 | + monthLabelFontSize: "medium" |
350 | + yearLabelFontSize: "small" |
351 | + |
352 | + onMonthSelected: { |
353 | + yearViewPage.monthSelected(date); |
354 | + } |
355 | + } |
356 | + } |
357 | + } |
358 | + } |
359 | +} |
360 | |
361 | === modified file 'tests/autopilot/calendar_app/__init__.py' |
362 | --- tests/autopilot/calendar_app/__init__.py 2014-10-22 19:06:26 +0000 |
363 | +++ tests/autopilot/calendar_app/__init__.py 2014-10-23 12:51:37 +0000 |
364 | @@ -299,7 +299,7 @@ |
365 | path_view_base = self.select_single( |
366 | 'PathViewBase', objectName='yearPathView') |
367 | return path_view_base.select_single( |
368 | - ubuntuuitoolkit.QQuickGridView, isCurrentItem=True) |
369 | + "YearViewDelegate", isCurrentItem=True) |
370 | |
371 | def _find_month_component(self, grid, index): |
372 | try: |
FAILED: Continuous integration, rev:521 91.189. 93.70:8080/ job/ubuntu- calendar- app-ci/ 960/ 91.189. 93.70:8080/ job/generic- mediumtests- utopic- python3/ 1183 91.189. 93.70:8080/ job/generic- mediumtests- utopic- python3/ 1183/artifact/ work/output/ *zip*/output. zip 91.189. 93.70:8080/ job/ubuntu- calendar- app-utopic- amd64-ci/ 518
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/ubuntu- calendar- app-ci/ 960/rebuild
http://