diff --git a/src/contents/ui/DayLabels.qml b/src/contents/ui/DayLabels.qml index 21916b31777387e426e1477b6224b59ac506d4f7..33a0a827c03efe6fae57b8d0f4f766d47199e338 100644 --- a/src/contents/ui/DayLabels.qml +++ b/src/contents/ui/DayLabels.qml @@ -30,7 +30,7 @@ Row { height: childrenRect.height - spacing: 1 + spacing: 0 Repeater { model: root.daysToShow delegate: Loader { diff --git a/src/contents/ui/MonthView.qml b/src/contents/ui/MonthView.qml index eeca4d8b87d803b82419a7f6b3eda8267da418a3..ed625a463ba1be2ce30ba00db2a428bb711dd217 100644 --- a/src/contents/ui/MonthView.qml +++ b/src/contents/ui/MonthView.qml @@ -155,10 +155,6 @@ Kirigami.Page { objectName: "monthView" width: pathView.width height: pathView.height - daysToShow: daysPerRow * 6 - daysPerRow: 7 - paintGrid: true - showDayIndicator: true loadModel: viewLoader.isNextItem startDate: model.startDate @@ -206,6 +202,11 @@ Kirigami.Page { verticalAlignment: Qt.AlignTop horizontalAlignment: Qt.AlignHCenter text: DateUtils.getWeek(startDate, Qt.locale().firstDayOfWeek) + background: Rectangle { + Kirigami.Theme.inherit: false + Kirigami.Theme.colorSet: Kirigami.Theme.View + color: Kirigami.Theme.backgroundColor + } } openOccurrence: monthPage.openOccurrence diff --git a/src/contents/ui/MultiDayView.qml b/src/contents/ui/MultiDayView.qml index 3f298c3d9f2e307667275238950f5224928f6b37..4fce50dd0136f51c8b81c4e73355c9704fe0f45d 100644 --- a/src/contents/ui/MultiDayView.qml +++ b/src/contents/ui/MultiDayView.qml @@ -24,15 +24,17 @@ Item { property var openOccurrence - property int daysToShow - property int daysPerRow: daysToShow + property int daysToShow: daysPerRow * 6 + property int daysPerRow: 7 property double weekHeaderWidth: Kalendar.Config.showWeekNumbers ? Kirigami.Units.gridUnit * 1.5 : 0 - property double dayWidth: (width - weekHeaderWidth) / daysPerRow + property double dayWidth: Kalendar.Config.showWeekNumbers ? + ((width - weekHeaderWidth) / daysPerRow) - spacing : // No spacing on right, spacing in between weekheader and monthgrid + (width - weekHeaderWidth - (spacing * (daysPerRow - 1))) / daysPerRow // No spacing on left or right of month grid when no week header property date currentDate property date startDate property var calendarFilter - property bool paintGrid: false - property bool showDayIndicator: false + property bool paintGrid: true + property bool showDayIndicator: true property var filter property alias dayHeaderDelegate: dayLabels.delegate property Component weekHeaderDelegate @@ -41,10 +43,9 @@ Item { //Internal property int numberOfLinesShown: 0 property int numberOfRows: (daysToShow / daysPerRow) - property var dayHeight: (height - dayLabels.height) / numberOfRows - + property var dayHeight: ((height - dayLabels.height) / numberOfRows) - spacing + property real spacing: Kalendar.Config.monthGridBorderWidth required property bool loadModel - readonly property bool isDark: LabelUtils.isDarkColor(Kirigami.Theme.backgroundColor) implicitHeight: (numberOfRows > 1 ? Kirigami.Units.gridUnit * 10 * numberOfRows : numberOfLinesShown * Kirigami.Units.gridUnit) + dayLabels.height @@ -67,18 +68,26 @@ Item { } } - Column { - spacing: 0 + Kirigami.Separator { + id: gridBackground anchors { fill: parent + topMargin: dayLabels.height } + } + + Column { + id: rootBackgroundColumn + spacing: root.spacing + anchors.fill: parent DayLabels { id: dayLabels startDate: root.startDate dayWidth: root.dayWidth daysToShow: root.daysPerRow - anchors.leftMargin: weekHeaderWidth + spacing: root.spacing + anchors.leftMargin: Kalendar.Config.showWeekNumbers ? weekHeaderWidth + root.spacing : 0 anchors.left: parent.left anchors.right: parent.right } @@ -94,14 +103,16 @@ Item { RowLayout { width: parent.width height: parent.height - spacing: 0 + spacing: root.spacing Loader { id: weekHeader sourceComponent: root.weekHeaderDelegate property date startDate: DateUtils.addDaysToDate(root.startDate, index * 7) Layout.preferredWidth: weekHeaderWidth Layout.fillHeight: true + active: Kalendar.Config.showWeekNumbers visible: Kalendar.Config.showWeekNumbers + } Item { id: dayDelegate @@ -111,7 +122,7 @@ Item { //Grid Row { - spacing: 0 + spacing: root.spacing height: parent.height Repeater { id: gridRepeater @@ -132,10 +143,6 @@ Item { color: gridItem.isToday ? Kirigami.Theme.activeBackgroundColor : gridItem.isCurrentMonth ? Kirigami.Theme.backgroundColor : Kirigami.Theme.alternateBackgroundColor - // Matches Kirigami Separator color - border.color: Kirigami.ColorUtils.linearInterpolation(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.15) - border.width: 1 - DayMouseArea { anchors.fill: parent addDate: DateUtils.addDaysToDate(dayDelegate.startDate, modelData) @@ -178,11 +185,12 @@ Item { } Column { - spacing: 0 + id: rootForegroundColumn + spacing: root.spacing anchors { fill: parent - topMargin: dayLabels.height - leftMargin: weekHeaderWidth + topMargin: dayLabels.height + root.spacing + leftMargin: Kalendar.Config.showWeekNumbers ? weekHeaderWidth + root.spacing : 0 } //Weeks @@ -196,7 +204,7 @@ Item { RowLayout { width: parent.width height: parent.height - spacing: 0 + spacing: root.spacing Item { id: dayDelegate Layout.fillWidth: true @@ -213,8 +221,10 @@ Item { QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff ListView { - Layout.fillWidth: true id: linesRepeater + Layout.fillWidth: true + Layout.rightMargin: parent.contentHeight > parent.availableHeight ? + spacing : spacing clip: true spacing: Kirigami.Units.smallSpacing @@ -248,16 +258,15 @@ Item { delegate: Item { id: line height: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing - width: parent.width //Incidences Repeater { id: incidencesRepeater model: modelData Rectangle { - x: ((root.dayWidth /*+ 1*/) * modelData.starts) + horizontalSpacing // +1 because of the spacing between each day + x: ((root.dayWidth + root.spacing) * modelData.starts) + horizontalSpacing y: 0 - width: (root.dayWidth * modelData.duration) - (horizontalSpacing * 2) // Account for spacing added to x and for spacing at end of line + width: ((root.dayWidth + root.spacing) * modelData.duration) - (horizontalSpacing * 2) - root.spacing // Account for spacing added to x and for spacing at end of line height: parent.height opacity: isOpenOccurrence || modelData.endTime.getMonth() == root.month || @@ -267,7 +276,7 @@ Item { color: Qt.rgba(0,0,0,0) property int rectRadius: 5 - property int horizontalSpacing: Kirigami.Units.smallSpacing + property int horizontalSpacing: linesRepeater.spacing property bool isOpenOccurrence: root.openOccurrence ? root.openOccurrence.incidenceId === modelData.incidenceId : false diff --git a/src/contents/ui/Settings/ViewSettingsPage.qml b/src/contents/ui/Settings/ViewSettingsPage.qml index 0116ceb8128dc06f689124d647c90af215831ee1..8536383814ef0a4b0350be7416d445f9df256179 100644 --- a/src/contents/ui/Settings/ViewSettingsPage.qml +++ b/src/contents/ui/Settings/ViewSettingsPage.qml @@ -4,6 +4,7 @@ import QtQuick 2.15 import org.kde.kirigami 2.14 as Kirigami import QtQuick.Controls 2.15 as Controls +import QtQuick.Layouts 1.15 import org.kde.kalendar 1.0 Kirigami.ScrollablePage { @@ -87,6 +88,24 @@ Kirigami.ScrollablePage { Config.save(); } } + RowLayout { + Kirigami.FormData.label: i18n("Grid border width (pixels):") + Layout.fillWidth: true + Controls.SpinBox { + Layout.fillWidth: true + value: Config.monthGridBorderWidth + onValueChanged: Config.monthGridBorderWidth = value + from: 0 + to: 50 + } + Rectangle { + Layout.alignment: Qt.AlignVCenter + width: Kirigami.Units.gridUnit * 4 + implicitHeight: height + height: Config.monthGridBorderWidth + color: Kirigami.ColorUtils.linearInterpolation(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.15) + } + } Kirigami.Separator { Kirigami.FormData.isSection: true diff --git a/src/kalendarconfig.kcfg b/src/kalendarconfig.kcfg index ecae41a1eca6b5d932d1f622069e3cbb2745970c..280392f7359f6df208bbcb4f6e7b61edf8680d06 100644 --- a/src/kalendarconfig.kcfg +++ b/src/kalendarconfig.kcfg @@ -70,6 +70,11 @@ true + + + + 1 +