From 57db4a7edbaa3b749ba44524d37fcc580b97fca5 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 1 Aug 2018 18:30:25 +0200 Subject: Dimm past days and show a line at the current time --- framework/src/domain/perioddayeventmodel.cpp | 3 +++ framework/src/domain/perioddayeventmodel.h | 1 + views/calendar/main.qml | 2 +- views/calendar/qml/WeekView.qml | 24 +++++++++++++++++++++++- 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 switch (role) { case Qt::DisplayRole: return mPeriodStart.addDays(day).toString(); + case Date: + return mPeriodStart.addDays(day); case Events: { auto result = QVariantList{}; @@ -222,6 +224,7 @@ QHash PeriodDayEventModel::roleNames() const { return { {Events, "events"}, + {Date, "date"}, {Summary, "summary"}, {Description, "description"}, {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: enum Roles { Events = Qt::UserRole + 1, + Date, Summary, Description, 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 { View { anchors.fill: parent - currentDate: "2018-04-09" + currentDate: "2018-04-11T13:00:00" autoUpdateDate: false } } 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 { length: 7 } delegate: Rectangle { - id: day + id: dayDelegate property var events: model.events + property var date: model.date width: root.dayWidth height: root.hourHeight * 24 @@ -285,6 +286,27 @@ FocusScope { } } + Rectangle { + id: currentTimeLine + anchors { + right: parent.right + left: parent.left + } + y: root.hourHeight * root.currentDate.getHours() + root.hourHeight / 60 * root.currentDate.getMinutes() + height: 2 + color: Kube.Colors.plasmaBlue + visible: root.currentDate.getDate() == dayDelegate.date.getDate() + opacity: 0.8 + } + + //Dimm days in the past + Rectangle { + anchors.fill: parent + color: Kube.Colors.buttonColor + opacity: 0.4 + visible: root.currentDate.getDate() > dayDelegate.date.getDate() + } + DropArea { anchors.fill: parent -- cgit v1.2.3