diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-20 22:01:42 +0800 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-20 22:01:42 +0800 |
| commit | c32d9035e035d5539a639b2f60314bd1002c107a (patch) | |
| tree | 7d89ec483c392bca8e54c85a1a6a63ef5c808564 | |
| parent | launcher: limit width to less of screen (diff) | |
| download | caelestia-shell-c32d9035e035d5539a639b2f60314bd1002c107a.tar.gz caelestia-shell-c32d9035e035d5539a639b2f60314bd1002c107a.tar.bz2 caelestia-shell-c32d9035e035d5539a639b2f60314bd1002c107a.zip | |
dashboard: add calendar
| -rw-r--r-- | modules/dashboard/Dash.qml | 6 | ||||
| -rw-r--r-- | modules/dashboard/dash/Calendar.qml | 65 | ||||
| -rw-r--r-- | modules/dashboard/dash/DateTime.qml | 5 |
3 files changed, 71 insertions, 5 deletions
diff --git a/modules/dashboard/Dash.qml b/modules/dashboard/Dash.qml index 31ece71..52ee629 100644 --- a/modules/dashboard/Dash.qml +++ b/modules/dashboard/Dash.qml @@ -27,18 +27,18 @@ GridLayout { Rect { Layout.row: 1 + Layout.fillHeight: true DateTime {} } Rect { - // text: "calendar" - Layout.row: 1 Layout.column: 1 Layout.columnSpan: 3 Layout.fillWidth: true - Layout.fillHeight: true + + Calendar {} } Rect { diff --git a/modules/dashboard/dash/Calendar.qml b/modules/dashboard/dash/Calendar.qml new file mode 100644 index 0000000..ac31861 --- /dev/null +++ b/modules/dashboard/dash/Calendar.qml @@ -0,0 +1,65 @@ +import "root:/widgets" +import "root:/services" +import "root:/config" +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ColumnLayout { + id: root + + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: Appearance.padding.large + spacing: Appearance.spacing.small + + DayOfWeekRow { + id: days + + Layout.topMargin: Appearance.padding.large + Layout.fillWidth: true + + font.family: Appearance.font.family.sans + font.weight: 500 + + // delegate: StyledText {} + } + + MonthGrid { + id: grid + + Layout.bottomMargin: Appearance.padding.large + Layout.fillWidth: true + + spacing: 3 + + delegate: Item { + id: day + + required property var model + + implicitWidth: implicitHeight + implicitHeight: text.implicitHeight + Appearance.padding.small * 2 + + StyledRect { + anchors.centerIn: parent + + implicitWidth: parent.implicitHeight + implicitHeight: parent.implicitHeight + + radius: Appearance.rounding.full + color: model.today ? Colours.palette.m3primary : "transparent" + + StyledText { + id: text + + anchors.centerIn: parent + + horizontalAlignment: Text.AlignHCenter + text: grid.locale.toString(day.model.date, "d") + color: day.model.today ? Colours.palette.m3onPrimary : day.model.month === grid.month ? Colours.palette.m3onSurface : Colours.palette.m3outline + } + } + } + } +} diff --git a/modules/dashboard/dash/DateTime.qml b/modules/dashboard/dash/DateTime.qml index 7b4e277..5f44227 100644 --- a/modules/dashboard/dash/DateTime.qml +++ b/modules/dashboard/dash/DateTime.qml @@ -6,8 +6,9 @@ import QtQuick Item { id: root + anchors.top: parent.top + anchors.bottom: parent.bottom implicitWidth: DashboardConfig.sizes.dateTimeWidth - implicitHeight: date.y + date.implicitHeight + Appearance.padding.large * 2 StyledText { id: hours @@ -15,7 +16,7 @@ Item { anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top - anchors.topMargin: Appearance.padding.large * 2 + anchors.topMargin: (root.height - (hours.implicitHeight + sep.implicitHeight + sep.anchors.topMargin + mins.implicitHeight + mins.anchors.topMargin + date.implicitHeight + date.anchors.topMargin)) / 2 horizontalAlignment: Text.AlignHCenter text: Time.format("HH") |