~pkunal-parmar/ubuntu-calendar-app/PerformanceImprovements

« back to all changes in this revision

Viewing changes to WeekView.qml

  • Committer: Kunal Parmar
  • Date: 2014-10-22 17:28:07 UTC
  • Revision ID: pkunal.parmar@gmail.com-20141022172807-f8q4u2eb3obvutjv
performce improvements

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
                dayStart = firstDay.addDays(-7);
107
107
            }
108
108
 
109
 
            delegate: TimeLineBaseComponent {
110
 
                id: timeLineView
111
 
 
112
 
                type: ViewType.ViewTypeWeek
113
 
 
 
109
            delegate: Loader {
114
110
                width: parent.width
115
111
                height: parent.height
116
 
 
117
 
                isActive: timeLineView.PathView.isCurrentItem
118
 
 
119
 
                startDay: firstDay.addDays( weekViewPath.indexType(index) * 7)
120
 
 
121
 
                Connections{
122
 
                    target: weekViewPage
123
 
                    onIsCurrentPageChanged:{
124
 
                        if(weekViewPage.isCurrentPage){
125
 
                            timeLineView.scrollToCurrentTime();
 
112
                asynchronous: !weekViewPath.isCurrentItem
 
113
                sourceComponent: delegateComponent
 
114
 
 
115
                Component{
 
116
                    id: delegateComponent
 
117
 
 
118
                    TimeLineBaseComponent {
 
119
                        id: timeLineView
 
120
 
 
121
                        type: ViewType.ViewTypeWeek
 
122
                        anchors.fill: parent
 
123
                        isActive: parent.PathView.isCurrentItem
 
124
                        startDay: firstDay.addDays( weekViewPath.indexType(index) * 7)
 
125
                        keyboardEventProvider: weekViewPath
 
126
 
 
127
                        Component.onCompleted: {
 
128
                            if(weekViewPage.isCurrentPage){
 
129
                                timeLineView.scrollToCurrentTime();
 
130
                            }
 
131
                        }
 
132
 
 
133
                        Connections{
 
134
                            target: weekViewPage
 
135
                            onIsCurrentPageChanged:{
 
136
                                if(weekViewPage.isCurrentPage){
 
137
                                    timeLineView.scrollToCurrentTime();
 
138
                                }
 
139
                            }
 
140
                        }
 
141
 
 
142
                        //get contentY value from PathView, if its not current Item
 
143
                        Binding{
 
144
                            target: timeLineView
 
145
                            property: "contentY"
 
146
                            value: weekViewPath.childContentY;
 
147
                            when: !parent.PathView.isCurrentItem
 
148
                        }
 
149
 
 
150
                        //set PathView's contentY property, if its current item
 
151
                        Binding{
 
152
                            target: weekViewPath
 
153
                            property: "childContentY"
 
154
                            value: contentY
 
155
                            when: parent.PathView.isCurrentItem
126
156
                        }
127
157
                    }
128
158
                }
129
 
 
130
 
                //get contentY value from PathView, if its not current Item
131
 
                Binding{
132
 
                    target: timeLineView
133
 
                    property: "contentY"
134
 
                    value: weekViewPath.childContentY;
135
 
                    when: !timeLineView.PathView.isCurrentItem
136
 
                }
137
 
 
138
 
                //set PathView's contentY property, if its current item
139
 
                Binding{
140
 
                    target: weekViewPath
141
 
                    property: "childContentY"
142
 
                    value: contentY
143
 
                    when: timeLineView.PathView.isCurrentItem
144
 
                }
145
159
            }
146
160
        }
147
161
    }