summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-08-01 18:30:25 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-08-01 18:30:25 +0200
commit57db4a7edbaa3b749ba44524d37fcc580b97fca5 (patch)
tree70fe6837e3aa1690054551181959893df382b67c
parent16d30e9be08785f9f1c9f2c0b840b8793596e89a (diff)
downloadkube-57db4a7edbaa3b749ba44524d37fcc580b97fca5.tar.gz
kube-57db4a7edbaa3b749ba44524d37fcc580b97fca5.zip
Dimm past days and show a line at the current time
-rw-r--r--framework/src/domain/perioddayeventmodel.cpp3
-rw-r--r--framework/src/domain/perioddayeventmodel.h1
-rw-r--r--views/calendar/main.qml2
-rw-r--r--views/calendar/qml/WeekView.qml24
4 files changed, 28 insertions, 2 deletions
diff --git a/framework/src/domain/perioddayeventmodel.cpp b/framework/src/domain/perioddayeventmodel.cpp
index 6fd6e0ff..c5f2c197 100644
--- a/framework/src/domain/perioddayeventmodel.cpp
+++ b/framework/src/domain/perioddayeventmodel.cpp
@@ -168,6 +168,8 @@ QVariant PeriodDayEventModel::data(const QModelIndex &id, int role) const
168 switch (role) { 168 switch (role) {
169 case Qt::DisplayRole: 169 case Qt::DisplayRole:
170 return mPeriodStart.addDays(day).toString(); 170 return mPeriodStart.addDays(day).toString();
171 case Date:
172 return mPeriodStart.addDays(day);
171 case Events: { 173 case Events: {
172 auto result = QVariantList{}; 174 auto result = QVariantList{};
173 175
@@ -222,6 +224,7 @@ QHash<int, QByteArray> PeriodDayEventModel::roleNames() const
222{ 224{
223 return { 225 return {
224 {Events, "events"}, 226 {Events, "events"},
227 {Date, "date"},
225 {Summary, "summary"}, 228 {Summary, "summary"},
226 {Description, "description"}, 229 {Description, "description"},
227 {StartTime, "starts"}, 230 {StartTime, "starts"},
diff --git a/framework/src/domain/perioddayeventmodel.h b/framework/src/domain/perioddayeventmodel.h
index 672afbea..a7d9cea8 100644
--- a/framework/src/domain/perioddayeventmodel.h
+++ b/framework/src/domain/perioddayeventmodel.h
@@ -91,6 +91,7 @@ public:
91 enum Roles 91 enum Roles
92 { 92 {
93 Events = Qt::UserRole + 1, 93 Events = Qt::UserRole + 1,
94 Date,
94 Summary, 95 Summary,
95 Description, 96 Description,
96 StartTime, 97 StartTime,
diff --git a/views/calendar/main.qml b/views/calendar/main.qml
index e72d4941..07ee6302 100644
--- a/views/calendar/main.qml
+++ b/views/calendar/main.qml
@@ -143,7 +143,7 @@ ApplicationWindow {
143 143
144 View { 144 View {
145 anchors.fill: parent 145 anchors.fill: parent
146 currentDate: "2018-04-09" 146 currentDate: "2018-04-11T13:00:00"
147 autoUpdateDate: false 147 autoUpdateDate: false
148 } 148 }
149} 149}
diff --git a/views/calendar/qml/WeekView.qml b/views/calendar/qml/WeekView.qml
index c8d0ab7b..868e7ee9 100644
--- a/views/calendar/qml/WeekView.qml
+++ b/views/calendar/qml/WeekView.qml
@@ -192,9 +192,10 @@ FocusScope {
192 length: 7 192 length: 7
193 } 193 }
194 delegate: Rectangle { 194 delegate: Rectangle {
195 id: day 195 id: dayDelegate
196 196
197 property var events: model.events 197 property var events: model.events
198 property var date: model.date
198 199
199 width: root.dayWidth 200 width: root.dayWidth
200 height: root.hourHeight * 24 201 height: root.hourHeight * 24
@@ -285,6 +286,27 @@ FocusScope {
285 } 286 }
286 } 287 }
287 288
289 Rectangle {
290 id: currentTimeLine
291 anchors {
292 right: parent.right
293 left: parent.left
294 }
295 y: root.hourHeight * root.currentDate.getHours() + root.hourHeight / 60 * root.currentDate.getMinutes()
296 height: 2
297 color: Kube.Colors.plasmaBlue
298 visible: root.currentDate.getDate() == dayDelegate.date.getDate()
299 opacity: 0.8
300 }
301
302 //Dimm days in the past
303 Rectangle {
304 anchors.fill: parent
305 color: Kube.Colors.buttonColor
306 opacity: 0.4
307 visible: root.currentDate.getDate() > dayDelegate.date.getDate()
308 }
309
288 DropArea { 310 DropArea {
289 anchors.fill: parent 311 anchors.fill: parent
290 312