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
=== modified file 'DayView.qml'
--- DayView.qml 2014-09-19 10:36:39 +0000
+++ DayView.qml 2014-09-19 13:33:01 +0000
@@ -41,121 +41,91 @@
41 }41 }
42 }42 }
4343
44 head.actions: [44 head {
45 calendarTodayAction,45 actions: [
46 commonHeaderActions.newEventAction,46 calendarTodayAction,
47 commonHeaderActions.showCalendarAction,47 commonHeaderActions.newEventAction,
48 commonHeaderActions.reloadAction48 commonHeaderActions.showCalendarAction,
49 ]49 commonHeaderActions.reloadAction
5050 ]
51 Column {51
52 id: column52 contents: Column{
53 anchors.top: parent.top53 width: parent ? parent.width - units.gu(2) : undefined
54 anchors.topMargin: units.gu(1.5)54
55 width: parent.width; height: parent.height55 Label {
56 spacing: units.gu(1)56 fontSize: "medium"
57 text: i18n.tr(currentDay.toLocaleString(Qt.locale(),i18n.tr("dddd")))
58 }
59
60 Label {
61 id:cuurentDay
62 objectName:"monthYearLabel"
63 fontSize: "large"
64 text:i18n.tr(currentDay.toLocaleString(Qt.locale(),i18n.tr("MMMM dd, yyyy")))
65 }
66 }
67 }
68
69 PathViewBase{
70 id: dayViewPath
71 objectName: "dayViewPath"
72
73 property var startDay: currentDay
74 //This is used to scroll all view together when currentItem scrolls
75 property var childContentY;
5776
58 anchors.fill: parent77 anchors.fill: parent
5978
60 ViewHeader{79 onNextItemHighlighted: {
61 id: viewHeader80 //next day
62 month: currentDay.getMonth()81 currentDay = currentDay.addDays(1);
63 year: currentDay.getFullYear()82 }
64 }83
6584 onPreviousItemHighlighted: {
66 TimeLineHeader{85 //previous day
67 id: dayHeader86 currentDay = currentDay.addDays(-1);
87 }
88
89 delegate: TimeLineBaseComponent {
90 id: timeLineView
91 objectName: "DayComponent-"+index
92
68 type: ViewType.ViewTypeDay93 type: ViewType.ViewTypeDay
69 date: currentDay
70 preferredHighlightBegin: 0.5
71 preferredHighlightEnd: 0.5
72 path: Path {
73 startX: -(dayHeader.width/7); startY: dayHeader.height/2
74 PathLine { x: (dayHeader.width/7) * 8 ; relativeY: 0; }
75 }
76 onDateSelected: {
77 if(date < currentDay){
78 currentDay = currentDay.addDays(-1);
79 dayHeader.decrementCurrentIndex()
80 }
81 else if( date > currentDay){
82 currentDay = currentDay.addDays(1);
83 dayHeader.incrementCurrentIndex();
84 }
85 }
86 }
87
88 PathViewBase{
89 id: dayViewPath
90 objectName: "dayViewPath"
91
92 property var startDay: currentDay
93 //This is used to scroll all view together when currentItem scrolls
94 property var childContentY;
95
96 preferredHighlightBegin: 0.5
97 preferredHighlightEnd: 0.5
9894
99 width: parent.width95 width: parent.width
100 height: column.height - dayViewPath.y96 height: parent.height
10197 z: index == dayViewPath.currentIndex ? 2 : 1
102 path: Path {98 isActive: true
103 startX: -(dayViewPath.width/1.75); startY: dayViewPath.height/299
104 PathLine { x: (dayViewPath.width/7) * 11 ; relativeY: 0; }100 Connections{
105 }101 target: dayViewPage
106102 onIsCurrentPageChanged:{
107 onNextItemHighlighted: {103 if(dayViewPage.isCurrentPage){
108 //next day104 timeLineView.scrollToCurrentTime();
109 currentDay = currentDay.addDays(1);
110 dayHeader.incrementCurrentIndex()
111 }
112
113 onPreviousItemHighlighted: {
114 //previous day
115 currentDay = currentDay.addDays(-1);
116 dayHeader.decrementCurrentIndex()
117 }
118
119 delegate: TimeLineBaseComponent {
120 id: timeLineView
121 objectName: "DayComponent-"+index
122
123 type: ViewType.ViewTypeDay
124
125 width: parent.width/7 * 5
126 height: parent.height
127 z: index == dayViewPath.currentIndex ? 2 : 1
128 isActive: true
129
130 Connections{
131 target: dayViewPage
132 onIsCurrentPageChanged:{
133 if(dayViewPage.isCurrentPage){
134 timeLineView.scrollToCurrentTime();
135 }
136 }105 }
137 }106 }
138107 }
139 //get contentY value from PathView, if its not current Item108
140 Binding{109 //get contentY value from PathView, if its not current Item
141 target: timeLineView110 Binding{
142 property: "contentY"111 target: timeLineView
143 value: dayViewPath.childContentY;112 property: "contentY"
144 when: !timeLineView.PathView.isCurrentItem113 value: dayViewPath.childContentY;
145 }114 when: !timeLineView.PathView.isCurrentItem
146115 }
147 //set PathView's contentY property, if its current item116
148 Binding{117 //set PathView's contentY property, if its current item
149 target: dayViewPath118 Binding{
150 property: "childContentY"119 target: dayViewPath
151 value: contentY120 property: "childContentY"
152 when: timeLineView.PathView.isCurrentItem121 value: contentY
153 }122 when: timeLineView.PathView.isCurrentItem
154123 }
155 contentInteractive: timeLineView.PathView.isCurrentItem124
156125 contentInteractive: timeLineView.PathView.isCurrentItem
157 startDay: dayViewPath.startDay.addDays(dayViewPath.indexType(index))126
158 }127 startDay: dayViewPath.startDay.addDays(dayViewPath.indexType(index))
159 }128 }
160 }129 }
161}130}
131
162132
=== modified file 'TimeLineBackground.qml'
--- TimeLineBackground.qml 2014-09-19 13:33:01 +0000
+++ TimeLineBackground.qml 2014-09-19 13:33:01 +0000
@@ -38,9 +38,15 @@
38 return new Date(0, 0, 0, index).toLocaleTimeString38 return new Date(0, 0, 0, index).toLocaleTimeString
39 (locale, locale.timeFormat(Locale.NarrowFormat))39 (locale, locale.timeFormat(Locale.NarrowFormat))
40 }40 }
41
42 anchors {
43 left: parent.left
44 leftMargin: units.gu(2)
45 verticalCenter: parent.verticalCenter
46 }
47
41 color: UbuntuColors.lightGrey48 color: UbuntuColors.lightGrey
42 anchors.centerIn: parent49 fontSize: "small"
43 fontSize: "x-large"
44 }50 }
45 }51 }
46 }52 }
4753
=== modified file 'TimeLineBaseComponent.qml'
--- TimeLineBaseComponent.qml 2014-09-19 13:33:01 +0000
+++ TimeLineBaseComponent.qml 2014-09-19 13:33:01 +0000
@@ -120,7 +120,15 @@
120120
121 Row {121 Row {
122 id: week122 id: week
123 anchors.fill: parent123
124 anchors {
125 fill: parent
126 leftMargin: type == ViewType.ViewTypeWeek ? units.gu(0)
127 : units.gu(10)
128
129 rightMargin: type == ViewType.ViewTypeWeek ? units.gu(0)
130 : units.gu(4)
131 }
124132
125 Repeater {133 Repeater {
126 model: type == ViewType.ViewTypeWeek ? 7 : 1134 model: type == ViewType.ViewTypeWeek ? 7 : 1
127135
=== modified file 'tests/autopilot/calendar_app/tests/test_dayview.py'
--- tests/autopilot/calendar_app/tests/test_dayview.py 2014-09-04 16:04:37 +0000
+++ tests/autopilot/calendar_app/tests/test_dayview.py 2014-09-19 13:33:01 +0000
@@ -43,56 +43,10 @@
4343
44 now = datetime.datetime.now()44 now = datetime.datetime.now()
4545
46 expected_year = now.year46 expected_month_name_year = now.strftime("%B %d, %Y")
47 expected_month_name = now.strftime("%B")47
4848 self.assertThat(self.app.main_view.get_month_year(self.day_view),
49 self.assertThat(self.app.main_view.get_year(self.day_view),49 Equals(expected_month_name_year))
50 Equals(expected_year))
51
52 self.assertThat(self.app.main_view.get_month_name(self.day_view),
53 Equals(expected_month_name))
54
55 def test_show_current_days(self):
56 """By default, the day view show the last day, the current
57
58 and the next day.
59
60 """
61
62 days = self.day_view.select_many(objectName='dateLabel')
63 days = [int(day.text) for day in days]
64
65 now = datetime.datetime.now()
66
67 today = now.day
68 tomorrow = (now + datetime.timedelta(days=1)).day
69 yesterday = (now - datetime.timedelta(days=1)).day
70
71 self.assertIn(today, days)
72 self.assertIn(tomorrow, days)
73 self.assertIn(yesterday, days)
74
75 def test_switch_day_by_tapping(self):
76 """Selecting a day by touching the screen should also switch the day"""
77 today = self.day_view.get_day_header().startDay.datetime
78
79 # click yesterday
80 yesterday = (today - datetime.timedelta(days=1))
81 yesterday_header = self.day_view.get_day_header(yesterday)
82
83 self.assertThat(yesterday_header.isCurrentItem, Equals(False))
84 self.app.pointing_device.click_object(yesterday_header)
85 self.assertThat(yesterday_header.isCurrentItem,
86 Eventually(Equals(True)))
87
88 # click tomorrow
89 tomorrow = (yesterday + datetime.timedelta(days=1))
90 tomorrow_header = self.day_view.get_day_header(tomorrow)
91
92 self.assertThat(tomorrow_header.isCurrentItem, Equals(False))
93 self.app.pointing_device.click_object(tomorrow_header)
94 self.assertThat(tomorrow_header.isCurrentItem,
95 Eventually(Equals(True)))
9650
97 def test_show_next_days(self):51 def test_show_next_days(self):
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."""
9953
=== modified file 'tests/autopilot/calendar_app/tests/test_weekview.py'
--- tests/autopilot/calendar_app/tests/test_weekview.py 2014-09-19 13:33:01 +0000
+++ tests/autopilot/calendar_app/tests/test_weekview.py 2014-09-19 13:33:01 +0000
@@ -177,7 +177,9 @@
177 self.assertThat(day_view.visible, Eventually(Equals(True)))177 self.assertThat(day_view.visible, Eventually(Equals(True)))
178178
179 # Check that the 'Day' view is on the correct/selected day.179 # Check that the 'Day' view is on the correct/selected day.
180 selected_date = day_view.select_single("TimeLineHeader").date180 selected_date = datetime.datetime.strptime(
181 self.app.main_view.get_month_year(day_view),
182 '%B %d, %Y')
181 self.assertThat(expected_day, Equals(selected_date.day))183 self.assertThat(expected_day, Equals(selected_date.day))
182 self.assertThat(expected_month, Equals(selected_date.month))184 self.assertThat(expected_month, Equals(selected_date.month))
183 self.assertThat(expected_year, Equals(selected_date.year))185 self.assertThat(expected_year, Equals(selected_date.year))

Subscribers

People subscribed via source and target branches

to status/vote changes: