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

Proposed by Kunal Parmar
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 149
Merged at revision: 150
Proposed branch: lp:~pkunal-parmar/ubuntu-calendar-app/yearview_fix
Merge into: lp:ubuntu-calendar-app
Diff against target: 173 lines (+44/-64)
3 files modified
MonthComponent.qml (+13/-29)
ViewHeader.qml (+4/-2)
YearView.qml (+27/-33)
To merge this branch: bzr merge lp:~pkunal-parmar/ubuntu-calendar-app/yearview_fix
Reviewer Review Type Date Requested Status
Olivier Tilloy (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+190016@code.launchpad.net

Commit message

YearView changed to use GridView
MonthComponent is creating hilight only when necessary

Description of the change

YearView changed to use GridView
MonthComponent is creating hilight only when necessary

To post a comment you must log in.
140. By Kunal Parmar

newlines removed

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
141. By Kunal Parmar

reused view header

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
Olivier Tilloy (osomon) wrote :

When I click on any month in the year view, I’m getting the following error:

    YearView.qml:79: ReferenceError: monthDate is not defined

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

52 + property bool shouldCreateHighlight: date.isSameDay(DateExt.today()) && isCurrentMonth
53 + property var hightlightObj;
54 +
55 + onShouldCreateHighlightChanged: {
56 + if( shouldCreateHighlight ) {
57 + hightlightObj = highLightComp.createObject(dateRootItem);
58 + hightlightObj.z = hightlightObj.z -1;
59 + } else {
60 + if( hightlightObj) {
61 + hightlightObj.destroy();
62 + }
63 + }

Please use a Loader element instead of manually instantiating/destroying objects.

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

128 + flow: Grid.LeftToRight

Grid.LeftToRight is the default value, so this is useless.

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

169 + model: 6/*rows*/ * 2 /*columns*/

or, simpler:

    model: 12 /* months in a year */

Revision history for this message
Olivier Tilloy (osomon) wrote :

178 + width: parent.width - units.gu(1)
179 + height: parent.height - units.gu(1)
180 + anchors.centerIn: parent

Better to use "anchors.fill: parent" and "anchors.margins: units.gu(0.5)" in that case.

142. By Kunal Parmar

monthDate is not defined fixed

143. By Kunal Parmar

flow: Grid.LeftToRight

144. By Kunal Parmar

 model: 12 /* months in a year */

145. By Kunal Parmar

layouting fixed for monthComponent

146. By Kunal Parmar

Loader used instead of manual creation of object

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

Thanks, I addressed your comments, Pls have a look again.

Revision history for this message
Olivier Tilloy (osomon) wrote :

> Thanks, I addressed your comments, Pls have a look again.

Looks like you forgot to push your changes to the branch, I’m not seeing any updates.

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

> > Thanks, I addressed your comments, Pls have a look again.
>
> Looks like you forgot to push your changes to the branch, I’m not seeing any
> updates.

Someting is wrong with bzr, when I use bzr push, it it pushing changes to different branch.
But now this branch should have my recent changes. Thanks..

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :
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
Olivier Tilloy (osomon) wrote :

> Someting is wrong with bzr, when I use bzr push, it it pushing changes to
> different branch.

If you issue `bzr info`, it will show where it will push by default. You can change the default push location with `bzr push --remember $LOCATION`

Revision history for this message
Olivier Tilloy (osomon) wrote :

46 + property bool shouldCreateHighlight: date.isSameDay(DateExt.today()) && isCurrentMonth
47 +
48 + onShouldCreateHighlightChanged: {
49 + if( shouldCreateHighlight ) {
50 + highlightLoader.sourceComponent = highLightComp;
51 + } else {
52 + //unloading the highlight
53 + highlightLoader.sourceComponent = undefined
54 + }
55 + }

This is better, but it can be taken one step further to make it fully declarative: remove entirely the shouldCreateHighlight property, and do this:

    Loader {
        sourceComponent: date.isSameDay(DateExt.today()) && isCurrentMonth ? highLightComp : undefined
        […]
    }

(and you can then remove the 'highlightLoader' id which will be unused).

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

78 + id: highLightRect

Please also remove this id which is unused.

147. By Kunal Parmar

id: highLightRect removed

148. By Kunal Parmar

using declarative way to load a loader

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

> > Someting is wrong with bzr, when I use bzr push, it it pushing changes to
> > different branch.
>
> If you issue `bzr info`, it will show where it will push by default. You can
> change the default push location with `bzr push --remember $LOCATION`

Thanks, this helped

149. By Kunal Parmar

merge from trunk

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

> 46 + property bool shouldCreateHighlight:
> date.isSameDay(DateExt.today()) && isCurrentMonth
> 47 +
> 48 + onShouldCreateHighlightChanged: {
> 49 + if( shouldCreateHighlight ) {
> 50 + highlightLoader.sourceComponent = highLightComp;
> 51 + } else {
> 52 + //unloading the highlight
> 53 + highlightLoader.sourceComponent = undefined
> 54 + }
> 55 + }
>
> This is better, but it can be taken one step further to make it fully
> declarative: remove entirely the shouldCreateHighlight property, and do this:
>

Done, please have another look
> Loader {
> sourceComponent: date.isSameDay(DateExt.today()) && isCurrentMonth ?
> highLightComp : undefined
> […]
> }
>
> (and you can then remove the 'highlightLoader' id which will be unused).

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
Olivier Tilloy (osomon) wrote :

Looks good now, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'MonthComponent.qml'
--- MonthComponent.qml 2013-09-04 13:37:10 +0000
+++ MonthComponent.qml 2013-10-09 23:35:38 +0000
@@ -35,30 +35,11 @@
35 anchors.fill: parent35 anchors.fill: parent
36 spacing: units.gu(1.5)36 spacing: units.gu(1.5)
3737
38 Item{38 ViewHeader{
39 id: monthHeader39 id: monthHeader
40 width: parent.width40 date: root.monthDate
41 height: monthLabel.height41 monthLabelFontSize: root.monthLabelFontSize
4242 yearLabelFontSize: root.yearLabelFontSize
43 Label{
44 id: monthLabel
45 fontSize: monthLabelFontSize
46 text: Qt.locale().standaloneMonthName(root.monthDate.getMonth())
47 anchors.leftMargin: units.gu(1)
48 anchors.left: parent.left
49 //color:"white"
50 anchors.verticalCenter: parent.verticalCenter
51 }
52
53 Label{
54 id: yearLabel
55 fontSize: yearLabelFontSize
56 text: root.monthDate.getFullYear()
57 anchors.right: parent.right
58 anchors.rightMargin: units.gu(1)
59 color:"#AEA79F"
60 anchors.verticalCenter: parent.verticalCenter
61 }
62 }43 }
6344
64 Row{45 Row{
@@ -106,15 +87,11 @@
106 width: parent.width / 7;87 width: parent.width / 7;
107 height: parent.height / parent.weekCount88 height: parent.height / parent.weekCount
10889
109 UbuntuShape{90 Loader {
110 id: highLightRect
111
112 width: parent.width91 width: parent.width
113 height: width92 height: width
114 anchors.centerIn: parent93 anchors.centerIn: parent
11594 sourceComponent: date.isSameDay(DateExt.today()) && isCurrentMonth ? highLightComp : undefined
116 color: "white"
117 visible: date.isSameDay(DateExt.today()) && isCurrentMonth
118 }95 }
11996
120 Label{97 Label{
@@ -156,4 +133,11 @@
156 color: "#AEA79F"133 color: "#AEA79F"
157 }134 }
158 }135 }
136
137 Component{
138 id: highLightComp
139 UbuntuShape{
140 color: "white"
141 }
142 }
159}143}
160144
=== modified file 'ViewHeader.qml'
--- ViewHeader.qml 2013-09-16 14:04:37 +0000
+++ ViewHeader.qml 2013-10-09 23:35:38 +0000
@@ -7,10 +7,12 @@
7 height: monthLabel.height7 height: monthLabel.height
88
9 property var date;9 property var date;
10 property string monthLabelFontSize: "x-large"
11 property string yearLabelFontSize: "large"
1012
11 Label{13 Label{
12 id: monthLabel14 id: monthLabel
13 fontSize: "large"15 fontSize: monthLabelFontSize
14 text: Qt.locale().standaloneMonthName(date.getMonth())16 text: Qt.locale().standaloneMonthName(date.getMonth())
15 anchors.leftMargin: units.gu(1)17 anchors.leftMargin: units.gu(1)
16 anchors.left: parent.left18 anchors.left: parent.left
@@ -20,7 +22,7 @@
2022
21 Label{23 Label{
22 id: yearLabel24 id: yearLabel
23 fontSize: "medium"25 fontSize: yearLabelFontSize
24 text: date.getFullYear()26 text: date.getFullYear()
25 anchors.right: parent.right27 anchors.right: parent.right
26 anchors.rightMargin: units.gu(1)28 anchors.rightMargin: units.gu(1)
2729
=== modified file 'YearView.qml'
--- YearView.qml 2013-09-16 14:04:01 +0000
+++ YearView.qml 2013-10-09 23:35:38 +0000
@@ -29,7 +29,7 @@
29 property var startYear: getDateFromYear(currentYear.getFullYear()-1);29 property var startYear: getDateFromYear(currentYear.getFullYear()-1);
30 }30 }
3131
32 delegate: Flickable{32 delegate: GridView{
33 id: yearView33 id: yearView
34 clip: true34 clip: true
3535
@@ -48,38 +48,32 @@
4848
49 width: parent.width49 width: parent.width
50 height: parent.height50 height: parent.height
5151 anchors.top: parent.top
52 contentHeight: yearGrid.height + units.gu(2)52
53 contentWidth: width53 cellWidth: width/2
5454 cellHeight: cellWidth * 1.2
55 Grid{55
56 id: yearGrid56 model: 12 /* months in a year */
57 rows: 657 snapMode: GridView.SnapOneRow
58 columns: 258 delegate: Item {
5959 width: yearView.cellWidth
60 anchors.top: parent.top60 height: yearView.cellHeight
61 anchors.topMargin: units.gu(1.5)61
6262 MonthComponent{
63 width: parent.width - ((columns-1) * yearGrid.spacing)63 id: monthComponent
64 spacing: units.gu(2)64 monthDate: new Date(yearView.year.getFullYear(),index,1,0,0,0,0)
65 anchors.horizontalCenter: parent.horizontalCenter65 anchors.fill: parent
6666 anchors.margins: units.gu(0.5)
67 Repeater{67
68 model: yearGrid.rows * yearGrid.columns68 dayLabelFontSize:"x-small"
69 delegate: MonthComponent{69 dateLabelFontSize: "medium"
70 monthDate: new Date(yearView.year.getFullYear(),index,1,0,0,0,0)70 monthLabelFontSize: "medium"
71 width: (parent.width - units.gu(2))/271 yearLabelFontSize: "small"
72 height: width * 1.572
73 dayLabelFontSize:"x-small"73 MouseArea{
74 dateLabelFontSize: "medium"74 anchors.fill: parent
75 monthLabelFontSize: "medium"75 onClicked: {
76 yearLabelFontSize: "small"76 root.monthSelected(monthComponent.monthDate);
77
78 MouseArea{
79 anchors.fill: parent
80 onClicked: {
81 root.monthSelected(monthDate);
82 }
83 }77 }
84 }78 }
85 }79 }

Subscribers

People subscribed via source and target branches

to status/vote changes: