Merge lp:~pkunal-parmar/ubuntu-calendar-app/EventView-Perf into lp:ubuntu-calendar-app
- EventView-Perf
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Mihir Soni | ||||
Approved revision: | 240 | ||||
Merged at revision: | 235 | ||||
Proposed branch: | lp:~pkunal-parmar/ubuntu-calendar-app/EventView-Perf | ||||
Merge into: | lp:ubuntu-calendar-app | ||||
Diff against target: |
492 lines (+68/-105) 9 files modified
AllDayEventComponent.qml (+6/-16) EventDetails.qml (+4/-4) EventListModel.qml (+16/-6) GlobalEventModel.js (+0/-9) NewEvent.qml (+2/-4) TimeLineBase.qml (+11/-24) TimeLineBaseComponent.qml (+16/-0) WeekView.qml (+4/-22) calendar.qml (+9/-20) |
||||
To merge this branch: | bzr merge lp:~pkunal-parmar/ubuntu-calendar-app/EventView-Perf | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mihir Soni | Approve | ||
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Review via email: mp+214369@code.launchpad.net |
Commit message
fixes Bug #1301910
Now removing Global model and as suggested by renato, creating model for individual view and performing operation in scope of Organizer Model's thread.
Description of the change
fixes Bug #1301910
Now removing Global model and as suggested by renato, creating model for individual view and performing operation in scope of Organizer Model's thread.
- 235. By Kunal Parmar
-
removed unnecessary print
- 236. By Kunal Parmar
-
commented out code removed
- 237. By Kunal Parmar
-
unnecessary import removed
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Kunal Parmar (pkunal-parmar) wrote : | # |
Here is demo
Mihir Soni (mihirsoni) wrote : | # |
Kunal ,
it looks good to me and now it more smoother in transition.
off the topic, We have to change this architecture in all the places, like creating new event, editing & updating new event ?
Because after importing your branch, i tried to edit my event and try to save it , it gives me following console ouput.
TypeError: Cannot call method 'saveItem' of undefined
- 238. By Kunal Parmar
-
Edit case handled
Kunal Parmar (pkunal-parmar) wrote : | # |
> Kunal ,
>
> it looks good to me and now it more smoother in transition.
>
> off the topic, We have to change this architecture in all the places, like
> creating new event, editing & updating new event ?
>
> Because after importing your branch, i tried to edit my event and try to save
> it , it gives me following console ouput.
>
> TypeError: Cannot call method 'saveItem' of undefined
Indeed, model was not set in edit case.
Other case should work, let me know if you face issue.
- 239. By Kunal Parmar
-
Command line argument case handled
- 240. By Kunal Parmar
-
AllDay event handled
Mihir Soni (mihirsoni) wrote : | # |
Hi Kunal,
I am not sure is it my system fault or not ,
but i see little delay in getting reload the view , I have captured the video if you see i have created event with recurrence of daily :-
if you see when i switch days it is taking some delays to display the same event.
https:/
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:240
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Kunal Parmar (pkunal-parmar) wrote : | # |
If you are talking about delay in model refresh, then it not in our hand, as we are rendering event bubble async when model data is available.
As such I dont see any lag in GUI.
Mihir Soni (mihirsoni) wrote : | # |
Okay kunal, got it.
Thanks i tested it apart from this everything looks good and works good.
Thanks a lot for your MR.
Kunal Parmar (pkunal-parmar) wrote : | # |
ok, great, I am going to propose some more merge, that should help at certain extend to resolve that problem.
I guess as both day and week view is now trying to set date, EDS model is getting confused and rejects some requests. That's just my guess.
Mihir Soni (mihirsoni) wrote : | # |
Preview Diff
1 | === modified file 'AllDayEventComponent.qml' | |||
2 | --- AllDayEventComponent.qml 2014-03-19 00:32:29 +0000 | |||
3 | +++ AllDayEventComponent.qml 2014-04-05 06:36:44 +0000 | |||
4 | @@ -3,7 +3,6 @@ | |||
5 | 3 | import Ubuntu.Components.Popups 0.1 | 3 | import Ubuntu.Components.Popups 0.1 |
6 | 4 | 4 | ||
7 | 5 | import "dateExt.js" as DateExt | 5 | import "dateExt.js" as DateExt |
8 | 6 | import "GlobalEventModel.js" as GlobalModel | ||
9 | 7 | import "ViewType.js" as ViewType | 6 | import "ViewType.js" as ViewType |
10 | 8 | 7 | ||
11 | 9 | Rectangle{ | 8 | Rectangle{ |
12 | @@ -11,6 +10,7 @@ | |||
13 | 11 | 10 | ||
14 | 12 | property var allDayEvents; | 11 | property var allDayEvents; |
15 | 13 | property var startDay: DateExt.today(); | 12 | property var startDay: DateExt.today(); |
16 | 13 | property var model; | ||
17 | 14 | 14 | ||
18 | 15 | property int type: ViewType.ViewTypeWeek | 15 | property int type: ViewType.ViewTypeWeek |
19 | 16 | 16 | ||
20 | @@ -20,10 +20,9 @@ | |||
21 | 20 | 20 | ||
22 | 21 | function getAllDayEvents(startDate, endDate) { | 21 | function getAllDayEvents(startDate, endDate) { |
23 | 22 | var map = {}; | 22 | var map = {}; |
28 | 23 | var itemIds = GlobalModel.globalModel().itemIds(startDate, endDate); | 23 | var items = model.getItems(startDate,endDate); |
29 | 24 | for(var i = 0 ; i < itemIds.length ; ++i) { | 24 | for(var i = 0 ; i < items.length ; ++i) { |
30 | 25 | var eventId = itemIds[(i)]; | 25 | var event = items[(i)]; |
27 | 26 | var event = GlobalModel.globalModel().item(eventId); | ||
31 | 27 | if( event && event.allDay ) { | 26 | if( event && event.allDay ) { |
32 | 28 | var key = Qt.formatDateTime(event.startDateTime, "dd-MMM-yyyy"); | 27 | var key = Qt.formatDateTime(event.startDateTime, "dd-MMM-yyyy"); |
33 | 29 | if( !(key in map)) { | 28 | if( !(key in map)) { |
34 | @@ -44,15 +43,6 @@ | |||
35 | 44 | allDayEvents = getAllDayEvents(sd,ed); | 43 | allDayEvents = getAllDayEvents(sd,ed); |
36 | 45 | } | 44 | } |
37 | 46 | 45 | ||
38 | 47 | Component.onCompleted: { | ||
39 | 48 | var model = GlobalModel.globalModel(); | ||
40 | 49 | model.reloaded.connect(root.createAllDayEvents); | ||
41 | 50 | } | ||
42 | 51 | |||
43 | 52 | onStartDayChanged: { | ||
44 | 53 | createAllDayEvents(); | ||
45 | 54 | } | ||
46 | 55 | |||
47 | 56 | Row { | 46 | Row { |
48 | 57 | width: parent.width | 47 | width: parent.width |
49 | 58 | anchors.verticalCenter: parent.verticalCenter | 48 | anchors.verticalCenter: parent.verticalCenter |
50 | @@ -81,7 +71,7 @@ | |||
51 | 81 | if( allDayLabel.events.length > 1 ) { | 71 | if( allDayLabel.events.length > 1 ) { |
52 | 82 | PopupUtils.open(popoverComponent, root,{"events": allDayLabel.events}) | 72 | PopupUtils.open(popoverComponent, root,{"events": allDayLabel.events}) |
53 | 83 | } else { | 73 | } else { |
55 | 84 | pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":allDayLabel.events[0]}); | 74 | pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":allDayLabel.events[0],"model": model}); |
56 | 85 | } | 75 | } |
57 | 86 | } | 76 | } |
58 | 87 | } | 77 | } |
59 | @@ -148,7 +138,7 @@ | |||
60 | 148 | anchors.fill: parent | 138 | anchors.fill: parent |
61 | 149 | onClicked: { | 139 | onClicked: { |
62 | 150 | popover.hide(); | 140 | popover.hide(); |
64 | 151 | pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":modelData}); | 141 | pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":modelData,"model": model}); |
65 | 152 | } | 142 | } |
66 | 153 | } | 143 | } |
67 | 154 | } | 144 | } |
68 | 155 | 145 | ||
69 | === modified file 'EventDetails.qml' | |||
70 | --- EventDetails.qml 2014-04-04 02:27:33 +0000 | |||
71 | +++ EventDetails.qml 2014-04-05 06:36:44 +0000 | |||
72 | @@ -5,7 +5,6 @@ | |||
73 | 5 | import Ubuntu.Components.Themes.Ambiance 0.1 | 5 | import Ubuntu.Components.Themes.Ambiance 0.1 |
74 | 6 | import QtOrganizer 5.0 | 6 | import QtOrganizer 5.0 |
75 | 7 | 7 | ||
76 | 8 | import "GlobalEventModel.js" as GlobalModel | ||
77 | 9 | import "Defines.js" as Defines | 8 | import "Defines.js" as Defines |
78 | 10 | 9 | ||
79 | 11 | Page { | 10 | Page { |
80 | @@ -14,6 +13,8 @@ | |||
81 | 14 | property var event; | 13 | property var event; |
82 | 15 | property string headerColor :"black" | 14 | property string headerColor :"black" |
83 | 16 | property string detailColor :"grey" | 15 | property string detailColor :"grey" |
84 | 16 | property var model; | ||
85 | 17 | |||
86 | 17 | anchors.fill: parent | 18 | anchors.fill: parent |
87 | 18 | Component.onCompleted: { | 19 | Component.onCompleted: { |
88 | 19 | if( pageStack.header ) | 20 | if( pageStack.header ) |
89 | @@ -101,8 +102,7 @@ | |||
90 | 101 | text: i18n.tr("Delete"); | 102 | text: i18n.tr("Delete"); |
91 | 102 | iconSource: "image://theme/delete,edit-delete-symbolic" | 103 | iconSource: "image://theme/delete,edit-delete-symbolic" |
92 | 103 | onTriggered: { | 104 | onTriggered: { |
95 | 104 | var eventModel = GlobalModel.globalModel(); | 105 | model.removeItem(event); |
94 | 105 | eventModel.removeItem(event); | ||
96 | 106 | pageStack.pop(); | 106 | pageStack.pop(); |
97 | 107 | } | 107 | } |
98 | 108 | } | 108 | } |
99 | @@ -113,7 +113,7 @@ | |||
100 | 113 | text: i18n.tr("Edit"); | 113 | text: i18n.tr("Edit"); |
101 | 114 | iconSource: Qt.resolvedUrl("edit.svg"); | 114 | iconSource: Qt.resolvedUrl("edit.svg"); |
102 | 115 | onTriggered: { | 115 | onTriggered: { |
104 | 116 | pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"event":event}); | 116 | pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"event":event,"model":model}); |
105 | 117 | } | 117 | } |
106 | 118 | } | 118 | } |
107 | 119 | } | 119 | } |
108 | 120 | 120 | ||
109 | === modified file 'EventListModel.qml' | |||
110 | --- EventListModel.qml 2014-02-26 13:42:20 +0000 | |||
111 | +++ EventListModel.qml 2014-04-05 06:36:44 +0000 | |||
112 | @@ -1,16 +1,26 @@ | |||
113 | 1 | import QtQuick 2.0 | 1 | import QtQuick 2.0 |
114 | 2 | import "dateExt.js" as DateExt | ||
115 | 3 | |||
116 | 4 | import QtOrganizer 5.0 | 2 | import QtOrganizer 5.0 |
117 | 5 | 3 | ||
118 | 6 | OrganizerModel { | 4 | OrganizerModel { |
119 | 7 | id: eventModel | 5 | id: eventModel |
120 | 8 | manager:"eds" | 6 | manager:"eds" |
124 | 9 | autoUpdate: false | 7 | |
125 | 10 | 8 | property var listeners:[]; | |
126 | 11 | signal reloaded | 9 | |
127 | 10 | function addModelChangeListener(listener){ | ||
128 | 11 | listeners.push(listener); | ||
129 | 12 | } | ||
130 | 13 | |||
131 | 14 | function getItems(startDate, endDate){ | ||
132 | 15 | return itemsByTimePeriod(startDate,endDate); | ||
133 | 16 | } | ||
134 | 12 | 17 | ||
135 | 13 | onModelChanged: { | 18 | onModelChanged: { |
137 | 14 | reloaded(); | 19 | if(listeners === undefined){ |
138 | 20 | return; | ||
139 | 21 | } | ||
140 | 22 | for(var i=0; i < listeners.length ;++i){ | ||
141 | 23 | (listeners[i])(); | ||
142 | 24 | } | ||
143 | 15 | } | 25 | } |
144 | 16 | } | 26 | } |
145 | 17 | 27 | ||
146 | === removed file 'GlobalEventModel.js' | |||
147 | --- GlobalEventModel.js 2014-01-31 03:20:40 +0000 | |||
148 | +++ GlobalEventModel.js 1970-01-01 00:00:00 +0000 | |||
149 | @@ -1,9 +0,0 @@ | |||
150 | 1 | .pragma library | ||
151 | 2 | |||
152 | 3 | var model; | ||
153 | 4 | function globalModel() { | ||
154 | 5 | if( !model) { | ||
155 | 6 | model = Qt.createQmlObject('import QtQuick 2.0; EventListModel {}', Qt.application, 'EventListModel.globalModel()') | ||
156 | 7 | } | ||
157 | 8 | return model; | ||
158 | 9 | } | ||
159 | 10 | 0 | ||
160 | === modified file 'NewEvent.qml' | |||
161 | --- NewEvent.qml 2014-03-27 14:54:30 +0000 | |||
162 | +++ NewEvent.qml 2014-04-05 06:36:44 +0000 | |||
163 | @@ -6,7 +6,6 @@ | |||
164 | 6 | import Ubuntu.Components.Themes.Ambiance 0.1 | 6 | import Ubuntu.Components.Themes.Ambiance 0.1 |
165 | 7 | import QtOrganizer 5.0 | 7 | import QtOrganizer 5.0 |
166 | 8 | 8 | ||
167 | 9 | import "GlobalEventModel.js" as GlobalModel | ||
168 | 10 | import "Defines.js" as Defines | 9 | import "Defines.js" as Defines |
169 | 11 | 10 | ||
170 | 12 | Page { | 11 | Page { |
171 | @@ -14,6 +13,7 @@ | |||
172 | 14 | property var date: new Date(); | 13 | property var date: new Date(); |
173 | 15 | 14 | ||
174 | 16 | property var event:null; | 15 | property var event:null; |
175 | 16 | property var model; | ||
176 | 17 | 17 | ||
177 | 18 | property var startDate; | 18 | property var startDate; |
178 | 19 | property var endDate; | 19 | property var endDate; |
179 | @@ -35,7 +35,6 @@ | |||
180 | 35 | endDate = new Date(date) | 35 | endDate = new Date(date) |
181 | 36 | endDate.setMinutes( endDate.getMinutes() + 30) | 36 | endDate.setMinutes( endDate.getMinutes() + 30) |
182 | 37 | } | 37 | } |
183 | 38 | internal.eventModel = GlobalModel.globalModel(); | ||
184 | 39 | 38 | ||
185 | 40 | if(event === null){ | 39 | if(event === null){ |
186 | 41 | isEdit =false; | 40 | isEdit =false; |
187 | @@ -154,7 +153,7 @@ | |||
188 | 154 | event.setDetail(audibleReminder); | 153 | event.setDetail(audibleReminder); |
189 | 155 | } | 154 | } |
190 | 156 | 155 | ||
192 | 157 | internal.eventModel.saveItem(event); | 156 | model.saveItem(event); |
193 | 158 | pageStack.pop(); | 157 | pageStack.pop(); |
194 | 159 | } | 158 | } |
195 | 160 | } | 159 | } |
196 | @@ -426,7 +425,6 @@ | |||
197 | 426 | 425 | ||
198 | 427 | QtObject { | 426 | QtObject { |
199 | 428 | id: internal | 427 | id: internal |
200 | 429 | property var eventModel; | ||
201 | 430 | 428 | ||
202 | 431 | function clearFocus() { | 429 | function clearFocus() { |
203 | 432 | Qt.inputMethod.hide() | 430 | Qt.inputMethod.hide() |
204 | 433 | 431 | ||
205 | === modified file 'TimeLineBase.qml' | |||
206 | --- TimeLineBase.qml 2014-03-26 14:39:17 +0000 | |||
207 | +++ TimeLineBase.qml 2014-04-05 06:36:44 +0000 | |||
208 | @@ -1,7 +1,6 @@ | |||
209 | 1 | import QtQuick 2.0 | 1 | import QtQuick 2.0 |
210 | 2 | import Ubuntu.Components 0.1 | 2 | import Ubuntu.Components 0.1 |
211 | 3 | import "dateExt.js" as DateExt | 3 | import "dateExt.js" as DateExt |
212 | 4 | import "GlobalEventModel.js" as GlobalModel | ||
213 | 5 | 4 | ||
214 | 6 | Item { | 5 | Item { |
215 | 7 | id: bubbleOverLay | 6 | id: bubbleOverLay |
216 | @@ -10,49 +9,38 @@ | |||
217 | 10 | property var day; | 9 | property var day; |
218 | 11 | property int hourHeight: units.gu(10) | 10 | property int hourHeight: units.gu(10) |
219 | 12 | 11 | ||
229 | 13 | Component.onCompleted: { | 12 | property var model; |
221 | 14 | intern.model = GlobalModel.globalModel(); | ||
222 | 15 | intern.model.reloaded.connect(bubbleOverLay.createEvents); | ||
223 | 16 | } | ||
224 | 17 | |||
225 | 18 | onDayChanged: { | ||
226 | 19 | if( intern.model) | ||
227 | 20 | bubbleOverLay.createEvents(); | ||
228 | 21 | } | ||
230 | 22 | 13 | ||
231 | 23 | TimeSeparator{ | 14 | TimeSeparator{ |
232 | 24 | id: separator | 15 | id: separator |
233 | 25 | objectName: "separator" | 16 | objectName: "separator" |
234 | 26 | width: bubbleOverLay.width | 17 | width: bubbleOverLay.width |
235 | 18 | visible: false | ||
236 | 27 | z:1 | 19 | z:1 |
237 | 28 | } | 20 | } |
238 | 29 | 21 | ||
239 | 30 | QtObject { | 22 | QtObject { |
240 | 31 | id: intern | 23 | id: intern |
241 | 32 | property var now : new Date(); | 24 | property var now : new Date(); |
242 | 33 | property var model; | ||
243 | 34 | } | 25 | } |
244 | 35 | 26 | ||
245 | 36 | function showEventDetails(event) { | 27 | function showEventDetails(event) { |
247 | 37 | pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":event}); | 28 | pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":event,"model":model}); |
248 | 38 | } | 29 | } |
249 | 39 | 30 | ||
250 | 40 | function createEvents() { | 31 | function createEvents() { |
251 | 41 | if(!bubbleOverLay || bubbleOverLay == undefined) { | 32 | if(!bubbleOverLay || bubbleOverLay == undefined) { |
252 | 42 | return; | 33 | return; |
253 | 43 | } | 34 | } |
256 | 44 | 35 | destroyAllChildren(); | |
255 | 45 | bubbleOverLay.destroyAllChildren(); | ||
257 | 46 | 36 | ||
258 | 47 | var startDate = new Date(day).midnight(); | 37 | var startDate = new Date(day).midnight(); |
259 | 48 | |||
260 | 49 | var endDate = new Date(day).endOfDay(); | 38 | var endDate = new Date(day).endOfDay(); |
261 | 50 | 39 | ||
267 | 51 | var itemIds = intern.model.itemIds(startDate,endDate); | 40 | var items = model.getItems(startDate,endDate); |
268 | 52 | for(var i = 0 ; i < itemIds.length ; ++i) { | 41 | for(var i = 0 ; i < items.length ; ++i) { |
269 | 53 | var eventId = itemIds[(i)]; | 42 | var event = items[i]; |
270 | 54 | var event = intern.model.item(eventId); | 43 | if(event.allDay === false) { |
266 | 55 | if( event ) { | ||
271 | 56 | bubbleOverLay.createEvent(event,event.startDateTime.getHours()); | 44 | bubbleOverLay.createEvent(event,event.startDateTime.getHours()); |
272 | 57 | } | 45 | } |
273 | 58 | } | 46 | } |
274 | @@ -64,10 +52,8 @@ | |||
275 | 64 | 52 | ||
276 | 65 | function destroyAllChildren() { | 53 | function destroyAllChildren() { |
277 | 66 | for( var i = children.length - 1; i >= 0; --i ) { | 54 | for( var i = children.length - 1; i >= 0; --i ) { |
282 | 67 | if( children[i].objectName === "separator") { | 55 | children[i].visible = false; |
283 | 68 | children[i].visible = false; | 56 | if( children[i].objectName !== "separator") { |
280 | 69 | } else { | ||
281 | 70 | children[i].visible = false; | ||
284 | 71 | children[i].destroy(); | 57 | children[i].destroy(); |
285 | 72 | } | 58 | } |
286 | 73 | } | 59 | } |
287 | @@ -75,6 +61,7 @@ | |||
288 | 75 | 61 | ||
289 | 76 | function createEvent( event ,hour) { | 62 | function createEvent( event ,hour) { |
290 | 77 | var eventBubble = delegate.createObject(bubbleOverLay); | 63 | var eventBubble = delegate.createObject(bubbleOverLay); |
291 | 64 | |||
292 | 78 | eventBubble.clicked.connect( bubbleOverLay.showEventDetails ); | 65 | eventBubble.clicked.connect( bubbleOverLay.showEventDetails ); |
293 | 79 | 66 | ||
294 | 80 | var yPos = (( event.startDateTime.getMinutes() * hourHeight) / 60) + hour * hourHeight | 67 | var yPos = (( event.startDateTime.getMinutes() * hourHeight) / 60) + hour * hourHeight |
295 | 81 | 68 | ||
296 | === modified file 'TimeLineBaseComponent.qml' | |||
297 | --- TimeLineBaseComponent.qml 2014-03-26 14:29:37 +0000 | |||
298 | +++ TimeLineBaseComponent.qml 2014-04-05 06:36:44 +0000 | |||
299 | @@ -27,6 +27,13 @@ | |||
300 | 27 | } | 27 | } |
301 | 28 | } | 28 | } |
302 | 29 | 29 | ||
303 | 30 | EventListModel { | ||
304 | 31 | id: mainModel | ||
305 | 32 | startPeriod: startDay.midnight(); | ||
306 | 33 | endPeriod: type == ViewType.ViewTypeWeek ? startPeriod.addDays(7).endOfDay(): startPeriod.endOfDay() | ||
307 | 34 | } | ||
308 | 35 | |||
309 | 36 | |||
310 | 30 | Column { | 37 | Column { |
311 | 31 | anchors.top: parent.top | 38 | anchors.top: parent.top |
312 | 32 | 39 | ||
313 | @@ -37,6 +44,10 @@ | |||
314 | 37 | id: allDayContainer | 44 | id: allDayContainer |
315 | 38 | type: root.type | 45 | type: root.type |
316 | 39 | startDay: root.startDay | 46 | startDay: root.startDay |
317 | 47 | model: mainModel | ||
318 | 48 | Component.onCompleted: { | ||
319 | 49 | model.addModelChangeListener(createAllDayEvents); | ||
320 | 50 | } | ||
321 | 40 | } | 51 | } |
322 | 41 | 52 | ||
323 | 42 | Flickable{ | 53 | Flickable{ |
324 | @@ -75,6 +86,11 @@ | |||
325 | 75 | height: parent.height | 86 | height: parent.height |
326 | 76 | delegate: comp | 87 | delegate: comp |
327 | 77 | day: startDay.addDays(index) | 88 | day: startDay.addDays(index) |
328 | 89 | |||
329 | 90 | model: mainModel | ||
330 | 91 | Component.onCompleted: { | ||
331 | 92 | model.addModelChangeListener(createEvents); | ||
332 | 93 | } | ||
333 | 78 | } | 94 | } |
334 | 79 | } | 95 | } |
335 | 80 | } | 96 | } |
336 | 81 | 97 | ||
337 | === modified file 'WeekView.qml' | |||
338 | --- WeekView.qml 2014-03-26 19:06:27 +0000 | |||
339 | +++ WeekView.qml 2014-04-05 06:36:44 +0000 | |||
340 | @@ -29,7 +29,7 @@ | |||
341 | 29 | id: weekHeader | 29 | id: weekHeader |
342 | 30 | objectName: "weekHeader" | 30 | objectName: "weekHeader" |
343 | 31 | type: ViewType.ViewTypeWeek | 31 | type: ViewType.ViewTypeWeek |
345 | 32 | date: weekViewPath.weekStart | 32 | date: firstDay |
346 | 33 | 33 | ||
347 | 34 | onDateSelected: { | 34 | onDateSelected: { |
348 | 35 | root.dateSelected(date); | 35 | root.dateSelected(date); |
349 | @@ -39,9 +39,6 @@ | |||
350 | 39 | PathViewBase{ | 39 | PathViewBase{ |
351 | 40 | id: weekViewPath | 40 | id: weekViewPath |
352 | 41 | 41 | ||
353 | 42 | property var visibleWeek: dayStart.weekStart(Qt.locale().firstDayOfWeek); | ||
354 | 43 | property var weekStart: weekViewPath.visibleWeek | ||
355 | 44 | |||
356 | 45 | width: parent.width | 42 | width: parent.width |
357 | 46 | height: root.height - weekViewPath.y | 43 | height: root.height - weekViewPath.y |
358 | 47 | 44 | ||
359 | @@ -59,13 +56,11 @@ | |||
360 | 59 | } | 56 | } |
361 | 60 | 57 | ||
362 | 61 | function nextWeek() { | 58 | function nextWeek() { |
365 | 62 | var weekStartDay = visibleWeek.weekStart(Qt.locale().firstDayOfWeek); | 59 | dayStart = firstDay.addDays(7); |
364 | 63 | dayStart = weekStartDay.addDays(7); | ||
366 | 64 | } | 60 | } |
367 | 65 | 61 | ||
368 | 66 | function previousWeek(){ | 62 | function previousWeek(){ |
371 | 67 | var weekStartDay = visibleWeek.weekStart(Qt.locale().firstDayOfWeek); | 63 | dayStart = firstDay.addDays(-7); |
370 | 68 | dayStart = weekStartDay.addDays(-7); | ||
372 | 69 | } | 64 | } |
373 | 70 | 65 | ||
374 | 71 | delegate: TimeLineBaseComponent { | 66 | delegate: TimeLineBaseComponent { |
375 | @@ -76,7 +71,7 @@ | |||
376 | 76 | width: parent.width | 71 | width: parent.width |
377 | 77 | height: parent.height | 72 | height: parent.height |
378 | 78 | 73 | ||
380 | 79 | startDay: getWeekStart(); | 74 | startDay: firstDay.addDays( weekViewPath.indexType(index) * 7) |
381 | 80 | 75 | ||
382 | 81 | Connections{ | 76 | Connections{ |
383 | 82 | target: root | 77 | target: root |
384 | @@ -102,19 +97,6 @@ | |||
385 | 102 | value: contentY | 97 | value: contentY |
386 | 103 | when: timeLineView.PathView.isCurrentItem | 98 | when: timeLineView.PathView.isCurrentItem |
387 | 104 | } | 99 | } |
388 | 105 | |||
389 | 106 | function getWeekStart() { | ||
390 | 107 | switch( weekViewPath.indexType(index)) { | ||
391 | 108 | case 0: | ||
392 | 109 | return weekViewPath.weekStart; | ||
393 | 110 | case -1: | ||
394 | 111 | var weekStartDay= weekViewPath.weekStart.weekStart(Qt.locale().firstDayOfWeek); | ||
395 | 112 | return weekStartDay.addDays(-7); | ||
396 | 113 | case 1: | ||
397 | 114 | var weekStartDay = weekViewPath.weekStart.weekStart(Qt.locale().firstDayOfWeek); | ||
398 | 115 | return weekStartDay.addDays(7); | ||
399 | 116 | } | ||
400 | 117 | } | ||
401 | 118 | } | 100 | } |
402 | 119 | } | 101 | } |
403 | 120 | } | 102 | } |
404 | 121 | 103 | ||
405 | === modified file 'calendar.qml' | |||
406 | --- calendar.qml 2014-04-04 02:38:06 +0000 | |||
407 | +++ calendar.qml 2014-04-05 06:36:44 +0000 | |||
408 | @@ -3,7 +3,6 @@ | |||
409 | 3 | import Ubuntu.Components.Popups 0.1 | 3 | import Ubuntu.Components.Popups 0.1 |
410 | 4 | 4 | ||
411 | 5 | import "dateExt.js" as DateExt | 5 | import "dateExt.js" as DateExt |
412 | 6 | import "GlobalEventModel.js" as GlobalModel | ||
413 | 7 | 6 | ||
414 | 8 | MainView { | 7 | MainView { |
415 | 9 | id: mainView | 8 | id: mainView |
416 | @@ -68,7 +67,6 @@ | |||
417 | 68 | id: tabPage | 67 | id: tabPage |
418 | 69 | 68 | ||
419 | 70 | property var currentDay: DateExt.today(); | 69 | property var currentDay: DateExt.today(); |
420 | 71 | property var globalModel; | ||
421 | 72 | 70 | ||
422 | 73 | // Arguments on startup | 71 | // Arguments on startup |
423 | 74 | property bool newevent: false; | 72 | property bool newevent: false; |
424 | @@ -88,18 +86,6 @@ | |||
425 | 88 | 86 | ||
426 | 89 | if( !weekView.dayStart.isSameDay(currentDay)) | 87 | if( !weekView.dayStart.isSameDay(currentDay)) |
427 | 90 | weekView.dayStart = currentDay | 88 | weekView.dayStart = currentDay |
428 | 91 | |||
429 | 92 | setStartEndDateToModel(); | ||
430 | 93 | } | ||
431 | 94 | |||
432 | 95 | function setStartEndDateToModel() { | ||
433 | 96 | if(globalModel) { | ||
434 | 97 | globalModel.startPeriod = new Date(currentDay.getFullYear(),0,1,0,0,0,0); | ||
435 | 98 | globalModel.endPeriod = new Date(currentDay.getFullYear(),11,31,0,0,0,0); | ||
436 | 99 | // only enable auto update after set the date interval | ||
437 | 100 | globalModel.autoUpdate = true | ||
438 | 101 | globalModel.update() | ||
439 | 102 | } | ||
440 | 103 | } | 89 | } |
441 | 104 | 90 | ||
442 | 105 | function newEvent() { | 91 | function newEvent() { |
443 | @@ -124,7 +110,7 @@ | |||
444 | 124 | endDate = new Date(endTime); | 110 | endDate = new Date(endTime); |
445 | 125 | } | 111 | } |
446 | 126 | } | 112 | } |
448 | 127 | pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"startDate": startDate, "endDate": endDate}); | 113 | pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"startDate": startDate, "endDate": endDate, "model":eventModel}); |
449 | 128 | } | 114 | } |
450 | 129 | 115 | ||
451 | 130 | // This function calculate the difference between --endtime and --starttime and choose the better view | 116 | // This function calculate the difference between --endtime and --starttime and choose the better view |
452 | @@ -159,7 +145,6 @@ | |||
453 | 159 | 145 | ||
454 | 160 | if (endtimepattern.test(url)) | 146 | if (endtimepattern.test(url)) |
455 | 161 | endtime = url.match(/endtime=(\d+)/)[0].replace("endtime=", ''); | 147 | endtime = url.match(/endtime=(\d+)/)[0].replace("endtime=", ''); |
456 | 162 | |||
457 | 163 | } | 148 | } |
458 | 164 | 149 | ||
459 | 165 | Component.onCompleted: { | 150 | Component.onCompleted: { |
460 | @@ -194,9 +179,6 @@ | |||
461 | 194 | else { | 179 | else { |
462 | 195 | tabs.selectedTabIndex= 1; | 180 | tabs.selectedTabIndex= 1; |
463 | 196 | } | 181 | } |
464 | 197 | |||
465 | 198 | globalModel = GlobalModel.globalModel(); | ||
466 | 199 | setStartEndDateToModel(); | ||
467 | 200 | } // End of Component.onCompleted: | 182 | } // End of Component.onCompleted: |
468 | 201 | 183 | ||
469 | 202 | // This is for wait that the app is load when newEvent is invoked by argument | 184 | // This is for wait that the app is load when newEvent is invoked by argument |
470 | @@ -210,6 +192,13 @@ | |||
471 | 210 | } | 192 | } |
472 | 211 | } | 193 | } |
473 | 212 | 194 | ||
474 | 195 | EventListModel{ | ||
475 | 196 | id: eventModel | ||
476 | 197 | //This model is just for newevent | ||
477 | 198 | //so we dont need any update | ||
478 | 199 | autoUpdate: false | ||
479 | 200 | } | ||
480 | 201 | |||
481 | 213 | ToolbarItems { | 202 | ToolbarItems { |
482 | 214 | id: commonToolBar | 203 | id: commonToolBar |
483 | 215 | 204 | ||
484 | @@ -229,7 +218,7 @@ | |||
485 | 229 | iconSource: Qt.resolvedUrl("new-event.svg"); | 218 | iconSource: Qt.resolvedUrl("new-event.svg"); |
486 | 230 | text: i18n.tr("New Event"); | 219 | text: i18n.tr("New Event"); |
487 | 231 | onTriggered: { | 220 | onTriggered: { |
489 | 232 | pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"date":tabPage.currentDay}); | 221 | pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"date":tabPage.currentDay,"model":eventModel}); |
490 | 233 | } | 222 | } |
491 | 234 | } | 223 | } |
492 | 235 | } | 224 | } |
PASSED: Continuous integration, rev:237 91.189. 93.70:8080/ job/ubuntu- calendar- app-ci/ 366/ 91.189. 93.70:8080/ job/generic- mediumtests- trusty/ 1982 91.189. 93.70:8080/ job/ubuntu- calendar- app-raring- amd64-ci/ 366 91.189. 93.70:8080/ job/ubuntu- calendar- app-saucy- amd64-ci/ 366 91.189. 93.70:8080/ job/ubuntu- calendar- app-trusty- amd64-ci/ 200
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/ubuntu- calendar- app-ci/ 366/rebuild
http://