summaryrefslogtreecommitdiff
path: root/modules/dashboard/dash/DateTime.qml
blob: 57fac835e7dacbb45d0460f3ee5a29ea83122443 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import qs.widgets
import qs.services
import qs.config
import QtQuick
import QtQuick.Layouts

Item {
    id: root

    readonly property list<string> timeComponents: Time.format(Config.services.useTwelveHourClock ? "hh:mm:A" : "hh:mm").split(":")

    anchors.top: parent.top
    anchors.bottom: parent.bottom
    implicitWidth: Config.dashboard.sizes.dateTimeWidth

    ColumnLayout {
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.verticalCenter: parent.verticalCenter
        spacing: 0

        StyledText {
            Layout.alignment: Qt.AlignHCenter
            text: root.timeComponents[0]
            color: Colours.palette.m3secondary
            font.pointSize: Appearance.font.size.extraLarge
            font.weight: 600
        }

        StyledText {
            Layout.topMargin: -(font.pointSize * 0.2)
            Layout.alignment: Qt.AlignHCenter
            text: "•••"
            color: Colours.palette.m3primary
            font.pointSize: Appearance.font.size.extraLarge * 0.9
        }

        StyledText {
            Layout.alignment: Qt.AlignHCenter
            text: root.timeComponents[1]
            color: Colours.palette.m3secondary
            font.pointSize: Appearance.font.size.extraLarge
            font.weight: 600
        }

        StyledText {
            visible: Config.services.useTwelveHourClock
            Layout.topMargin: Appearance.spacing.small
            Layout.alignment: Qt.AlignHCenter

            text: root.timeComponents[2]
            color: Colours.palette.m3secondary
            font.pointSize: Appearance.font.size.large
            font.weight: 600
        }

        StyledText {
            Layout.topMargin: Appearance.spacing.normal
            Layout.fillWidth: true
            horizontalAlignment: Text.AlignHCenter
            text: Time.format("ddd, d")
            color: Colours.palette.m3tertiary
            font.pointSize: Appearance.font.size.normal
            font.weight: 500
            elide: Text.ElideRight
        }
    }
}