Merge lp:~pkunal-parmar/ubuntu-calendar-app/EventBubble-Redesign into lp:ubuntu-calendar-app

Proposed by Kunal Parmar
Status: Merged
Approved by: Alan Pope 🍺🐧🐱 πŸ¦„
Approved revision: 561
Merged at revision: 567
Proposed branch: lp:~pkunal-parmar/ubuntu-calendar-app/EventBubble-Redesign
Merge into: lp:ubuntu-calendar-app
Prerequisite: lp:~pkunal-parmar/ubuntu-calendar-app/NewDayView-Final
Diff against target: 259 lines (+100/-120)
2 files modified
EventBubble.qml (+98/-119)
tests/autopilot/calendar_app/__init__.py (+2/-1)
To merge this branch: bzr merge lp:~pkunal-parmar/ubuntu-calendar-app/EventBubble-Redesign
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Ubuntu Calendar Developers Pending
Review via email: mp+245259@code.launchpad.net

Commit message

Event Bubble redesign

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)
Revision history for this message
Mihir Soni (mihirsoni) wrote :

Rebuilding Jenkins

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'EventBubble.qml'
2--- EventBubble.qml 2014-11-29 05:15:13 +0000
3+++ EventBubble.qml 2015-01-10 09:35:50 +0000
4@@ -36,7 +36,7 @@
5 property Flickable flickable;
6
7 readonly property int minimumHeight: type == wideType
8- ? eventDetails.item.timeLabelHeight + /*top-bottom margin*/ units.gu(2)
9+ ? detailsItems.timeLabelHeight + /*top-bottom margin*/ units.gu(2)
10 : units.gu(2)
11
12 z: depthInRow
13@@ -65,6 +65,7 @@
14 onEventChanged: {
15 resize();
16 assingnBgColor();
17+ setDetails();
18 }
19
20 function assingnBgColor() {
21@@ -106,128 +107,106 @@
22
23 if( infoBubble.y < flickable.contentY && infoBubble.height > flickable.height) {
24 var y = (flickable.contentY - infoBubble.y) * 1.2;
25- if( ( y + eventDetails.item.height + units.gu(2)) > infoBubble.height) {
26- y = infoBubble.height - eventDetails.item.height - units.gu(2);
27- }
28- eventDetails.item.y = y;
29- }
30- }
31-
32- Loader {
33- id:eventDetails
34- sourceComponent: type == wideType ? detailsComponent : undefined
35- }
36-
37- Component {
38- id:detailsComponent
39-
40- Item {
41-
42- id: detailsItems
43- property alias timeLabelHeight : timeLabel.height
44-
45- width: parent.width
46- height: detailsColumn.height
47-
48- Column {
49- id: detailsColumn
50-
51- anchors {
52- top: parent.top
53- left: parent.left
54- right: parent.right
55- margins: units.gu(0.5)
56- }
57-
58- Label {
59- id: timeLabel
60- objectName: "timeLabel"
61- color: "White"
62- fontSize:"small"
63- font.bold: true
64- width: parent.width
65- }
66-
67- Label {
68- id: titleLabel
69- objectName: "titleLabel"
70- color: "White"
71- fontSize: "small"
72- width: parent.width
73- wrapMode: Text.WrapAtWordBoundaryOrAnywhere
74- }
75-
76- Label {
77- id: descriptionLabel
78- color: "White"
79- fontSize: "x-small"
80- width: parent.width
81+ if( ( y + detailsItems.height + units.gu(2)) > infoBubble.height) {
82+ y = infoBubble.height - detailsItems.height - units.gu(2);
83+ }
84+ detailsItems.y = y;
85+ }
86+ }
87+
88+ function setDetails() {
89+ if(event === null || event === undefined) {
90+ return;
91+ }
92+
93+ var startTime = Qt.formatTime( event.startDateTime, "hh:mm")
94+ var endTime = Qt.formatTime( event.endDateTime, "hh:mm")
95+
96+ if (type === wideType) {
97+ timeLabel.text = ""
98+ titleLabel.text = ""
99+
100+ // TRANSLATORS: the first argument (%1) refers to a start time for an event,
101+ // while the second one (%2) refers to the end time
102+ var timeString = i18n.tr("%1 - %2").arg(startTime).arg(endTime)
103+
104+ //height is less then set only event title
105+ if( infoBubble.height > minimumHeight ) {
106+ //on wide type show all details
107+ if( infoBubble.height > titleLabel.y + titleLabel.height + units.gu(1)) {
108+ timeLabel.text = timeString
109+ titleLabel.text = "<b>" + event.displayLabel +"</b>"
110+ } else if ( event.displayLabel ) {
111+ // TRANSLATORS: the first argument (%1) refers to a time for an event,
112+ // while the second one (%2) refers to title of event
113+ timeLabel.text = i18n.tr("%1 <b>%2</b>").arg(timeString).arg(event.displayLabel);
114+ }
115+ } else if (event.displayLabel){
116+ // TRANSLATORS: the first argument (%1) refers to a time for an event,
117+ // while the second one (%2) refers to title of event
118+ timeLabel.text = i18n.tr("%1 <b>%2</b>").arg(timeString).arg(event.displayLabel);
119+ }
120+ } else {
121+ timeLabel.text = event.displayLabel;
122+ timeLabel.horizontalAlignment = Text.AlignHCenter
123+ timeLabel.wrapMode = Text.WrapAtWordBoundaryOrAnywhere
124+ }
125+
126+ layoutBubbleDetails();
127+ }
128+
129+ Item {
130+ id: detailsItems
131+
132+ property alias timeLabelHeight : timeLabel.height
133+
134+ width: parent.width
135+ height: detailsColumn.height
136+
137+ Column {
138+ id: detailsColumn
139+
140+ anchors {
141+ top: parent.top
142+ left: parent.left
143+ right: parent.right
144+ margins: units.gu(0.5)
145+ }
146+
147+ Label {
148+ id: timeLabel
149+ objectName: "timeLabel"
150+ color: "White"
151+ fontSize:"small"
152+ font.bold: true
153+ width: parent.width
154+ }
155+
156+ Label {
157+ id: titleLabel
158+ objectName: "titleLabel"
159+ color: "White"
160+ fontSize: "small"
161+ width: parent.width
162+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
163+ }
164+ }
165+
166+ onHeightChanged: {
167+ layoutBubbleDetails();
168+ }
169+
170+ Connections {
171+ target: infoBubble
172+ onFlickableChanged: {
173+ if (flickable && infoBubble.height > flickable.height) {
174+ flickable.onContentYChanged.connect(layoutBubbleDetails);
175 }
176 }
177
178 onHeightChanged: {
179- layoutBubbleDetails();
180- }
181-
182- Connections {
183- target: infoBubble
184- onFlickableChanged: {
185- if (flickable && infoBubble.height > flickable.height) {
186- flickable.onContentYChanged.connect(layoutBubbleDetails);
187- }
188- }
189-
190- onHeightChanged: {
191- if(flickable && infoBubble.height > flickable.height) {
192- flickable.onContentYChanged.connect(layoutBubbleDetails);
193- }
194- }
195-
196- onEventChanged: {
197- setDetails();
198- }
199- }
200-
201- function setDetails() {
202- if(event === null || event === undefined) {
203- return;
204- }
205-
206- var startTime = event.startDateTime.toLocaleTimeString(Qt.locale(), Locale.ShortFormat)
207- var endTime = event.endDateTime.toLocaleTimeString(Qt.locale(), Locale.ShortFormat)
208-
209- if (type === wideType) {
210- timeLabel.text = ""
211- titleLabel.text = ""
212- descriptionLabel.text = ""
213- //height is less then set only event title
214- if( infoBubble.height > minimumHeight ) {
215- //on wide type show all details
216- if( infoBubble.height > titleLabel.y + titleLabel.height + units.gu(1)) {
217- // TRANSLATORS: the first argument (%1) refers to a start time for an event,
218- // while the second one (%2) refers to the end time
219- var timeString = i18n.tr("%1 - %2").arg(startTime).arg(endTime)
220- timeLabel.text = timeString
221- titleLabel.text = event.displayLabel
222- } else if ( event.displayLabel ) {
223- // TRANSLATORS: the first argument (%1) refers to a start time for an event,
224- // while the second one (%2) refers to title of event
225- timeLabel.text = i18n.tr("%1 - %2").arg(startTime).arg(event.displayLabel);
226- }
227-
228- if (event.description) {
229- descriptionLabel.text = event.description
230- //descriptionText = event.description
231- //If content is too much don't display.
232- if (infoBubble.height < descriptionLabel.y + descriptionLabel.height + units.gu(1)) {
233- descriptionLabel.text = ""
234- }
235- }
236-
237- layoutBubbleDetails();
238- } else if (event.displayLabel){
239- timeLabel.text = event.displayLabel;
240- }
241+ if(flickable && infoBubble.height > flickable.height) {
242+ flickable.onContentYChanged.connect(layoutBubbleDetails);
243 }
244 }
245 }
246
247=== modified file 'tests/autopilot/calendar_app/__init__.py'
248--- tests/autopilot/calendar_app/__init__.py 2014-11-29 10:04:12 +0000
249+++ tests/autopilot/calendar_app/__init__.py 2015-01-10 09:35:50 +0000
250@@ -399,7 +399,8 @@
251
252 for event in event_bubbles:
253 # Event-bubbles objects are recycled, only show visible ones.
254- if event.get_name() == event_name:
255+ temp = "<b>"+event_name+"</b>"
256+ if event.get_name() == temp:
257 if (visible and event.visible) or not visible:
258 matched_event = event
259 return matched_event

Subscribers

People subscribed via source and target branches

to status/vote changes: