Merge lp:~ubuntu-calendar-dev/ubuntu-calendar-app/3-Improve-DayView into lp:ubuntu-calendar-app
- 3-Improve-DayView
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Nekhelesh Ramananthan |
Approved revision: | 472 |
Merged at revision: | 462 |
Proposed branch: | lp:~ubuntu-calendar-dev/ubuntu-calendar-app/3-Improve-DayView |
Merge into: | lp:ubuntu-calendar-app |
Prerequisite: | lp:~ubuntu-calendar-dev/ubuntu-calendar-app/2-Improve-WeekView |
Diff against target: |
325 lines (+101/-161) 5 files modified
DayView.qml (+77/-107) TimeLineBackground.qml (+8/-2) TimeLineBaseComponent.qml (+9/-1) tests/autopilot/calendar_app/tests/test_dayview.py (+4/-50) tests/autopilot/calendar_app/tests/test_weekview.py (+3/-1) |
To merge this branch: | bzr merge lp:~ubuntu-calendar-dev/ubuntu-calendar-app/3-Improve-DayView |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mihir Soni | Approve | ||
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Review via email: mp+235282@code.launchpad.net |
Commit message
Improved DayView
Description of the change
Improved DayView
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
- 470. By Nekhelesh Ramananthan
-
Merged prerequisite branch updates
- 471. By Nekhelesh Ramananthan
-
More AP fixes
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:471
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 472. By Nekhelesh Ramananthan
-
Forgot to remove old line
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:472
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Mihir Soni (mihirsoni) wrote : | # |
LGTM.
Thanks Nekhelesh
Preview Diff
1 | === modified file 'DayView.qml' | |||
2 | --- DayView.qml 2014-09-19 10:36:39 +0000 | |||
3 | +++ DayView.qml 2014-09-19 13:33:01 +0000 | |||
4 | @@ -41,121 +41,91 @@ | |||
5 | 41 | } | 41 | } |
6 | 42 | } | 42 | } |
7 | 43 | 43 | ||
21 | 44 | head.actions: [ | 44 | head { |
22 | 45 | calendarTodayAction, | 45 | actions: [ |
23 | 46 | commonHeaderActions.newEventAction, | 46 | calendarTodayAction, |
24 | 47 | commonHeaderActions.showCalendarAction, | 47 | commonHeaderActions.newEventAction, |
25 | 48 | commonHeaderActions.reloadAction | 48 | commonHeaderActions.showCalendarAction, |
26 | 49 | ] | 49 | commonHeaderActions.reloadAction |
27 | 50 | 50 | ] | |
28 | 51 | Column { | 51 | |
29 | 52 | id: column | 52 | contents: Column{ |
30 | 53 | anchors.top: parent.top | 53 | width: parent ? parent.width - units.gu(2) : undefined |
31 | 54 | anchors.topMargin: units.gu(1.5) | 54 | |
32 | 55 | width: parent.width; height: parent.height | 55 | Label { |
33 | 56 | spacing: units.gu(1) | 56 | fontSize: "medium" |
34 | 57 | text: i18n.tr(currentDay.toLocaleString(Qt.locale(),i18n.tr("dddd"))) | ||
35 | 58 | } | ||
36 | 59 | |||
37 | 60 | Label { | ||
38 | 61 | id:cuurentDay | ||
39 | 62 | objectName:"monthYearLabel" | ||
40 | 63 | fontSize: "large" | ||
41 | 64 | text:i18n.tr(currentDay.toLocaleString(Qt.locale(),i18n.tr("MMMM dd, yyyy"))) | ||
42 | 65 | } | ||
43 | 66 | } | ||
44 | 67 | } | ||
45 | 68 | |||
46 | 69 | PathViewBase{ | ||
47 | 70 | id: dayViewPath | ||
48 | 71 | objectName: "dayViewPath" | ||
49 | 72 | |||
50 | 73 | property var startDay: currentDay | ||
51 | 74 | //This is used to scroll all view together when currentItem scrolls | ||
52 | 75 | property var childContentY; | ||
53 | 57 | 76 | ||
54 | 58 | anchors.fill: parent | 77 | anchors.fill: parent |
55 | 59 | 78 | ||
64 | 60 | ViewHeader{ | 79 | onNextItemHighlighted: { |
65 | 61 | id: viewHeader | 80 | //next day |
66 | 62 | month: currentDay.getMonth() | 81 | currentDay = currentDay.addDays(1); |
67 | 63 | year: currentDay.getFullYear() | 82 | } |
68 | 64 | } | 83 | |
69 | 65 | 84 | onPreviousItemHighlighted: { | |
70 | 66 | TimeLineHeader{ | 85 | //previous day |
71 | 67 | id: dayHeader | 86 | currentDay = currentDay.addDays(-1); |
72 | 87 | } | ||
73 | 88 | |||
74 | 89 | delegate: TimeLineBaseComponent { | ||
75 | 90 | id: timeLineView | ||
76 | 91 | objectName: "DayComponent-"+index | ||
77 | 92 | |||
78 | 68 | type: ViewType.ViewTypeDay | 93 | type: ViewType.ViewTypeDay |
79 | 69 | date: currentDay | ||
80 | 70 | preferredHighlightBegin: 0.5 | ||
81 | 71 | preferredHighlightEnd: 0.5 | ||
82 | 72 | path: Path { | ||
83 | 73 | startX: -(dayHeader.width/7); startY: dayHeader.height/2 | ||
84 | 74 | PathLine { x: (dayHeader.width/7) * 8 ; relativeY: 0; } | ||
85 | 75 | } | ||
86 | 76 | onDateSelected: { | ||
87 | 77 | if(date < currentDay){ | ||
88 | 78 | currentDay = currentDay.addDays(-1); | ||
89 | 79 | dayHeader.decrementCurrentIndex() | ||
90 | 80 | } | ||
91 | 81 | else if( date > currentDay){ | ||
92 | 82 | currentDay = currentDay.addDays(1); | ||
93 | 83 | dayHeader.incrementCurrentIndex(); | ||
94 | 84 | } | ||
95 | 85 | } | ||
96 | 86 | } | ||
97 | 87 | |||
98 | 88 | PathViewBase{ | ||
99 | 89 | id: dayViewPath | ||
100 | 90 | objectName: "dayViewPath" | ||
101 | 91 | |||
102 | 92 | property var startDay: currentDay | ||
103 | 93 | //This is used to scroll all view together when currentItem scrolls | ||
104 | 94 | property var childContentY; | ||
105 | 95 | |||
106 | 96 | preferredHighlightBegin: 0.5 | ||
107 | 97 | preferredHighlightEnd: 0.5 | ||
108 | 98 | 94 | ||
109 | 99 | width: parent.width | 95 | width: parent.width |
146 | 100 | height: column.height - dayViewPath.y | 96 | height: parent.height |
147 | 101 | 97 | z: index == dayViewPath.currentIndex ? 2 : 1 | |
148 | 102 | path: Path { | 98 | isActive: true |
149 | 103 | startX: -(dayViewPath.width/1.75); startY: dayViewPath.height/2 | 99 | |
150 | 104 | PathLine { x: (dayViewPath.width/7) * 11 ; relativeY: 0; } | 100 | Connections{ |
151 | 105 | } | 101 | target: dayViewPage |
152 | 106 | 102 | onIsCurrentPageChanged:{ | |
153 | 107 | onNextItemHighlighted: { | 103 | if(dayViewPage.isCurrentPage){ |
154 | 108 | //next day | 104 | timeLineView.scrollToCurrentTime(); |
119 | 109 | currentDay = currentDay.addDays(1); | ||
120 | 110 | dayHeader.incrementCurrentIndex() | ||
121 | 111 | } | ||
122 | 112 | |||
123 | 113 | onPreviousItemHighlighted: { | ||
124 | 114 | //previous day | ||
125 | 115 | currentDay = currentDay.addDays(-1); | ||
126 | 116 | dayHeader.decrementCurrentIndex() | ||
127 | 117 | } | ||
128 | 118 | |||
129 | 119 | delegate: TimeLineBaseComponent { | ||
130 | 120 | id: timeLineView | ||
131 | 121 | objectName: "DayComponent-"+index | ||
132 | 122 | |||
133 | 123 | type: ViewType.ViewTypeDay | ||
134 | 124 | |||
135 | 125 | width: parent.width/7 * 5 | ||
136 | 126 | height: parent.height | ||
137 | 127 | z: index == dayViewPath.currentIndex ? 2 : 1 | ||
138 | 128 | isActive: true | ||
139 | 129 | |||
140 | 130 | Connections{ | ||
141 | 131 | target: dayViewPage | ||
142 | 132 | onIsCurrentPageChanged:{ | ||
143 | 133 | if(dayViewPage.isCurrentPage){ | ||
144 | 134 | timeLineView.scrollToCurrentTime(); | ||
145 | 135 | } | ||
155 | 136 | } | 105 | } |
156 | 137 | } | 106 | } |
178 | 138 | 107 | } | |
179 | 139 | //get contentY value from PathView, if its not current Item | 108 | |
180 | 140 | Binding{ | 109 | //get contentY value from PathView, if its not current Item |
181 | 141 | target: timeLineView | 110 | Binding{ |
182 | 142 | property: "contentY" | 111 | target: timeLineView |
183 | 143 | value: dayViewPath.childContentY; | 112 | property: "contentY" |
184 | 144 | when: !timeLineView.PathView.isCurrentItem | 113 | value: dayViewPath.childContentY; |
185 | 145 | } | 114 | when: !timeLineView.PathView.isCurrentItem |
186 | 146 | 115 | } | |
187 | 147 | //set PathView's contentY property, if its current item | 116 | |
188 | 148 | Binding{ | 117 | //set PathView's contentY property, if its current item |
189 | 149 | target: dayViewPath | 118 | Binding{ |
190 | 150 | property: "childContentY" | 119 | target: dayViewPath |
191 | 151 | value: contentY | 120 | property: "childContentY" |
192 | 152 | when: timeLineView.PathView.isCurrentItem | 121 | value: contentY |
193 | 153 | } | 122 | when: timeLineView.PathView.isCurrentItem |
194 | 154 | 123 | } | |
195 | 155 | contentInteractive: timeLineView.PathView.isCurrentItem | 124 | |
196 | 156 | 125 | contentInteractive: timeLineView.PathView.isCurrentItem | |
197 | 157 | startDay: dayViewPath.startDay.addDays(dayViewPath.indexType(index)) | 126 | |
198 | 158 | } | 127 | startDay: dayViewPath.startDay.addDays(dayViewPath.indexType(index)) |
199 | 159 | } | 128 | } |
200 | 160 | } | 129 | } |
201 | 161 | } | 130 | } |
202 | 131 | |||
203 | 162 | 132 | ||
204 | === modified file 'TimeLineBackground.qml' | |||
205 | --- TimeLineBackground.qml 2014-09-19 13:33:01 +0000 | |||
206 | +++ TimeLineBackground.qml 2014-09-19 13:33:01 +0000 | |||
207 | @@ -38,9 +38,15 @@ | |||
208 | 38 | return new Date(0, 0, 0, index).toLocaleTimeString | 38 | return new Date(0, 0, 0, index).toLocaleTimeString |
209 | 39 | (locale, locale.timeFormat(Locale.NarrowFormat)) | 39 | (locale, locale.timeFormat(Locale.NarrowFormat)) |
210 | 40 | } | 40 | } |
211 | 41 | |||
212 | 42 | anchors { | ||
213 | 43 | left: parent.left | ||
214 | 44 | leftMargin: units.gu(2) | ||
215 | 45 | verticalCenter: parent.verticalCenter | ||
216 | 46 | } | ||
217 | 47 | |||
218 | 41 | color: UbuntuColors.lightGrey | 48 | color: UbuntuColors.lightGrey |
221 | 42 | anchors.centerIn: parent | 49 | fontSize: "small" |
220 | 43 | fontSize: "x-large" | ||
222 | 44 | } | 50 | } |
223 | 45 | } | 51 | } |
224 | 46 | } | 52 | } |
225 | 47 | 53 | ||
226 | === modified file 'TimeLineBaseComponent.qml' | |||
227 | --- TimeLineBaseComponent.qml 2014-09-19 13:33:01 +0000 | |||
228 | +++ TimeLineBaseComponent.qml 2014-09-19 13:33:01 +0000 | |||
229 | @@ -120,7 +120,15 @@ | |||
230 | 120 | 120 | ||
231 | 121 | Row { | 121 | Row { |
232 | 122 | id: week | 122 | id: week |
234 | 123 | anchors.fill: parent | 123 | |
235 | 124 | anchors { | ||
236 | 125 | fill: parent | ||
237 | 126 | leftMargin: type == ViewType.ViewTypeWeek ? units.gu(0) | ||
238 | 127 | : units.gu(10) | ||
239 | 128 | |||
240 | 129 | rightMargin: type == ViewType.ViewTypeWeek ? units.gu(0) | ||
241 | 130 | : units.gu(4) | ||
242 | 131 | } | ||
243 | 124 | 132 | ||
244 | 125 | Repeater { | 133 | Repeater { |
245 | 126 | model: type == ViewType.ViewTypeWeek ? 7 : 1 | 134 | model: type == ViewType.ViewTypeWeek ? 7 : 1 |
246 | 127 | 135 | ||
247 | === modified file 'tests/autopilot/calendar_app/tests/test_dayview.py' | |||
248 | --- tests/autopilot/calendar_app/tests/test_dayview.py 2014-09-04 16:04:37 +0000 | |||
249 | +++ tests/autopilot/calendar_app/tests/test_dayview.py 2014-09-19 13:33:01 +0000 | |||
250 | @@ -43,56 +43,10 @@ | |||
251 | 43 | 43 | ||
252 | 44 | now = datetime.datetime.now() | 44 | now = datetime.datetime.now() |
253 | 45 | 45 | ||
304 | 46 | expected_year = now.year | 46 | expected_month_name_year = now.strftime("%B %d, %Y") |
305 | 47 | expected_month_name = now.strftime("%B") | 47 | |
306 | 48 | 48 | self.assertThat(self.app.main_view.get_month_year(self.day_view), | |
307 | 49 | self.assertThat(self.app.main_view.get_year(self.day_view), | 49 | Equals(expected_month_name_year)) |
258 | 50 | Equals(expected_year)) | ||
259 | 51 | |||
260 | 52 | self.assertThat(self.app.main_view.get_month_name(self.day_view), | ||
261 | 53 | Equals(expected_month_name)) | ||
262 | 54 | |||
263 | 55 | def test_show_current_days(self): | ||
264 | 56 | """By default, the day view show the last day, the current | ||
265 | 57 | |||
266 | 58 | and the next day. | ||
267 | 59 | |||
268 | 60 | """ | ||
269 | 61 | |||
270 | 62 | days = self.day_view.select_many(objectName='dateLabel') | ||
271 | 63 | days = [int(day.text) for day in days] | ||
272 | 64 | |||
273 | 65 | now = datetime.datetime.now() | ||
274 | 66 | |||
275 | 67 | today = now.day | ||
276 | 68 | tomorrow = (now + datetime.timedelta(days=1)).day | ||
277 | 69 | yesterday = (now - datetime.timedelta(days=1)).day | ||
278 | 70 | |||
279 | 71 | self.assertIn(today, days) | ||
280 | 72 | self.assertIn(tomorrow, days) | ||
281 | 73 | self.assertIn(yesterday, days) | ||
282 | 74 | |||
283 | 75 | def test_switch_day_by_tapping(self): | ||
284 | 76 | """Selecting a day by touching the screen should also switch the day""" | ||
285 | 77 | today = self.day_view.get_day_header().startDay.datetime | ||
286 | 78 | |||
287 | 79 | # click yesterday | ||
288 | 80 | yesterday = (today - datetime.timedelta(days=1)) | ||
289 | 81 | yesterday_header = self.day_view.get_day_header(yesterday) | ||
290 | 82 | |||
291 | 83 | self.assertThat(yesterday_header.isCurrentItem, Equals(False)) | ||
292 | 84 | self.app.pointing_device.click_object(yesterday_header) | ||
293 | 85 | self.assertThat(yesterday_header.isCurrentItem, | ||
294 | 86 | Eventually(Equals(True))) | ||
295 | 87 | |||
296 | 88 | # click tomorrow | ||
297 | 89 | tomorrow = (yesterday + datetime.timedelta(days=1)) | ||
298 | 90 | tomorrow_header = self.day_view.get_day_header(tomorrow) | ||
299 | 91 | |||
300 | 92 | self.assertThat(tomorrow_header.isCurrentItem, Equals(False)) | ||
301 | 93 | self.app.pointing_device.click_object(tomorrow_header) | ||
302 | 94 | self.assertThat(tomorrow_header.isCurrentItem, | ||
303 | 95 | Eventually(Equals(True))) | ||
308 | 96 | 50 | ||
309 | 97 | def test_show_next_days(self): | 51 | def test_show_next_days(self): |
310 | 98 | """It must be possible to show next days by swiping the view.""" | 52 | """It must be possible to show next days by swiping the view.""" |
311 | 99 | 53 | ||
312 | === modified file 'tests/autopilot/calendar_app/tests/test_weekview.py' | |||
313 | --- tests/autopilot/calendar_app/tests/test_weekview.py 2014-09-19 13:33:01 +0000 | |||
314 | +++ tests/autopilot/calendar_app/tests/test_weekview.py 2014-09-19 13:33:01 +0000 | |||
315 | @@ -177,7 +177,9 @@ | |||
316 | 177 | self.assertThat(day_view.visible, Eventually(Equals(True))) | 177 | self.assertThat(day_view.visible, Eventually(Equals(True))) |
317 | 178 | 178 | ||
318 | 179 | # Check that the 'Day' view is on the correct/selected day. | 179 | # Check that the 'Day' view is on the correct/selected day. |
320 | 180 | selected_date = day_view.select_single("TimeLineHeader").date | 180 | selected_date = datetime.datetime.strptime( |
321 | 181 | self.app.main_view.get_month_year(day_view), | ||
322 | 182 | '%B %d, %Y') | ||
323 | 181 | self.assertThat(expected_day, Equals(selected_date.day)) | 183 | self.assertThat(expected_day, Equals(selected_date.day)) |
324 | 182 | self.assertThat(expected_month, Equals(selected_date.month)) | 184 | self.assertThat(expected_month, Equals(selected_date.month)) |
325 | 183 | self.assertThat(expected_year, Equals(selected_date.year)) | 185 | self.assertThat(expected_year, Equals(selected_date.year)) |
FAILED: Continuous integration, rev:469 91.189. 93.70:8080/ job/ubuntu- calendar- app-ci/ 827/ 91.189. 93.70:8080/ job/generic- mediumtests- utopic- python3/ 393/console 91.189. 93.70:8080/ job/ubuntu- calendar- app-utopic- amd64-ci/ 385/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/ubuntu- calendar- app-ci/ 827/rebuild
http://