96.2.1
by Kunal Parmar
initial version |
1 |
import QtQuick 2.0 |
2 |
import Ubuntu.Components 0.1 |
|
3 |
||
4 |
import "dateExt.js" as DateExt |
|
5 |
||
96.2.2
by Kunal Parmar
final weekview and dayview |
6 |
Column { |
7 |
id: root
|
|
96.2.1
by Kunal Parmar
initial version |
8 |
|
9 |
property int type: typeWeek |
|
10 |
||
11 |
property var startDay: DateExt.today(); |
|
12 |
||
13 |
readonly property int typeWeek: 0 |
|
14 |
readonly property int typeDay: 1 |
|
15 |
||
96.2.2
by Kunal Parmar
final weekview and dayview |
16 |
clip: true |
17 |
||
96.2.1
by Kunal Parmar
initial version |
18 |
width: parent.width |
96.2.2
by Kunal Parmar
final weekview and dayview |
19 |
|
20 |
Item{ |
|
21 |
id: monthHeader
|
|
22 |
width: parent.width |
|
23 |
height: monthLabel.height |
|
24 |
||
25 |
Label{ |
|
26 |
id: monthLabel
|
|
27 |
fontSize: "large" |
|
28 |
text: Qt.locale().standaloneMonthName(root.startDay.getMonth()) |
|
29 |
anchors.leftMargin: units.gu(1) |
|
30 |
anchors.left: parent.left |
|
31 |
//color:"white"
|
|
32 |
anchors.verticalCenter: parent.verticalCenter |
|
33 |
}
|
|
34 |
||
35 |
Label{ |
|
36 |
id: yearLabel
|
|
37 |
fontSize: "medium" |
|
38 |
text: root.startDay.getFullYear() |
|
39 |
anchors.right: parent.right |
|
40 |
anchors.rightMargin: units.gu(1) |
|
41 |
color:"#AEA79F" |
|
42 |
anchors.verticalCenter: parent.verticalCenter |
|
43 |
}
|
|
44 |
}
|
|
45 |
||
46 |
Row{ |
|
47 |
id: header
|
|
48 |
||
49 |
width: parent.width |
|
50 |
height: units.gu(10) |
|
51 |
||
52 |
Repeater{ |
|
53 |
model: type == typeWeek ? 7 : 3 |
|
54 |
||
55 |
delegate: Item { |
|
56 |
property var date : startDay.addDays(index); |
|
57 |
property int weekDayWidth: header.width / 7 |
|
58 |
||
59 |
width: { |
|
60 |
if( type == typeWeek || (type == typeDay && index != 1 ) ) { |
|
61 |
weekDayWidth
|
|
96.2.1
by Kunal Parmar
initial version |
62 |
} else { |
96.2.2
by Kunal Parmar
final weekview and dayview |
63 |
weekDayWidth * 5 |
64 |
}
|
|
65 |
}
|
|
66 |
||
67 |
height: parent.height |
|
68 |
||
69 |
Column{ |
|
70 |
anchors.verticalCenter: parent.verticalCenter |
|
71 |
anchors.horizontalCenter: parent.horizontalCenter |
|
72 |
width: parent.width |
|
73 |
spacing: units.gu(0.5) |
|
74 |
||
75 |
Label{ |
|
76 |
property var day: { |
|
77 |
if( type == typeWeek || (type == typeDay && index != 1 ) ) { |
|
78 |
Qt.locale().standaloneDayName(date.getDay(), Locale.ShortFormat) |
|
79 |
} else { |
|
80 |
Qt.locale().standaloneDayName(date.getDay(), Locale.LongFormat) |
|
81 |
}
|
|
82 |
}
|
|
83 |
||
84 |
text: day.toUpperCase(); |
|
85 |
fontSize: "medium" |
|
86 |
horizontalAlignment: Text.AlignHCenter |
|
87 |
color: "#AEA79F" |
|
88 |
width: parent.width |
|
89 |
}
|
|
90 |
||
91 |
Label{ |
|
92 |
text: date.getDate(); |
|
93 |
fontSize: "large" |
|
94 |
horizontalAlignment: Text.AlignHCenter |
|
95 |
color: { |
|
96 |
if( type == typeDay && index == 1 ) { |
|
96.2.5
by Kunal Parmar
Theme and some other modification |
97 |
"white"
|
96.2.2
by Kunal Parmar
final weekview and dayview |
98 |
} else if( type == typeWeek && date.isSameDay(DateExt.today())){ |
96.2.5
by Kunal Parmar
Theme and some other modification |
99 |
"white"
|
96.2.2
by Kunal Parmar
final weekview and dayview |
100 |
} else { |
101 |
"#AEA79F"
|
|
102 |
}
|
|
103 |
}
|
|
104 |
width: parent.width |
|
105 |
}
|
|
96.2.1
by Kunal Parmar
initial version |
106 |
}
|
107 |
}
|
|
108 |
}
|
|
109 |
}
|
|
110 |
}
|
|
96.2.2
by Kunal Parmar
final weekview and dayview |
111 |