Merge lp:~renatofilho/ubuntu-calendar-app/optimize-page-load into lp:ubuntu-calendar-app

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 757
Merged at revision: 752
Proposed branch: lp:~renatofilho/ubuntu-calendar-app/optimize-page-load
Merge into: lp:ubuntu-calendar-app
Prerequisite: lp:~renatofilho/ubuntu-calendar-app/sdk-1-3
Diff against target: 376 lines (+176/-109)
2 files modified
Settings.qml (+1/-1)
calendar.qml (+175/-108)
To merge this branch: bzr merge lp:~renatofilho/ubuntu-calendar-app/optimize-page-load
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Approve
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Review via email: mp+284456@code.launchpad.net

Commit message

Simplify Tab loading, declaring individual components for each tab.
Make sure that year view is not loaded on app startup without request.

Description of the change

Simplify Tab loading, declaring individual components for each tab.
Make sure that year view is not loaded on app startup without request.

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
752. By Renato Araujo Oliveira Filho

Merged: ~renatofilho/ubuntu-calendar-app/sdk-1-3

753. By Renato Araujo Oliveira Filho

Merged: lp:~renatofilho/ubuntu-calendar-app/sdk-1-3

754. By Renato Araujo Oliveira Filho

Merged. ~renatofilho/ubuntu-calendar-app/sdk-1-3/

755. By Renato Araujo Oliveira Filho

Parent branch merged.

Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Something is messed up here. I am seeing Year/Month/Day/Agenda views, but no week view.
In some circumstances I see two Year views.

review: Needs Fixing
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

> Something is messed up here. I am seeing Year/Month/Day/Agenda views, but no
> week view.
> In some circumstances I see two Year views.

Fixed on parent branch, since this is related with the new SDK header.

756. By Renato Araujo Oliveira Filho

Parent merged:

757. By Renato Araujo Oliveira Filho

Parent merged.

Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Now I'm getting a completely blank screen:-

libust[28446/28448]: Error: Error opening shm /lttng-ust-wait-5 (in get_wait_shm() at lttng-ust-comm.c:958)
libust[28446/28448]: Error: Error opening shm /lttng-ust-wait-5 (in get_wait_shm() at lttng-ust-comm.c:958)
Loading module: 'libubuntu_application_api_touch_mirclient.so.3.0.0'

(process:28446): dconf-WARNING **: Unable to open /custom/xdg/data/dconf/profile/custom: Permission denied

(process:28446): dconf-WARNING **: unable to open named profile (custom): using the null configuration.
file:///opt/click.ubuntu.com/com.ubuntu.calendar/0.4.756/calendar.qml:382: ReferenceError: reloadTabActions is not defined
Changing properties of arguments dynamically is not supported.
Changing properties of arguments dynamically is not supported.
UbuntuClipboard - Got invalid serialized mime data. Ignoring it.

http://people.canonical.com/~alan/screenshots/device-2016-02-02-015628.png
http://people.canonical.com/~alan/screenshots/device-2016-02-02-015640.png

review: Needs Fixing
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

That got it!

review: Approve
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) :
review: Approve (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-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=== modified file 'Settings.qml'
2--- Settings.qml 2016-02-02 01:56:49 +0000
3+++ Settings.qml 2016-02-02 01:56:49 +0000
4@@ -27,7 +27,7 @@
5 visible: false
6
7 head {
8- title: i18n.tr("Settings")
9+ title: i18n.tr("Settings")
10 backAction: Action {
11 text: i18n.tr("Back")
12 iconName: "back"
13
14=== modified file 'calendar.qml'
15--- calendar.qml 2016-02-02 01:56:49 +0000
16+++ calendar.qml 2016-02-02 01:56:49 +0000
17@@ -126,6 +126,7 @@
18 }
19 }
20
21+ // Load events after the app startup
22 Timer {
23 id: applyFilterTimer
24 interval: 200; running: false; repeat: false
25@@ -157,6 +158,16 @@
26 id: collectionFilter
27 }
28
29+ InvalidFilter {
30+ id: invalidFilter
31+ }
32+
33+ IntersectionFilter {
34+ id: mainFilter
35+
36+ filters: [ collectionFilter, itemTypeFilter]
37+ }
38+
39 EventListModel{
40 id: eventModel
41
42@@ -164,9 +175,7 @@
43 startPeriod: tabs.currentDay
44 endPeriod: tabs.currentDay
45
46- filter: IntersectionFilter {
47- filters: [ collectionFilter, itemTypeFilter]
48- }
49+ filter: invalidFilter
50
51 function delayedApplyFilter() {
52 applyFilterTimer.restart();
53@@ -182,6 +191,7 @@
54 }
55 }
56 collectionFilter.ids = collectionIds;
57+ filter = mainFilter
58 }
59
60 function showEventFromId(eventId) {
61@@ -225,6 +235,7 @@
62 id: tabs
63 Keys.forwardTo: [tabs.currentPage]
64
65+ property bool isReady: false
66 property var currentDay: DateExt.today();
67 property var selectedDay;
68
69@@ -368,6 +379,7 @@
70 else {
71 tabs.selectedTabIndex = settings.defaultViewIndex;
72 }
73+ tabs.isReady = true
74 } // End of Component.onCompleted:
75
76
77@@ -393,139 +405,194 @@
78 }
79 }
80
81- onSelectedTabChanged: {
82- switch (tabs.selectedTab) {
83- case yearTab:{
84- if (yearTab.page === null) {
85- var yearViewCom = Qt.createComponent("YearView.qml");
86- if (yearViewCom.status === Component.Ready) {
87- var yearViewObj = yearViewCom.createObject(mainView);
88-
89- yearViewObj.monthSelected.connect(function (date){
90- var now = DateExt.today();
91- if( date.getMonth() === now.getMonth()
92- && date.getFullYear() === now.getFullYear()) {
93- tabs.currentDay = now;
94- } else {
95- tabs.currentDay = date.midnight();
96- }
97- tabs.selectedTabIndex = monthTab.index;
98- })
99-
100- yearTab.page = yearViewObj;
101- }
102- } else {
103- yearTab.page.refreshCurrentYear(DateExt.today().getFullYear());
104- }
105- } break;
106- case monthTab: {
107- if (monthTab.page === null) {
108- var monthViewCom = Qt.createComponent("MonthView.qml");
109- if (monthViewCom.status === Component.Ready) {
110- var monthViewObj = monthViewCom.createObject(mainView);
111-
112- monthViewObj.dateSelected.connect(function (date) {
113- tabs.currentDay = date;
114- tabs.selectedTabIndex = dayTab.index;
115- })
116-
117- monthTab.page = monthViewObj;
118- }
119- } else {
120- monthTab.page.currentMonth = tabs.currentDay.midnight();
121- }
122- } break;
123- case weekTab: {
124- if (weekTab.page === null) {
125- var weekViewCom = Qt.createComponent("WeekView.qml");
126- if (weekViewCom.status === Component.Ready) {
127- var weekViewObj = weekViewCom.createObject(mainView);
128-
129- weekViewObj.isCurrentPage = Qt.binding(function() { return tabs.selectedTab == weekTab })
130- weekViewObj.onDayStartChanged.connect(function (){
131- tabs.currentDay = weekViewObj.dayStart;
132- });
133- weekViewObj.dateSelected.connect(function (date){
134- tabs.currentDay = date;
135- tabs.selectedTabIndex = dayTab.index;
136- });
137-
138- weekTab.page = weekViewObj;
139- }
140- } else {
141- weekTab.page.dayStart = tabs.currentDay;
142- }
143- } break;
144- case dayTab: {
145- if (dayTab.page === null) {
146- var dayViewCom = Qt.createComponent("DayView.qml");
147- if (dayViewCom.status === Component.Ready) {
148- var dayViewObj = dayViewCom.createObject(mainView);
149-
150- dayViewObj.isCurrentPage= Qt.binding(function() { return tabs.selectedTab == dayTab })
151- dayViewObj.onCurrentDayChanged.connect(function (){
152- tabs.currentDay = dayViewObj.currentDay;
153- });
154- dayViewObj.dateSelected.connect(function (date) {
155- tabs.currentDay = date;
156- });
157-
158- dayTab.page =dayViewObj;
159- }
160- } else {
161- dayTab.page.currentDay = tabs.currentDay;
162- }
163- } break;
164- case agendaTab: {
165- var agendaViewCom = Qt.createComponent("AgendaView.qml");
166- if (agendaViewCom.status === Component.Ready) {
167- var agendaViewObj = agendaViewCom.createObject(mainView);
168-
169- agendaViewObj.dateSelected.connect(function (date){
170- tabs.currentDay = date;
171- tabs.selectedTabIndex = dayTab.index;
172- })
173- agendaTab.page = agendaViewObj;
174- }
175- } break;
176- default:
177- break;
178- }
179- }
180-
181 Tab{
182 id: yearTab
183 objectName: "yearTab"
184 title: i18n.tr("Year")
185- page: null
186+
187+ page: Loader {
188+ id: yearViewLoader
189+
190+ asynchronous: true
191+ sourceComponent: yearViewComp
192+ active: false
193+ // Load page on demand and keep it on memory until the application is closed
194+ enabled: tabs.isReady && (tabs.selectedTab == yearTab)
195+ onEnabledChanged: {
196+ if (enabled && !active) {
197+ active = true
198+ }
199+ }
200+ }
201 }
202
203 Tab{
204 id: monthTab
205 objectName: "monthTab"
206 title: i18n.tr("Month")
207- page: null
208+
209+ page: Loader {
210+ id: monthTabLoader
211+
212+ asynchronous: true
213+ sourceComponent: monthViewComp
214+ active: false
215+ // Load page on demand and keep it on memory until the application is closed
216+ enabled: tabs.isReady && (tabs.selectedTab == monthTab)
217+ onEnabledChanged: {
218+ if (enabled && !active) {
219+ active = true
220+ }
221+ }
222+ }
223 }
224
225 Tab{
226 id: weekTab
227 objectName: "weekTab"
228 title: i18n.tr("Week")
229- page: null
230+
231+ page: Loader {
232+ id: weekTabLoader
233+
234+ asynchronous: true
235+ sourceComponent: weekViewComp
236+ active: false
237+ // Load page on demand and keep it on memory until the application is closed
238+ enabled: tabs.isReady && (tabs.selectedTab == weekTab)
239+ onEnabledChanged: {
240+ if (enabled && !active) {
241+ active = true
242+ }
243+ }
244+ }
245 }
246
247 Tab{
248 id: dayTab
249 objectName: "dayTab"
250 title: i18n.tr("Day")
251- page: null
252+
253+ page:Loader {
254+ id: dayTabLoader
255+
256+ asynchronous: true
257+ sourceComponent: dayViewComp
258+ active: false
259+ // Load page on demand and keep it on memory until the application is closed
260+ enabled: tabs.isReady && (tabs.selectedTab == dayTab)
261+ onEnabledChanged: {
262+ if (enabled && !active) {
263+ active = true
264+ }
265+ }
266+ }
267 }
268
269 Tab {
270 id: agendaTab
271 objectName: "agendaTab"
272 title: i18n.tr("Agenda")
273- page: null
274+
275+ page: Loader {
276+ id: agendaTabLoader
277+
278+ asynchronous: true
279+ sourceComponent: agendaViewComp
280+ active: false
281+ // Load page on demand and keep it on memory until the application is closed
282+ enabled: tabs.isReady && (tabs.selectedTab == agendaTab)
283+ onEnabledChanged: {
284+ if (enabled && !active) {
285+ active = true
286+ }
287+ }
288+ }
289+ }
290+ }
291+ }
292+
293+ Component {
294+ id: yearViewComp
295+
296+ YearView {
297+ onMonthSelected: {
298+ var now = DateExt.today();
299+ if ((date.getMonth() === now.getMonth()) &&
300+ (date.getFullYear() === now.getFullYear())) {
301+ tabs.currentDay = now;
302+ } else {
303+ tabs.currentDay = date.midnight();
304+ }
305+ tabs.selectedTabIndex = monthTab.index;
306+ }
307+ onActiveChanged: {
308+ if (active) {
309+ refreshCurrentYear(DateExt.today().getFullYear())
310+ }
311+ }
312+ }
313+ }
314+
315+ Component {
316+ id: monthViewComp
317+
318+ MonthView {
319+ onDateSelected: {
320+ tabs.currentDay = date;
321+ tabs.selectedTabIndex = dayTab.index
322+ }
323+ onActiveChanged: {
324+ if (active)
325+ currentMonth = tabs.currentDay.midnight()
326+ }
327+ }
328+ }
329+
330+ Component {
331+ id: weekViewComp
332+
333+ WeekView {
334+ onDayStartChanged: {
335+ tabs.currentDay = dayStart
336+ }
337+ onDateSelected: {
338+ tabs.currentDay = date;
339+ tabs.selectedTabIndex = dayTab.index
340+ }
341+ onActiveChanged: {
342+ if (active)
343+ dayStart = tabs.currentDay
344+ }
345+ }
346+ }
347+
348+ Component {
349+ id: dayViewComp
350+
351+ DayView {
352+ onCurrentDayChanged: {
353+ tabs.currentDay = currentDay;
354+ }
355+
356+ onDateSelected: {
357+ tabs.currentDay = date
358+ }
359+
360+ onActiveChanged: {
361+ if (active)
362+ currentDay = tabs.currentDay;
363+ }
364+ }
365+ }
366+
367+ Component {
368+ id: agendaViewComp
369+
370+ AgendaView {
371+ onDateSelected: {
372+ tabs.currentDay = date;
373+ tabs.selectedTabIndex = dayTab.index
374 }
375 }
376 }

Subscribers

People subscribed via source and target branches

to status/vote changes: