Merge lp:~pkunal-parmar/ubuntu-calendar-app/YearView-Optimization into lp:ubuntu-calendar-app
- YearView-Optimization
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Nicholas Skaggs | ||||
Approved revision: | 213 | ||||
Merged at revision: | 221 | ||||
Proposed branch: | lp:~pkunal-parmar/ubuntu-calendar-app/YearView-Optimization | ||||
Merge into: | lp:ubuntu-calendar-app | ||||
Diff against target: |
419 lines (+117/-59) 11 files modified
AllDayEventComponent.qml (+3/-0) DayView.qml (+2/-1) MonthComponent.qml (+83/-16) MonthView.qml (+3/-5) TimeLineBase.qml (+4/-0) ViewHeader.qml (+5/-3) WeekView.qml (+3/-3) YearView.qml (+6/-22) calendar.qml (+4/-5) dateExt.js (+2/-2) tests/autopilot/calendar_app/tests/test_yearview.py (+2/-2) |
||||
To merge this branch: | bzr merge lp:~pkunal-parmar/ubuntu-calendar-app/YearView-Optimization | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Nicholas Skaggs (community) | Needs Information | ||
Olivier Tilloy (community) | Approve | ||
Review via email: mp+208910@code.launchpad.net |
Commit message
Year view optimization
Description of the change
Year view optimization
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Olivier Tilloy (osomon) wrote : | # |
This looks good. I’m sure there are further optimizations to be made, but this already reduces significantly some bottlenecks evidenced by the use of the QML profiler.
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://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:205
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: 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://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:206
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:207
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:207
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Nicholas Skaggs (nskaggs) wrote : | # |
App appears to be failing to launch sometimes because of the qt 5.0 bug.
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://
SUCCESS: http://
SUCCESS: http://
SUCCESS: 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://
SUCCESS: http://
SUCCESS: http://
SUCCESS: 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://
SUCCESS: http://
SUCCESS: http://
SUCCESS: 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://
SUCCESS: http://
SUCCESS: http://
SUCCESS: 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://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Nicholas Skaggs (nskaggs) wrote : | # |
Well, given the results, it seems
calendar_
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://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Nicholas Skaggs (nskaggs) wrote : | # |
Both of the aforementioned tests work fine on my local device.. zzzz...
Nicholas Skaggs (nskaggs) wrote : | # |
Despite the confusing jenkins output there are failures:
Desktop run failures;
pastebin.
Device failures;
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://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Kunal Parmar (pkunal-parmar) wrote : | # |
Thanks Nicholas,
Calendar does not launch in my desktop as well, something is wrong. Let me have a look.
Kunal Parmar (pkunal-parmar) wrote : | # |
Now, it works fine on my desktop, there was one variable declared as var instead of int, that was not allowing yearview to be launched and thus whole calendar.
But now it should work fine.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:208
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Nicholas Skaggs (nskaggs) wrote : | # |
shows
Traceback (most recent call last):
File "/usr/lib/
Eventually(
File "/usr/lib/
raise mismatch_error
MismatchError: After 10.0 seconds test failed: None matches Is(None)
This is the logic to confirm the event was created in the day tab. Might be worth having a look to ensure it's valid.
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://
SUCCESS: http://
SUCCESS: http://
SUCCESS: 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://
SUCCESS: http://
SUCCESS: http://
SUCCESS: 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://
SUCCESS: http://
SUCCESS: http://
SUCCESS: 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://
SUCCESS: http://
SUCCESS: http://
FAILURE: 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://
SUCCESS: http://
SUCCESS: http://
SUCCESS: 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://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:209
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Nicholas Skaggs (nskaggs) wrote : | # |
I did initially find a qt5.2 bug I think with switch_to_tab; trying to see if this still exists. The latest test runs seem to go ok.
Nicholas Skaggs (nskaggs) wrote : | # |
Never mind, I still see it happening;
Kunal, is there something the day tab does differently than other tabs qml?
Nicholas Skaggs (nskaggs) wrote : | # |
I filed a bug; https:/
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://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:210
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Kunal Parmar (pkunal-parmar) wrote : | # |
> Never mind, I still see it happening;
>
> http://
> calendar_
> /
>
> Kunal, is there something the day tab does differently than other tabs qml?
Hi Nicholas,
Thanks for your support.
this does not looks nice, I will analyze to see if anything is wrong with Calendar.
will ping you once I am confident, that calendar code is fine.
till then lets put this MR on hold.
~Kunal
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: 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:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Kunal Parmar (pkunal-parmar) wrote : | # |
Now that trunk code is changed, I need to resolve conflict first, I will resolve conflict soon, then we can approve it and merge it.
- 211. By Kunal Parmar
-
merge from trunk
- 212. By Kunal Parmar
-
MonthView layout issue
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:212
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Kunal Parmar (pkunal-parmar) wrote : | # |
Hi Nicholas, Can you please approve now.
- 213. By Kunal Parmar
-
Merge from trunk
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:213
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'AllDayEventComponent.qml' |
2 | --- AllDayEventComponent.qml 2014-02-12 00:08:40 +0000 |
3 | +++ AllDayEventComponent.qml 2014-03-26 15:09:40 +0000 |
4 | @@ -36,6 +36,9 @@ |
5 | } |
6 | |
7 | function createAllDayEvents() { |
8 | + if(!startDay || startDay === undefined) { |
9 | + return; |
10 | + } |
11 | var sd = startDay.midnight(); |
12 | var ed = sd.addDays( (type == ViewType.ViewTypeDay) ? 1 : 7); |
13 | allDayEvents = getAllDayEvents(sd,ed); |
14 | |
15 | === modified file 'DayView.qml' |
16 | --- DayView.qml 2014-03-22 04:43:11 +0000 |
17 | +++ DayView.qml 2014-03-26 15:09:40 +0000 |
18 | @@ -22,7 +22,8 @@ |
19 | |
20 | ViewHeader{ |
21 | id: viewHeader |
22 | - date: currentDay |
23 | + month: currentDay.getMonth() |
24 | + year: currentDay.getFullYear() |
25 | } |
26 | |
27 | TimeLineHeader{ |
28 | |
29 | === modified file 'MonthComponent.qml' |
30 | --- MonthComponent.qml 2014-01-11 05:59:53 +0000 |
31 | +++ MonthComponent.qml 2014-03-26 15:09:40 +0000 |
32 | @@ -7,7 +7,7 @@ |
33 | id: root |
34 | objectName: "MonthComponent" |
35 | |
36 | - property var monthDate; |
37 | + property var currentMonth; |
38 | |
39 | property string dayLabelFontSize: "medium" |
40 | property string dateLabelFontSize: "large" |
41 | @@ -21,6 +21,39 @@ |
42 | |
43 | height: ubuntuShape.height |
44 | |
45 | + QtObject{ |
46 | + id: intern |
47 | + |
48 | + property int curMonthDate: currentMonth.getDate() |
49 | + property int curMonth: currentMonth.getMonth() |
50 | + property int curMonthYear: currentMonth.getFullYear() |
51 | + |
52 | + property var today: DateExt.today() |
53 | + property int todayDate: today.getDate() |
54 | + property int todayMonth: today.getMonth() |
55 | + property int todayYear: today.getFullYear() |
56 | + |
57 | + |
58 | + //date from month will start, this date might be from previous month |
59 | + property var monthStart: currentMonth.weekStart( Qt.locale().firstDayOfWeek ) |
60 | + property int monthStartDate: monthStart.getDate() |
61 | + property int monthStartMonth: monthStart.getMonth() |
62 | + property int monthStartYear: monthStart.getFullYear() |
63 | + |
64 | + property int daysInStartMonth: Date.daysInMonth(monthStartYear, monthStartMonth) |
65 | + property int daysInCurMonth: Date.daysInMonth(curMonthYear,curMonth) |
66 | + |
67 | + //check if current month is start month |
68 | + property bool isCurMonthStartMonth: curMonthDate === monthStartDate |
69 | + && curMonth === monthStartMonth |
70 | + && curMonthYear === monthStartYear |
71 | + |
72 | + //check current month is same as today's month |
73 | + property bool isCurMonthTodayMonth: todayYear === curMonthYear && todayMonth == curMonth |
74 | + //offset from current month's first date to start date of current month |
75 | + property int offset: isCurMonthStartMonth ? -1 : (daysInStartMonth - monthStartDate) |
76 | + } |
77 | + |
78 | UbuntuShape { |
79 | id: ubuntuShape |
80 | |
81 | @@ -38,7 +71,9 @@ |
82 | |
83 | ViewHeader{ |
84 | id: monthHeader |
85 | - date: root.monthDate |
86 | + month: intern.curMonth |
87 | + year: intern.curMonthYear |
88 | + |
89 | monthLabelFontSize: root.monthLabelFontSize |
90 | yearLabelFontSize: root.yearLabelFontSize |
91 | } |
92 | @@ -68,10 +103,12 @@ |
93 | objectName: "monthGrid" |
94 | |
95 | property int weekCount : 6 |
96 | - property var monthStart: root.monthDate.weekStart( Qt.locale().firstDayOfWeek ) |
97 | |
98 | width: parent.width |
99 | - height: parent.height - monthHeader.height - dayLabelRow.height - units.gu(3) |
100 | + height: parent.height - monthGrid.y |
101 | + |
102 | + property int dayWidth: width / 7; |
103 | + property int dayHeight: height / weekCount |
104 | |
105 | rows: weekCount |
106 | columns: 7 |
107 | @@ -91,30 +128,58 @@ |
108 | Item{ |
109 | id: dateRootItem |
110 | |
111 | - property var date: parent.monthStart.addDays(index); |
112 | - property bool isCurrentMonth: DateExt.isSameMonth(root.monthDate,date) |
113 | - |
114 | - width: parent.width / 7; |
115 | - height: parent.height / parent.weekCount |
116 | + property int date: { |
117 | + //try to find date from index and month's first week's first date |
118 | + var temp = intern.daysInStartMonth - intern.offset + index |
119 | + //date exceeds days in startMonth, |
120 | + //this means previous month is over and we are now in current month |
121 | + //to get actual date we need to remove number of days in startMonth |
122 | + if( temp > intern.daysInStartMonth ) { |
123 | + temp = temp - intern.daysInStartMonth |
124 | + //date exceeds days in current month |
125 | + // this means date is from next month |
126 | + //to get actual date we need to remove number of days in current month |
127 | + if( temp > intern.daysInCurMonth ) { |
128 | + temp = temp - intern.daysInCurMonth |
129 | + } |
130 | + } |
131 | + return temp; |
132 | + } |
133 | + |
134 | + property bool isCurrentMonth: { |
135 | + //remove offset from index |
136 | + //if index falls in 1 to no of days in current month |
137 | + //then date is inside current month |
138 | + var temp = index - intern.offset |
139 | + return (temp >= 1 && temp <= intern.daysInCurMonth) |
140 | + } |
141 | + |
142 | + property bool isToday: intern.todayDate == date && intern.isCurMonthTodayMonth |
143 | + |
144 | + width: parent.dayWidth |
145 | + height: parent.dayHeight |
146 | |
147 | Loader { |
148 | width: parent.width < parent.height ? parent.width : parent.height |
149 | height: width |
150 | anchors.centerIn: parent |
151 | - sourceComponent: date.isSameDay(DateExt.today()) && isCurrentMonth ? highLightComp : undefined |
152 | + sourceComponent: isToday && isCurrentMonth ? highLightComp : undefined |
153 | } |
154 | |
155 | Label{ |
156 | id: dateLabel |
157 | anchors.centerIn: parent |
158 | - text: date.getDate() |
159 | + width: parent.width |
160 | + text: date |
161 | horizontalAlignment: Text.AlignHCenter |
162 | fontSize: root.dateLabelFontSize |
163 | color: { |
164 | - if( date.isSameDay(DateExt.today()) && isCurrentMonth ) { |
165 | - "#2C001E" |
166 | - } else if( parent.isCurrentMonth ) { |
167 | - "white" |
168 | + if( isCurrentMonth ) { |
169 | + if(isToday) { |
170 | + "#2C001E" |
171 | + } else { |
172 | + "white" |
173 | + } |
174 | } else { |
175 | "#AEA79F" |
176 | } |
177 | @@ -124,7 +189,9 @@ |
178 | MouseArea{ |
179 | anchors.fill: parent |
180 | onClicked: { |
181 | - root.dateSelected(date); |
182 | + root.dateSelected(new Date(intern.monthStartYear, |
183 | + intern.monthStartMonth, |
184 | + intern.monthStartDate+index,0,0,0,0)); |
185 | } |
186 | } |
187 | } |
188 | |
189 | === modified file 'MonthView.qml' |
190 | --- MonthView.qml 2014-03-19 19:46:58 +0000 |
191 | +++ MonthView.qml 2014-03-26 15:09:40 +0000 |
192 | @@ -38,9 +38,7 @@ |
193 | } |
194 | |
195 | function addMonth(date,month){ |
196 | - var temp = new Date(date.getFullYear(),date.getMonth(),1,0,0,0); |
197 | - temp.setMonth(date.getMonth() + month); |
198 | - return temp; |
199 | + return new Date(date.getFullYear(),date.getMonth()+month,1,0,0,0); |
200 | } |
201 | |
202 | delegate: MonthComponent{ |
203 | @@ -49,12 +47,12 @@ |
204 | width: parent.width - units.gu(5) |
205 | height: parent.height - units.gu(5) |
206 | |
207 | - monthDate: getMonthDate(); |
208 | + currentMonth: getMonthDate(); |
209 | |
210 | function getMonthDate() { |
211 | switch( monthViewPath.indexType(index)) { |
212 | case 0: |
213 | - return monthViewPath.startMonth; |
214 | + return monthViewPath.addMonth(monthViewPath.startMonth,0); |
215 | case -1: |
216 | return monthViewPath.addMonth(monthViewPath.startMonth,-1); |
217 | case 1: |
218 | |
219 | === modified file 'TimeLineBase.qml' |
220 | --- TimeLineBase.qml 2014-03-22 03:49:00 +0000 |
221 | +++ TimeLineBase.qml 2014-03-26 15:09:40 +0000 |
222 | @@ -38,6 +38,10 @@ |
223 | } |
224 | |
225 | function createEvents() { |
226 | + if(!bubbleOverLay || bubbleOverLay == undefined) { |
227 | + return; |
228 | + } |
229 | + |
230 | bubbleOverLay.destroyAllChildren(); |
231 | |
232 | var startDate = new Date(day).midnight(); |
233 | |
234 | === modified file 'ViewHeader.qml' |
235 | --- ViewHeader.qml 2013-10-22 17:32:19 +0000 |
236 | +++ ViewHeader.qml 2014-03-26 15:09:40 +0000 |
237 | @@ -6,7 +6,9 @@ |
238 | width: parent.width |
239 | height: monthLabel.height |
240 | |
241 | - property var date; |
242 | + property int month; |
243 | + property int year; |
244 | + |
245 | property string monthLabelFontSize: "x-large" |
246 | property string yearLabelFontSize: "large" |
247 | |
248 | @@ -14,7 +16,7 @@ |
249 | id: monthLabel |
250 | objectName: "monthLabel" |
251 | fontSize: monthLabelFontSize |
252 | - text: Qt.locale().standaloneMonthName(date.getMonth()) |
253 | + text: Qt.locale().standaloneMonthName(month) |
254 | anchors.leftMargin: units.gu(1) |
255 | anchors.left: parent.left |
256 | //color:"white" |
257 | @@ -25,7 +27,7 @@ |
258 | id: yearLabel |
259 | objectName: "yearLabel" |
260 | fontSize: yearLabelFontSize |
261 | - text: date.getFullYear() |
262 | + text: year |
263 | anchors.right: parent.right |
264 | anchors.rightMargin: units.gu(1) |
265 | color:"#AEA79F" |
266 | |
267 | === modified file 'WeekView.qml' |
268 | --- WeekView.qml 2014-03-23 14:27:31 +0000 |
269 | +++ WeekView.qml 2014-03-26 15:09:40 +0000 |
270 | @@ -12,15 +12,15 @@ |
271 | property var firstDay: dayStart.weekStart(Qt.locale().firstDayOfWeek); |
272 | property bool isCurrentPage: false |
273 | |
274 | + anchors.fill: parent |
275 | anchors.top: parent.top |
276 | anchors.topMargin: units.gu(1.5) |
277 | spacing: units.gu(1) |
278 | |
279 | - anchors.fill: parent |
280 | - |
281 | ViewHeader{ |
282 | id: viewHeader |
283 | - date: dayStart |
284 | + month: dayStart.getMonth() |
285 | + year: dayStart.getFullYear() |
286 | } |
287 | |
288 | TimeLineHeader{ |
289 | |
290 | === modified file 'YearView.qml' |
291 | --- YearView.qml 2014-03-19 19:46:58 +0000 |
292 | +++ YearView.qml 2014-03-26 15:09:40 +0000 |
293 | @@ -6,23 +6,18 @@ |
294 | PathViewBase { |
295 | id: root |
296 | objectName: "YearView" |
297 | - |
298 | - property var currentYear: DateExt.today(); |
299 | + property int currentYear: DateExt.today().getFullYear(); |
300 | |
301 | signal monthSelected(var date); |
302 | |
303 | anchors.fill: parent |
304 | |
305 | onNextItemHighlighted: { |
306 | - currentYear = getDateFromYear(currentYear.getFullYear() + 1); |
307 | + currentYear = currentYear + 1; |
308 | } |
309 | |
310 | onPreviousItemHighlighted: { |
311 | - currentYear = getDateFromYear(currentYear.getFullYear() - 1); |
312 | - } |
313 | - |
314 | - function getDateFromYear(year) { |
315 | - return new Date(year,0,1,0,0,0,0); |
316 | + currentYear = currentYear - 1; |
317 | } |
318 | |
319 | delegate: GridView{ |
320 | @@ -30,18 +25,7 @@ |
321 | clip: true |
322 | |
323 | property bool isCurrentItem: index == root.currentIndex |
324 | - property var year: getYear(); |
325 | - |
326 | - function getYear() { |
327 | - switch( root.indexType(index)) { |
328 | - case 0: |
329 | - return currentYear; |
330 | - case -1: |
331 | - return getDateFromYear(currentYear.getFullYear() - 1); |
332 | - case 1: |
333 | - return getDateFromYear(currentYear.getFullYear() + 1); |
334 | - } |
335 | - } |
336 | + property int year: (root.currentYear + root.indexType(index)) |
337 | |
338 | width: parent.width |
339 | height: parent.height |
340 | @@ -60,7 +44,7 @@ |
341 | |
342 | MonthComponent{ |
343 | id: monthComponent |
344 | - monthDate: new Date(yearView.year.getFullYear(),index,1,0,0,0,0) |
345 | + currentMonth: new Date(yearView.year,index,1,0,0,0,0) |
346 | anchors.fill: parent |
347 | anchors.margins: units.gu(0.5) |
348 | |
349 | @@ -72,7 +56,7 @@ |
350 | MouseArea{ |
351 | anchors.fill: parent |
352 | onClicked: { |
353 | - root.monthSelected(monthComponent.monthDate); |
354 | + root.monthSelected(monthComponent.currentMonth); |
355 | } |
356 | } |
357 | } |
358 | |
359 | === modified file 'calendar.qml' |
360 | --- calendar.qml 2014-03-23 14:21:46 +0000 |
361 | +++ calendar.qml 2014-03-26 15:09:40 +0000 |
362 | @@ -76,9 +76,8 @@ |
363 | property int endtime: -1; |
364 | |
365 | onCurrentDayChanged: { |
366 | - if( yearView.currentYear !== undefined && |
367 | - yearView.currentYear.getFullYear() !== currentDay.getFullYear() ) { |
368 | - yearView.currentYear = tabPage.currentDay.midnight(); |
369 | + if( yearView.currentYear !== currentDay.getFullYear() ) { |
370 | + yearView.currentYear = tabPage.currentDay.getFullYear(); |
371 | } |
372 | |
373 | if( monthView.currentMonth !== undefined && !monthView.currentMonth.isSameDay(currentDay)) |
374 | @@ -98,8 +97,8 @@ |
375 | globalModel.startPeriod = new Date(currentDay.getFullYear(),0,1,0,0,0,0); |
376 | globalModel.endPeriod = new Date(currentDay.getFullYear(),11,31,0,0,0,0); |
377 | // only enable auto update after set the date interval |
378 | - globalModel.autoUpdate = true |
379 | - globalModel.update() |
380 | + globalModel.autoUpdate = true |
381 | + globalModel.update() |
382 | } |
383 | } |
384 | |
385 | |
386 | === modified file 'dateExt.js' |
387 | --- dateExt.js 2014-03-03 11:34:22 +0000 |
388 | +++ dateExt.js 2014-03-26 15:09:40 +0000 |
389 | @@ -112,6 +112,6 @@ |
390 | } |
391 | |
392 | function isSameMonth(date1, date2) { |
393 | - return ( date1.getMonth() === date2.getMonth() |
394 | - && date1.getFullYear() === date2.getFullYear()) |
395 | + return ( date1.getFullYear() === date2.getFullYear() |
396 | + && date1.getMonth() === date2.getMonth() ) |
397 | } |
398 | |
399 | === modified file 'tests/autopilot/calendar_app/tests/test_yearview.py' |
400 | --- tests/autopilot/calendar_app/tests/test_yearview.py 2014-02-24 15:58:49 +0000 |
401 | +++ tests/autopilot/calendar_app/tests/test_yearview.py 2014-03-26 15:09:40 +0000 |
402 | @@ -45,7 +45,7 @@ |
403 | year_grid = self.get_current_year() |
404 | self.assertThat(year_grid, NotEquals(None)) |
405 | months = year_grid.select_many("MonthComponent") |
406 | - months.sort(key=lambda month: month.monthDate) |
407 | + months.sort(key=lambda month: month.currentMonth) |
408 | self.assert_current_year_is_default_one(months[0]) |
409 | |
410 | february = months[1] |
411 | @@ -107,7 +107,7 @@ |
412 | self.main_view.swipe_view(direction, self.year_view) |
413 | |
414 | self.assertThat( |
415 | - lambda: self.year_view.currentYear.year, |
416 | + lambda: self.year_view.currentYear, |
417 | Eventually(Equals(current_year + (i * direction)))) |
418 | |
419 | def assert_current_year_is_default_one(self, month_component): |
PASSED: Continuous integration, rev:204 91.189. 93.70:8080/ job/ubuntu- calendar- app-ci/ 299/ 91.189. 93.70:8080/ job/generic- mediumtests- trusty/ 1554 91.189. 93.70:8080/ job/ubuntu- calendar- app-raring- amd64-ci/ 299 91.189. 93.70:8080/ job/ubuntu- calendar- app-saucy- amd64-ci/ 299 91.189. 93.70:8080/ job/ubuntu- calendar- app-trusty- amd64-ci/ 133
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/ 299/rebuild
http://