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

« back to all changes in this revision

Viewing changes to DayView.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:
118
118
                dayHeader.previousDay();
119
119
            }
120
120
 
121
 
            delegate: TimeLineBaseComponent {
122
 
                id: timeLineView
123
 
                objectName: "DayComponent-"+index
124
 
 
125
 
                type: ViewType.ViewTypeDay
126
 
 
 
121
            delegate: Loader {
127
122
                width: parent.width
128
123
                height: parent.height
129
 
 
130
 
                isActive: timeLineView.PathView.isCurrentItem
131
 
                contentInteractive: timeLineView.PathView.isCurrentItem
132
 
                startDay: dayViewPath.startDay.addDays(dayViewPath.indexType(index))
133
 
 
134
 
                Connections{
135
 
                    target: dayViewPage
136
 
                    onIsCurrentPageChanged:{
137
 
                        if(dayViewPage.isCurrentPage){
138
 
                            timeLineView.scrollToCurrentTime();
 
124
                asynchronous: !dayViewPath.isCurrentItem
 
125
                sourceComponent: delegateComponent
 
126
 
 
127
                Component {
 
128
                    id: delegateComponent
 
129
 
 
130
                    TimeLineBaseComponent {
 
131
                        id: timeLineView
 
132
                        objectName: "DayComponent-"+index
 
133
 
 
134
                        type: ViewType.ViewTypeDay
 
135
                        anchors.fill: parent
 
136
 
 
137
                        isActive: parent.PathView.isCurrentItem
 
138
                        contentInteractive: parent.PathView.isCurrentItem
 
139
                        startDay: dayViewPath.startDay.addDays(dayViewPath.indexType(index))
 
140
                        keyboardEventProvider: dayViewPath
 
141
 
 
142
                        Component.onCompleted: {
 
143
                            if(dayViewPage.isCurrentPage){
 
144
                                timeLineView.scrollToCurrentTime();
 
145
                            }
 
146
                        }
 
147
 
 
148
                        Connections{
 
149
                            target: dayViewPage
 
150
                            onIsCurrentPageChanged:{
 
151
                                if(dayViewPage.isCurrentPage){
 
152
                                    timeLineView.scrollToCurrentTime();
 
153
                                }
 
154
                            }
 
155
                        }
 
156
 
 
157
                        //get contentY value from PathView, if its not current Item
 
158
                        Binding{
 
159
                            target: timeLineView
 
160
                            property: "contentY"
 
161
                            value: dayViewPath.childContentY;
 
162
                            when: !parent.PathView.isCurrentItem
 
163
                        }
 
164
 
 
165
                        //set PathView's contentY property, if its current item
 
166
                        Binding{
 
167
                            target: dayViewPath
 
168
                            property: "childContentY"
 
169
                            value: contentY
 
170
                            when: parent.PathView.isCurrentItem
139
171
                        }
140
172
                    }
141
173
                }
142
 
 
143
 
                //get contentY value from PathView, if its not current Item
144
 
                Binding{
145
 
                    target: timeLineView
146
 
                    property: "contentY"
147
 
                    value: dayViewPath.childContentY;
148
 
                    when: !timeLineView.PathView.isCurrentItem
149
 
                }
150
 
 
151
 
                //set PathView's contentY property, if its current item
152
 
                Binding{
153
 
                    target: dayViewPath
154
 
                    property: "childContentY"
155
 
                    value: contentY
156
 
                    when: timeLineView.PathView.isCurrentItem
157
 
                }
158
174
            }
159
175
        }
160
176
    }