Merge lp:~gary-wzl77/ubuntu-calendar-app/optimization_tab_change into lp:ubuntu-calendar-app

Proposed by Gary.Wang
Status: Merged
Approved by: Alan Pope 🍺🐧🐱 πŸ¦„
Approved revision: 718
Merged at revision: 721
Proposed branch: lp:~gary-wzl77/ubuntu-calendar-app/optimization_tab_change
Merge into: lp:ubuntu-calendar-app
Diff against target: 602 lines (+160/-177)
8 files modified
ContactChoicePopup.qml (+1/-1)
EventBubble.qml (+2/-2)
EventListModel.qml (+1/-2)
NewEvent.qml (+1/-0)
YearView.qml (+7/-1)
YearViewDelegate.qml (+13/-9)
calendar.qml (+106/-133)
po/com.ubuntu.calendar.pot (+29/-29)
To merge this branch: bzr merge lp:~gary-wzl77/ubuntu-calendar-app/optimization_tab_change
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Jenkins Bot continuous-integration Approve
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Review via email: mp+268873@code.launchpad.net

Commit message

Tab change will cause dynamic creation(Qt.ResolvedUrl) for qml object back and forth.Using Qt.CreateComponent for dynamic creation for the first time and reuse existing obj without re-creating.

Description of the change

Tab change will cause dynamic creation(Qt.ResolvedUrl) for qml object back and forth.Using Qt.CreateComponent for dynamic creation for the first time and reuse existing obj without re-creating.

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)
710. By Kunal Parmar

resolves Bug #1473679
. Fixes: https://bugs.launchpad.net/bugs/1473679.

Approved by Alan Pope ξƒΏ, Ubuntu Phone Apps Jenkins Bot.

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

LGTM.

review: Approve
711. By Kunal Parmar

resolves Bug #1479533 . Fixes: https://bugs.launchpad.net/bugs/1479533.

Approved by Alan Pope ξƒΏ, Ubuntu Phone Apps Jenkins Bot.

712. By Launchpad Translations on behalf of ubuntu-calendar-dev

Launchpad automatic translations update.

713. By Launchpad Translations on behalf of ubuntu-calendar-dev

Launchpad automatic translations update.

714. By Launchpad Translations on behalf of ubuntu-calendar-dev

Launchpad automatic translations update.

715. By Kunal Parmar

resolves Bug #1475747 . Fixes: https://bugs.launchpad.net/bugs/1475747.

Approved by Mihir Soni, Ubuntu Phone Apps Jenkins Bot.

716. By Launchpad Translations on behalf of ubuntu-calendar-dev

Launchpad automatic translations update.

717. By Launchpad Translations on behalf of ubuntu-calendar-dev

Launchpad automatic translations update.

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
718. By Gary.Wang

Merge from trunk to resolve conflict

Revision history for this message
Jenkins Bot (ubuntu-core-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)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ContactChoicePopup.qml'
2--- ContactChoicePopup.qml 2014-09-20 10:45:35 +0000
3+++ ContactChoicePopup.qml 2015-10-28 02:24:40 +0000
4@@ -94,7 +94,7 @@
5 objectName: "contactPopoverList"
6 width: parent.width
7 model: contactModel
8- height: units.gu(30)
9+ height: units.gu(15)
10 clip: true
11 delegate: Standard{
12 objectName: "contactPopoverList%1".arg(index)
13
14=== modified file 'EventBubble.qml'
15--- EventBubble.qml 2015-01-22 19:34:59 +0000
16+++ EventBubble.qml 2015-10-28 02:24:40 +0000
17@@ -221,8 +221,8 @@
18 anchors.fill: parent
19 drag.target: isLiveEditing ? infoBubble : null
20 drag.axis: Drag.YAxis
21- drag.minimumY: flickable.y
22- drag.maximumY: flickable.contentHeight - infoBubble.height
23+ drag.minimumY: flickable === null? 0: flickable.y
24+ drag.maximumY: flickable === null? 0 :flickable.contentHeight - infoBubble.height
25 onReleased: parent.Drag.drop()
26 onClicked: {
27 if( isLiveEditing ) {
28
29=== modified file 'EventListModel.qml'
30--- EventListModel.qml 2015-08-02 03:59:08 +0000
31+++ EventListModel.qml 2015-10-28 02:24:40 +0000
32@@ -44,7 +44,7 @@
33 var newObject = Qt.createQmlObject("import QtQuick 2.3; Timer {interval: 1000; running: true; repeat: false;}",
34 eventModel, "EventListMode.qml");
35 newObject.onTriggered.connect( function(){
36- var items = getItems(eventModel.startPeriod, eventModel.endPeriod);
37+ var items = itemsByTimePeriod(eventModel.startPeriod, eventModel.endPeriod);
38 if( isLoading == true && items.length === 0) {
39 isLoading = false;
40 modelChanged();
41@@ -53,7 +53,6 @@
42 });
43 }
44
45-
46 onModelChanged: {
47 isLoading = false
48 if(listeners === undefined){
49
50=== modified file 'NewEvent.qml'
51--- NewEvent.qml 2015-08-04 02:18:52 +0000
52+++ NewEvent.qml 2015-10-28 02:24:40 +0000
53@@ -255,6 +255,7 @@
54
55 model.saveItem(event);
56 pageStack.pop();
57+
58 root.eventAdded(event);
59 }
60 }
61
62=== modified file 'YearView.qml'
63--- YearView.qml 2015-02-18 19:27:20 +0000
64+++ YearView.qml 2015-10-28 02:24:40 +0000
65@@ -29,6 +29,12 @@
66
67 Keys.forwardTo: [yearPathView]
68
69+ function refreshCurrentYear(year) {
70+ currentYear = year;
71+ var yearViewDelegate = yearPathView.currentItem.item;
72+ yearViewDelegate.refresh();
73+ }
74+
75 Action {
76 id: calendarTodayAction
77 objectName:"todaybutton"
78@@ -85,7 +91,7 @@
79
80 scrollMonth: 0;
81 isCurrentItem: index == yearPathView.currentIndex
82- year: (yearViewPage.currentYear + yearPathView.indexType(index))
83+ year: (currentYear + yearPathView.indexType(index))
84
85 anchors.fill: parent
86 }
87
88=== modified file 'YearViewDelegate.qml'
89--- YearViewDelegate.qml 2014-11-29 09:40:53 +0000
90+++ YearViewDelegate.qml 2015-10-28 02:24:40 +0000
91@@ -18,6 +18,19 @@
92 model: 12 /* months in a year */
93
94 onYearChanged: {
95+ refresh();
96+ }
97+
98+ //scroll in case content height changed
99+ onHeightChanged: {
100+ yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
101+ }
102+
103+ Component.onCompleted: {
104+ yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
105+ }
106+
107+ function refresh() {
108 scrollMonth = 0;
109 var today = new Date();
110 if(year == today.getFullYear()) {
111@@ -26,15 +39,6 @@
112 yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
113 }
114
115- //scroll in case content height changed
116- onHeightChanged: {
117- yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
118- }
119-
120- Component.onCompleted: {
121- yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
122- }
123-
124 Connections{
125 target: yearPathView
126 onScrollUp: {
127
128=== modified file 'calendar.qml'
129--- calendar.qml 2015-09-05 05:30:23 +0000
130+++ calendar.qml 2015-10-28 02:24:40 +0000
131@@ -211,7 +211,7 @@
132
133 Tabs{
134 id: tabs
135- Keys.forwardTo: [tabs.currentPage.item]
136+ Keys.forwardTo: [tabs.currentPage]
137
138 property var currentDay: DateExt.today();
139 property var selectedDay;
140@@ -342,166 +342,139 @@
141 }
142 }
143
144+ onSelectedTabChanged: {
145+ switch (tabs.selectedTab) {
146+ case yearTab:{
147+ if (yearTab.page === null) {
148+ var yearViewCom = Qt.createComponent("YearView.qml");
149+ if (yearViewCom.status === Component.Ready) {
150+ var yearViewObj = yearViewCom.createObject(mainView);
151+
152+ yearViewObj.monthSelected.connect(function (date){
153+ var now = DateExt.today();
154+ if( date.getMonth() === now.getMonth()
155+ && date.getFullYear() === now.getFullYear()) {
156+ tabs.currentDay = now;
157+ } else {
158+ tabs.currentDay = date.midnight();
159+ }
160+ tabs.selectedTabIndex = monthTab.index;
161+ })
162+
163+ yearTab.page = yearViewObj;
164+ }
165+ } else {
166+ yearTab.page.refreshCurrentYear(DateExt.today().getFullYear());
167+ }
168+ } break;
169+ case monthTab: {
170+ if (monthTab.page === null) {
171+ var monthViewCom = Qt.createComponent("MonthView.qml");
172+ if (monthViewCom.status === Component.Ready) {
173+ var monthViewObj = monthViewCom.createObject(mainView);
174+
175+ monthViewObj.dateSelected.connect(function (date) {
176+ tabs.currentDay = date;
177+ tabs.selectedTabIndex = dayTab.index;
178+ })
179+
180+ monthTab.page = monthViewObj;
181+ }
182+ } else {
183+ monthTab.page.currentMonth = tabs.currentDay.midnight();
184+ }
185+ } break;
186+ case weekTab: {
187+ if (weekTab.page === null) {
188+ var weekViewCom = Qt.createComponent("WeekView.qml");
189+ if (weekViewCom.status === Component.Ready) {
190+ var weekViewObj = weekViewCom.createObject(mainView);
191+
192+ weekViewObj.isCurrentPage = Qt.binding(function() { return tabs.selectedTab == weekTab })
193+ weekViewObj.onDayStartChanged.connect(function (){
194+ tabs.currentDay = weekViewObj.dayStart;
195+ });
196+ weekViewObj.dateSelected.connect(function (date){
197+ tabs.currentDay = date;
198+ tabs.selectedTabIndex = dayTab.index;
199+ });
200+
201+ weekTab.page = weekViewObj;
202+ }
203+ } else {
204+ weekTab.page.dayStart = tabs.currentDay;
205+ }
206+ } break;
207+ case dayTab: {
208+ if (dayTab.page === null) {
209+ var dayViewCom = Qt.createComponent("DayView.qml");
210+ if (dayViewCom.status === Component.Ready) {
211+ var dayViewObj = dayViewCom.createObject(mainView);
212+
213+ dayViewObj.isCurrentPage= Qt.binding(function() { return tabs.selectedTab == dayTab })
214+ dayViewObj.onCurrentDayChanged.connect(function (){
215+ tabs.currentDay = dayViewObj.currentDay;
216+ });
217+ dayViewObj.dateSelected.connect(function (date) {
218+ tabs.currentDay = date;
219+ });
220+
221+ dayTab.page =dayViewObj;
222+ }
223+ } else {
224+ dayTab.page.currentDay = tabs.currentDay;
225+ }
226+ } break;
227+ case agendaTab: {
228+ var agendaViewCom = Qt.createComponent("AgendaView.qml");
229+ if (agendaViewCom.status === Component.Ready) {
230+ var agendaViewObj = agendaViewCom.createObject(mainView);
231+
232+ agendaViewObj.dateSelected.connect(function (date){
233+ tabs.currentDay = date;
234+ tabs.selectedTabIndex = dayTab.index;
235+ })
236+ agendaTab.page = agendaViewObj;
237+ }
238+ } break;
239+ default:
240+ break;
241+ }
242+ }
243+
244 Tab{
245 id: yearTab
246 objectName: "yearTab"
247 title: i18n.tr("Year")
248- page: Loader{
249- id: yearViewLoader
250- objectName: "yearViewLoader"
251- source: tabs.selectedTab == yearTab ? Qt.resolvedUrl("YearView.qml"):""
252- onLoaded: {
253- item.currentYear = tabs.currentDay.getFullYear();
254- }
255-
256- anchors{
257- left: parent.left
258- right: parent.right
259- bottom: parent.bottom
260- }
261-
262- Connections{
263- target: yearViewLoader.item
264- onMonthSelected: {
265- var now = DateExt.today();
266- if( date.getMonth() === now.getMonth()
267- && date.getFullYear() === now.getFullYear()) {
268- tabs.currentDay = now;
269- } else {
270- tabs.currentDay = date.midnight();
271- }
272- tabs.selectedTabIndex = monthTab.index;
273- }
274- }
275- }
276+ page: null
277 }
278
279 Tab{
280 id: monthTab
281 objectName: "monthTab"
282 title: i18n.tr("Month")
283- page: Loader{
284- id: monthViewLoader
285- objectName: "monthViewLoader"
286- source: tabs.selectedTab == monthTab ? Qt.resolvedUrl("MonthView.qml"):""
287- onLoaded: {
288- item.currentMonth = tabs.currentDay.midnight();
289- item.selectedDay = tabs.selectedDay;
290- }
291-
292- anchors{
293- left: parent.left
294- right: parent.right
295- bottom: parent.bottom
296- }
297-
298- Connections{
299- target: monthViewLoader.item
300- onDateSelected: {
301- tabs.currentDay = date;
302- tabs.selectedTabIndex = dayTab.index;
303- }
304-
305- onDateHighlighted:{
306- tabs.selectedDay = date;
307- }
308- }
309- }
310+ page: null
311 }
312
313 Tab{
314 id: weekTab
315 objectName: "weekTab"
316 title: i18n.tr("Week")
317- page: Loader{
318- id: weekViewLoader
319- objectName: "weekViewLoader"
320- source: tabs.selectedTab == weekTab ? Qt.resolvedUrl("WeekView.qml"):""
321- onLoaded: {
322- item.isCurrentPage= Qt.binding(function() { return tabs.selectedTab == weekTab })
323- item.dayStart = tabs.currentDay;
324- item.selectedDay = tabs.selectedDay;
325- }
326-
327- anchors{
328- left: parent.left
329- right: parent.right
330- bottom: parent.bottom
331- }
332-
333- Connections{
334- target: weekViewLoader.item
335- onDayStartChanged: {
336- tabs.currentDay = weekViewLoader.item.dayStart;
337- }
338-
339- onDateSelected: {
340- tabs.currentDay = date;
341- tabs.selectedTabIndex = dayTab.index;
342- }
343-
344- onDateHighlighted:{
345- tabs.selectedDay = date;
346- }
347- }
348- }
349+ page: null
350 }
351
352 Tab{
353 id: dayTab
354 objectName: "dayTab"
355 title: i18n.tr("Day")
356- page: Loader{
357- id: dayViewLoader
358- objectName: "dayViewLoader"
359- source: tabs.selectedTab == dayTab ? Qt.resolvedUrl("DayView.qml"):""
360- onLoaded: {
361- item.isCurrentPage= Qt.binding(function() { return tabs.selectedTab == dayTab })
362- item.currentDay = tabs.currentDay;
363- }
364-
365- anchors{
366- left: parent.left
367- right: parent.right
368- bottom: parent.bottom
369- }
370-
371- Connections{
372- target: dayViewLoader.item
373- onCurrentDayChanged: {
374- tabs.currentDay = dayViewLoader.item.currentDay;
375- }
376-
377- onDateSelected: {
378- tabs.currentDay = date;
379- }
380- }
381- }
382+ page: null
383 }
384
385 Tab {
386 id: agendaTab
387 objectName: "agendaTab"
388 title: i18n.tr("Agenda")
389- page: Loader {
390- id: agendaViewLoader
391- objectName: "agendaViewLoader"
392- source: tabs.selectedTab == agendaTab ? Qt.resolvedUrl("AgendaView.qml"):""
393-
394- anchors{
395- left: parent.left
396- right: parent.right
397- bottom: parent.bottom
398- }
399-
400- Connections{
401- target: agendaViewLoader.item
402- onDateSelected: {
403- tabs.currentDay = date;
404- tabs.selectedTabIndex = dayTab.index;
405- }
406- }
407- }
408+ page: null
409 }
410 }
411 }
412
413=== modified file 'po/com.ubuntu.calendar.pot'
414--- po/com.ubuntu.calendar.pot 2015-08-04 02:18:52 +0000
415+++ po/com.ubuntu.calendar.pot 2015-10-28 02:24:40 +0000
416@@ -8,7 +8,7 @@
417 msgstr ""
418 "Project-Id-Version: \n"
419 "Report-Msgid-Bugs-To: \n"
420-"POT-Creation-Date: 2015-08-04 10:18+0800\n"
421+"POT-Creation-Date: 2015-10-28 10:22+0800\n"
422 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
423 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
424 "Language-Team: LANGUAGE <LL@li.org>\n"
425@@ -18,8 +18,8 @@
426 "Content-Transfer-Encoding: 8bit\n"
427 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
428
429-#: ../AgendaView.qml:51 ../DayView.qml:40 ../MonthView.qml:37
430-#: ../WeekView.qml:42 ../YearView.qml:36
431+#: ../AgendaView.qml:51 ../DayView.qml:40 ../MonthView.qml:39
432+#: ../WeekView.qml:44 ../YearView.qml:42
433 msgid "Today"
434 msgstr ""
435
436@@ -101,7 +101,7 @@
437 #. TRANSLATORS: this is a time formatting string,
438 #. see http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions.
439 #. It's used in the header of the month and week views
440-#: ../DayView.qml:59 ../MonthView.qml:58 ../WeekView.qml:61
441+#: ../DayView.qml:59 ../MonthView.qml:60 ../WeekView.qml:63
442 msgid "MMMM yyyy"
443 msgstr ""
444
445@@ -136,7 +136,7 @@
446 msgid "Delete"
447 msgstr ""
448
449-#: ../EditEventConfirmationDialog.qml:29 ../NewEvent.qml:324
450+#: ../EditEventConfirmationDialog.qml:29 ../NewEvent.qml:325
451 msgid "Edit Event"
452 msgstr ""
453
454@@ -154,7 +154,7 @@
455 msgid "Edit this"
456 msgstr ""
457
458-#: ../EventActions.qml:50 ../NewEvent.qml:324
459+#: ../EventActions.qml:50 ../NewEvent.qml:325
460 msgid "New Event"
461 msgstr ""
462
463@@ -165,7 +165,7 @@
464 msgid "%1 <b>%2</b>"
465 msgstr ""
466
467-#: ../EventDetails.qml:43 ../NewEvent.qml:435
468+#: ../EventDetails.qml:43 ../NewEvent.qml:436
469 msgid "Event Details"
470 msgstr ""
471
472@@ -189,11 +189,11 @@
473 msgid "Edit"
474 msgstr ""
475
476-#: ../EventDetails.qml:354 ../NewEvent.qml:537
477+#: ../EventDetails.qml:354 ../NewEvent.qml:538
478 msgid "Guests"
479 msgstr ""
480
481-#: ../EventDetails.qml:397 ../EventReminder.qml:35 ../NewEvent.qml:634
482+#: ../EventDetails.qml:397 ../EventReminder.qml:35 ../NewEvent.qml:635
483 msgid "Reminder"
484 msgstr ""
485
486@@ -216,7 +216,7 @@
487 #. TRANSLATORS: this refers to how often a recurrent event repeats
488 #. and it is shown as the header of the option selector to choose
489 #. its repetition
490-#: ../EventRepetition.qml:242 ../NewEvent.qml:618
491+#: ../EventRepetition.qml:242 ../NewEvent.qml:619
492 msgid "Repeats"
493 msgstr ""
494
495@@ -267,43 +267,43 @@
496 msgid "End time can't be before start time"
497 msgstr ""
498
499-#: ../NewEvent.qml:334
500+#: ../NewEvent.qml:335
501 msgid "Error"
502 msgstr ""
503
504-#: ../NewEvent.qml:336
505+#: ../NewEvent.qml:337
506 msgid "OK"
507 msgstr ""
508
509-#: ../NewEvent.qml:389
510+#: ../NewEvent.qml:390
511 msgid "From"
512 msgstr ""
513
514-#: ../NewEvent.qml:402
515+#: ../NewEvent.qml:403
516 msgid "To"
517 msgstr ""
518
519-#: ../NewEvent.qml:419
520+#: ../NewEvent.qml:420
521 msgid "All day event"
522 msgstr ""
523
524-#: ../NewEvent.qml:448
525+#: ../NewEvent.qml:449
526 msgid "Event Name"
527 msgstr ""
528
529-#: ../NewEvent.qml:466
530+#: ../NewEvent.qml:467
531 msgid "Description"
532 msgstr ""
533
534-#: ../NewEvent.qml:484
535+#: ../NewEvent.qml:485
536 msgid "Location"
537 msgstr ""
538
539-#: ../NewEvent.qml:499 com.ubuntu.calendar_calendar.desktop.in.in.h:1
540+#: ../NewEvent.qml:500 com.ubuntu.calendar_calendar.desktop.in.in.h:1
541 msgid "Calendar"
542 msgstr ""
543
544-#: ../NewEvent.qml:541
545+#: ../NewEvent.qml:542
546 msgid "Add Guest"
547 msgstr ""
548
549@@ -390,21 +390,21 @@
550 msgid "2 weeks"
551 msgstr ""
552
553-#: ../TimeLineBase.qml:80
554+#: ../TimeLineBase.qml:73
555 msgid "Untitled"
556 msgstr ""
557
558 #. TRANSLATORS: W refers to Week, followed by the actual week number (%1)
559-#: ../TimeLineHeader.qml:52
560+#: ../TimeLineHeader.qml:54
561 #, qt-format
562 msgid "W%1"
563 msgstr ""
564
565-#: ../TimeLineHeader.qml:64
566+#: ../TimeLineHeader.qml:66
567 msgid "All Day"
568 msgstr ""
569
570-#: ../YearView.qml:54
571+#: ../YearView.qml:60
572 #, qt-format
573 msgid "Year %1"
574 msgstr ""
575@@ -416,23 +416,23 @@
576 "about them"
577 msgstr ""
578
579-#: ../calendar.qml:347
580+#: ../calendar.qml:448
581 msgid "Year"
582 msgstr ""
583
584-#: ../calendar.qml:381
585+#: ../calendar.qml:455
586 msgid "Month"
587 msgstr ""
588
589-#: ../calendar.qml:409
590+#: ../calendar.qml:462
591 msgid "Week"
592 msgstr ""
593
594-#: ../calendar.qml:442
595+#: ../calendar.qml:469
596 msgid "Day"
597 msgstr ""
598
599-#: ../calendar.qml:474
600+#: ../calendar.qml:476
601 msgid "Agenda"
602 msgstr ""
603

Subscribers

People subscribed via source and target branches

to status/vote changes: