diff options
author | Michael Bohlender <michael.bohlender@kdemail.net> | 2018-03-01 15:06:41 +0100 |
---|---|---|
committer | Michael Bohlender <michael.bohlender@kdemail.net> | 2018-03-01 15:06:41 +0100 |
commit | 6220a14fa325aa5141adc78898f0063a72881972 (patch) | |
tree | dec54452f21c41cae575a133e8bf5c6fac8a2c93 /views/calendar/qml/View.qml | |
parent | 48627975b967254c8fb2646716d2682a525a73f4 (diff) | |
download | kube-6220a14fa325aa5141adc78898f0063a72881972.tar.gz kube-6220a14fa325aa5141adc78898f0063a72881972.zip |
initial calendar - week view
Diffstat (limited to 'views/calendar/qml/View.qml')
-rw-r--r-- | views/calendar/qml/View.qml | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/views/calendar/qml/View.qml b/views/calendar/qml/View.qml new file mode 100644 index 00000000..1b72881d --- /dev/null +++ b/views/calendar/qml/View.qml | |||
@@ -0,0 +1,141 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2018 Michael Bohlender, <bohlender@kolabsys.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | import QtQuick 2.4 | ||
20 | import QtQuick.Layouts 1.1 | ||
21 | import QtQuick.Controls 2.0 | ||
22 | import Qt.labs.calendar 1.0 | ||
23 | |||
24 | import org.kube.framework 1.0 as Kube | ||
25 | |||
26 | FocusScope { | ||
27 | id: root | ||
28 | |||
29 | property var month: Calendar.March | ||
30 | property var year: 2017 | ||
31 | |||
32 | |||
33 | Column { | ||
34 | anchors.centerIn: parent | ||
35 | |||
36 | DayOfWeekRow { | ||
37 | |||
38 | anchors.horizontalCenter: parent.horizontalCenter | ||
39 | |||
40 | spacing: 0 | ||
41 | locale: Qt.locale("de") | ||
42 | |||
43 | delegate: Rectangle { | ||
44 | width: Kube.Units.gridUnit * 7 | ||
45 | height: Kube.Units.gridUnit + Kube.Units.smallSpacing * 3 | ||
46 | |||
47 | border.width: 1 | ||
48 | border.color: "lightgrey" | ||
49 | color: Kube.Colors.viewBackgroundColor | ||
50 | |||
51 | Kube.Label { | ||
52 | anchors { | ||
53 | top: parent.top | ||
54 | left: parent.left | ||
55 | margins: Kube.Units.smallSpacing | ||
56 | } | ||
57 | text: model.shortName | ||
58 | } | ||
59 | } | ||
60 | } | ||
61 | |||
62 | Rectangle { | ||
63 | height: Kube.Units.gridUnit * 3 | ||
64 | width: parent.width | ||
65 | color: Kube.Colors.viewBackgroundColor | ||
66 | |||
67 | ListView { | ||
68 | id: daylong | ||
69 | |||
70 | anchors.fill: parent | ||
71 | |||
72 | model: DaylongEvents {} | ||
73 | |||
74 | delegate: Item { | ||
75 | height: Kube.Units.gridUnit | ||
76 | width: daylong.width | ||
77 | |||
78 | Rectangle { | ||
79 | width: Kube.Units.gridUnit * 7 * model.duration | ||
80 | height: Kube.Units.gridUnit | ||
81 | x: Kube.Units.gridUnit * 7 * model.starts | ||
82 | color: model.color | ||
83 | |||
84 | Kube.Label { | ||
85 | anchors { | ||
86 | left: parent.left | ||
87 | leftMargin: Kube.Units.smallSpacing | ||
88 | } | ||
89 | color: Kube.Colors.highlightedTextColor | ||
90 | text: model.text | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | } | ||
95 | } | ||
96 | |||
97 | RowLayout { | ||
98 | |||
99 | anchors.horizontalCenter: parent.horizontalCenter | ||
100 | |||
101 | spacing: 0 | ||
102 | |||
103 | Repeater { | ||
104 | model: WeekEvents{} | ||
105 | delegate: Rectangle { | ||
106 | id: day | ||
107 | |||
108 | property var events: model.events | ||
109 | |||
110 | width: Kube.Units.gridUnit * 7 | ||
111 | height: Kube.Units.gridUnit * 20 | ||
112 | |||
113 | border.width: 1 | ||
114 | border.color: "lightgrey" | ||
115 | color: Kube.Colors.viewBackgroundColor | ||
116 | |||
117 | Repeater { | ||
118 | model: parent.events | ||
119 | |||
120 | delegate: Rectangle { | ||
121 | anchors.horizontalCenter: parent.horizontalCenter | ||
122 | width: parent.width - Kube.Units.smallSpacing * 2 | ||
123 | height: Kube.Units.gridUnit * duration | ||
124 | y: Kube.Units.gridUnit * starts | ||
125 | color: model.color | ||
126 | |||
127 | Kube.Label { | ||
128 | anchors { | ||
129 | left: parent.left | ||
130 | leftMargin: Kube.Units.smallSpacing | ||
131 | } | ||
132 | text: model.text | ||
133 | color: Kube.Colors.highlightedTextColor | ||
134 | } | ||
135 | } | ||
136 | } | ||
137 | } | ||
138 | } | ||
139 | } | ||
140 | } | ||
141 | } | ||