Merge lp:~ubuntu-calendar-dev/ubuntu-calendar-app/3-Improve-DayView into lp:ubuntu-calendar-app

Proposed by Nekhelesh Ramananthan
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
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

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: Needs Fixing (continuous-integration)
470. By Nekhelesh Ramananthan

Merged prerequisite branch updates

471. By Nekhelesh Ramananthan

More AP fixes

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
472. By Nekhelesh Ramananthan

Forgot to remove old line

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Mihir Soni (mihirsoni) wrote :

LGTM.
Thanks Nekhelesh

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
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 }
6 }
7
8- head.actions: [
9- calendarTodayAction,
10- commonHeaderActions.newEventAction,
11- commonHeaderActions.showCalendarAction,
12- commonHeaderActions.reloadAction
13- ]
14-
15- Column {
16- id: column
17- anchors.top: parent.top
18- anchors.topMargin: units.gu(1.5)
19- width: parent.width; height: parent.height
20- spacing: units.gu(1)
21+ head {
22+ actions: [
23+ calendarTodayAction,
24+ commonHeaderActions.newEventAction,
25+ commonHeaderActions.showCalendarAction,
26+ commonHeaderActions.reloadAction
27+ ]
28+
29+ contents: Column{
30+ width: parent ? parent.width - units.gu(2) : undefined
31+
32+ Label {
33+ fontSize: "medium"
34+ text: i18n.tr(currentDay.toLocaleString(Qt.locale(),i18n.tr("dddd")))
35+ }
36+
37+ Label {
38+ id:cuurentDay
39+ objectName:"monthYearLabel"
40+ fontSize: "large"
41+ text:i18n.tr(currentDay.toLocaleString(Qt.locale(),i18n.tr("MMMM dd, yyyy")))
42+ }
43+ }
44+ }
45+
46+ PathViewBase{
47+ id: dayViewPath
48+ objectName: "dayViewPath"
49+
50+ property var startDay: currentDay
51+ //This is used to scroll all view together when currentItem scrolls
52+ property var childContentY;
53
54 anchors.fill: parent
55
56- ViewHeader{
57- id: viewHeader
58- month: currentDay.getMonth()
59- year: currentDay.getFullYear()
60- }
61-
62- TimeLineHeader{
63- id: dayHeader
64+ onNextItemHighlighted: {
65+ //next day
66+ currentDay = currentDay.addDays(1);
67+ }
68+
69+ onPreviousItemHighlighted: {
70+ //previous day
71+ currentDay = currentDay.addDays(-1);
72+ }
73+
74+ delegate: TimeLineBaseComponent {
75+ id: timeLineView
76+ objectName: "DayComponent-"+index
77+
78 type: ViewType.ViewTypeDay
79- date: currentDay
80- preferredHighlightBegin: 0.5
81- preferredHighlightEnd: 0.5
82- path: Path {
83- startX: -(dayHeader.width/7); startY: dayHeader.height/2
84- PathLine { x: (dayHeader.width/7) * 8 ; relativeY: 0; }
85- }
86- onDateSelected: {
87- if(date < currentDay){
88- currentDay = currentDay.addDays(-1);
89- dayHeader.decrementCurrentIndex()
90- }
91- else if( date > currentDay){
92- currentDay = currentDay.addDays(1);
93- dayHeader.incrementCurrentIndex();
94- }
95- }
96- }
97-
98- PathViewBase{
99- id: dayViewPath
100- objectName: "dayViewPath"
101-
102- property var startDay: currentDay
103- //This is used to scroll all view together when currentItem scrolls
104- property var childContentY;
105-
106- preferredHighlightBegin: 0.5
107- preferredHighlightEnd: 0.5
108
109 width: parent.width
110- height: column.height - dayViewPath.y
111-
112- path: Path {
113- startX: -(dayViewPath.width/1.75); startY: dayViewPath.height/2
114- PathLine { x: (dayViewPath.width/7) * 11 ; relativeY: 0; }
115- }
116-
117- onNextItemHighlighted: {
118- //next day
119- currentDay = currentDay.addDays(1);
120- dayHeader.incrementCurrentIndex()
121- }
122-
123- onPreviousItemHighlighted: {
124- //previous day
125- currentDay = currentDay.addDays(-1);
126- dayHeader.decrementCurrentIndex()
127- }
128-
129- delegate: TimeLineBaseComponent {
130- id: timeLineView
131- objectName: "DayComponent-"+index
132-
133- type: ViewType.ViewTypeDay
134-
135- width: parent.width/7 * 5
136- height: parent.height
137- z: index == dayViewPath.currentIndex ? 2 : 1
138- isActive: true
139-
140- Connections{
141- target: dayViewPage
142- onIsCurrentPageChanged:{
143- if(dayViewPage.isCurrentPage){
144- timeLineView.scrollToCurrentTime();
145- }
146+ height: parent.height
147+ z: index == dayViewPath.currentIndex ? 2 : 1
148+ isActive: true
149+
150+ Connections{
151+ target: dayViewPage
152+ onIsCurrentPageChanged:{
153+ if(dayViewPage.isCurrentPage){
154+ timeLineView.scrollToCurrentTime();
155 }
156 }
157-
158- //get contentY value from PathView, if its not current Item
159- Binding{
160- target: timeLineView
161- property: "contentY"
162- value: dayViewPath.childContentY;
163- when: !timeLineView.PathView.isCurrentItem
164- }
165-
166- //set PathView's contentY property, if its current item
167- Binding{
168- target: dayViewPath
169- property: "childContentY"
170- value: contentY
171- when: timeLineView.PathView.isCurrentItem
172- }
173-
174- contentInteractive: timeLineView.PathView.isCurrentItem
175-
176- startDay: dayViewPath.startDay.addDays(dayViewPath.indexType(index))
177- }
178+ }
179+
180+ //get contentY value from PathView, if its not current Item
181+ Binding{
182+ target: timeLineView
183+ property: "contentY"
184+ value: dayViewPath.childContentY;
185+ when: !timeLineView.PathView.isCurrentItem
186+ }
187+
188+ //set PathView's contentY property, if its current item
189+ Binding{
190+ target: dayViewPath
191+ property: "childContentY"
192+ value: contentY
193+ when: timeLineView.PathView.isCurrentItem
194+ }
195+
196+ contentInteractive: timeLineView.PathView.isCurrentItem
197+
198+ startDay: dayViewPath.startDay.addDays(dayViewPath.indexType(index))
199 }
200 }
201 }
202+
203
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 return new Date(0, 0, 0, index).toLocaleTimeString
209 (locale, locale.timeFormat(Locale.NarrowFormat))
210 }
211+
212+ anchors {
213+ left: parent.left
214+ leftMargin: units.gu(2)
215+ verticalCenter: parent.verticalCenter
216+ }
217+
218 color: UbuntuColors.lightGrey
219- anchors.centerIn: parent
220- fontSize: "x-large"
221+ fontSize: "small"
222 }
223 }
224 }
225
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
231 Row {
232 id: week
233- anchors.fill: parent
234+
235+ anchors {
236+ fill: parent
237+ leftMargin: type == ViewType.ViewTypeWeek ? units.gu(0)
238+ : units.gu(10)
239+
240+ rightMargin: type == ViewType.ViewTypeWeek ? units.gu(0)
241+ : units.gu(4)
242+ }
243
244 Repeater {
245 model: type == ViewType.ViewTypeWeek ? 7 : 1
246
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
252 now = datetime.datetime.now()
253
254- expected_year = now.year
255- expected_month_name = now.strftime("%B")
256-
257- self.assertThat(self.app.main_view.get_year(self.day_view),
258- Equals(expected_year))
259-
260- self.assertThat(self.app.main_view.get_month_name(self.day_view),
261- Equals(expected_month_name))
262-
263- def test_show_current_days(self):
264- """By default, the day view show the last day, the current
265-
266- and the next day.
267-
268- """
269-
270- days = self.day_view.select_many(objectName='dateLabel')
271- days = [int(day.text) for day in days]
272-
273- now = datetime.datetime.now()
274-
275- today = now.day
276- tomorrow = (now + datetime.timedelta(days=1)).day
277- yesterday = (now - datetime.timedelta(days=1)).day
278-
279- self.assertIn(today, days)
280- self.assertIn(tomorrow, days)
281- self.assertIn(yesterday, days)
282-
283- def test_switch_day_by_tapping(self):
284- """Selecting a day by touching the screen should also switch the day"""
285- today = self.day_view.get_day_header().startDay.datetime
286-
287- # click yesterday
288- yesterday = (today - datetime.timedelta(days=1))
289- yesterday_header = self.day_view.get_day_header(yesterday)
290-
291- self.assertThat(yesterday_header.isCurrentItem, Equals(False))
292- self.app.pointing_device.click_object(yesterday_header)
293- self.assertThat(yesterday_header.isCurrentItem,
294- Eventually(Equals(True)))
295-
296- # click tomorrow
297- tomorrow = (yesterday + datetime.timedelta(days=1))
298- tomorrow_header = self.day_view.get_day_header(tomorrow)
299-
300- self.assertThat(tomorrow_header.isCurrentItem, Equals(False))
301- self.app.pointing_device.click_object(tomorrow_header)
302- self.assertThat(tomorrow_header.isCurrentItem,
303- Eventually(Equals(True)))
304+ expected_month_name_year = now.strftime("%B %d, %Y")
305+
306+ self.assertThat(self.app.main_view.get_month_year(self.day_view),
307+ Equals(expected_month_name_year))
308
309 def test_show_next_days(self):
310 """It must be possible to show next days by swiping the view."""
311
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 self.assertThat(day_view.visible, Eventually(Equals(True)))
317
318 # Check that the 'Day' view is on the correct/selected day.
319- selected_date = day_view.select_single("TimeLineHeader").date
320+ selected_date = datetime.datetime.strptime(
321+ self.app.main_view.get_month_year(day_view),
322+ '%B %d, %Y')
323 self.assertThat(expected_day, Equals(selected_date.day))
324 self.assertThat(expected_month, Equals(selected_date.month))
325 self.assertThat(expected_year, Equals(selected_date.year))

Subscribers

People subscribed via source and target branches

to status/vote changes: