69.1.1
by Kunal Parmar
Initial WeekRibbon and WeekView implementation |
1 |
import QtQuick 2.0 |
2 |
import Ubuntu.Components 0.1 |
|
3 |
||
4 |
import "dateExt.js" as DateExt |
|
191.4.1
by Kunal Parmar
Applying changes |
5 |
import "ViewType.js" as ViewType |
69.1.1
by Kunal Parmar
Initial WeekRibbon and WeekView implementation |
6 |
|
235.1.1
by Kunal Parmar
View to PAge |
7 |
Page{ |
69.1.1
by Kunal Parmar
Initial WeekRibbon and WeekView implementation |
8 |
id: root
|
114.2.1
by Kunal Parmar
dayview weekview transition added |
9 |
property var dayStart: new Date(); |
166.1.14
by nskaggs
remove extra debugging info, and sort which fails when months overlap |
10 |
property var firstDay: dayStart.weekStart(Qt.locale().firstDayOfWeek); |
216.1.2
by Kunal Parmar
Refactoring |
11 |
property bool isCurrentPage: false |
12 |
||
221.2.1
by Jason Gerlowski
Clicking on a day in 'Week' tab brings up that day in 'Day' tab |
13 |
signal dateSelected(var date); |
14 |
||
183.1.1
by Kunal Parmar
Key Navigation implemented |
15 |
Keys.forwardTo: [weekViewPath] |
16 |
||
235.1.1
by Kunal Parmar
View to PAge |
17 |
Column { |
18 |
objectName: "WeekView" |
|
19 |
||
20 |
anchors.fill: parent |
|
21 |
anchors.top: parent.top |
|
22 |
anchors.topMargin: units.gu(1.5) |
|
23 |
spacing: units.gu(1) |
|
24 |
||
25 |
ViewHeader{ |
|
26 |
id: viewHeader
|
|
27 |
month: dayStart.getMonth() |
|
28 |
year: dayStart.getFullYear() |
|
29 |
}
|
|
30 |
||
31 |
TimeLineHeader{ |
|
32 |
id: weekHeader
|
|
33 |
objectName: "weekHeader" |
|
212.1.2
by nskaggs
revert to 211 |
34 |
type: ViewType.ViewTypeWeek |
235.1.1
by Kunal Parmar
View to PAge |
35 |
date: firstDay |
36 |
||
37 |
onDateSelected: { |
|
38 |
root.dateSelected(date); |
|
39 |
}
|
|
40 |
}
|
|
41 |
||
42 |
PathViewBase{ |
|
43 |
id: weekViewPath
|
|
96.2.1
by Kunal Parmar
initial version |
44 |
|
96.2.2
by Kunal Parmar
final weekview and dayview |
45 |
width: parent.width |
235.1.1
by Kunal Parmar
View to PAge |
46 |
height: root.height - weekViewPath.y |
47 |
||
48 |
//This is used to scroll all view together when currentItem scrolls
|
|
49 |
property var childContentY; |
|
50 |
||
51 |
onNextItemHighlighted: { |
|
52 |
nextWeek(); |
|
53 |
weekHeader.incrementCurrentIndex() |
|
54 |
}
|
|
55 |
||
56 |
onPreviousItemHighlighted: { |
|
57 |
previousWeek(); |
|
58 |
weekHeader.decrementCurrentIndex() |
|
59 |
}
|
|
60 |
||
61 |
function nextWeek() { |
|
62 |
dayStart = firstDay.addDays(7); |
|
63 |
}
|
|
64 |
||
65 |
function previousWeek(){ |
|
66 |
dayStart = firstDay.addDays(-7); |
|
67 |
}
|
|
68 |
||
69 |
delegate: TimeLineBaseComponent { |
|
70 |
id: timeLineView
|
|
71 |
||
72 |
type: ViewType.ViewTypeWeek |
|
73 |
||
74 |
width: parent.width |
|
75 |
height: parent.height |
|
76 |
||
295.1.1
by Kunal Parmar
Parallex fix for EventBubble |
77 |
isActive: timeLineView.PathView.isCurrentItem |
78 |
||
235.1.1
by Kunal Parmar
View to PAge |
79 |
startDay: firstDay.addDays( weekViewPath.indexType(index) * 7) |
80 |
||
81 |
Connections{ |
|
82 |
target: root |
|
83 |
onIsCurrentPageChanged:{ |
|
84 |
if(root.isCurrentPage){ |
|
85 |
timeLineView.scrollToCurrentTime(); |
|
86 |
}
|
|
216.1.2
by Kunal Parmar
Refactoring |
87 |
}
|
88 |
}
|
|
235.1.1
by Kunal Parmar
View to PAge |
89 |
|
90 |
//get contentY value from PathView, if its not current Item
|
|
91 |
Binding{ |
|
92 |
target: timeLineView |
|
93 |
property: "contentY" |
|
94 |
value: weekViewPath.childContentY; |
|
95 |
when: !timeLineView.PathView.isCurrentItem |
|
96 |
}
|
|
97 |
||
98 |
//set PathView's contentY property, if its current item
|
|
99 |
Binding{ |
|
100 |
target: weekViewPath |
|
101 |
property: "childContentY" |
|
102 |
value: contentY |
|
103 |
when: timeLineView.PathView.isCurrentItem |
|
104 |
}
|
|
216.1.1
by Kunal Parmar
scroll to currnt time |
105 |
}
|
69.1.1
by Kunal Parmar
Initial WeekRibbon and WeekView implementation |
106 |
}
|
107 |
}
|
|
108 |
}
|