71 lines
2 KiB
QML
71 lines
2 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import QtQuick
|
|
import qs.components
|
|
import qs.services
|
|
import Caelestia.Config
|
|
|
|
StyledRect {
|
|
id: root
|
|
|
|
readonly property color colour: Colours.palette.m3tertiary
|
|
readonly property int padding: Config.bar.clock.background ? Tokens.padding.normal : Tokens.padding.small
|
|
|
|
implicitWidth: Config.bar.sizes.innerWidth
|
|
implicitHeight: layout.implicitHeight + root.padding * 2
|
|
|
|
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, Config.bar.clock.background ? Colours.tPalette.m3surfaceContainer.a : 0)
|
|
radius: Tokens.rounding.full
|
|
|
|
Column {
|
|
id: layout
|
|
|
|
anchors.centerIn: parent
|
|
spacing: Tokens.spacing.small
|
|
|
|
Loader {
|
|
asynchronous: true
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
active: Config.bar.clock.showIcon
|
|
visible: active
|
|
|
|
sourceComponent: MaterialIcon {
|
|
text: "calendar_month"
|
|
color: root.colour
|
|
}
|
|
}
|
|
|
|
StyledText {
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
visible: Config.bar.clock.showDate
|
|
|
|
horizontalAlignment: StyledText.AlignHCenter
|
|
text: Time.format("ddd\nd")
|
|
font.pointSize: Tokens.font.size.smaller
|
|
font.family: Tokens.font.family.sans
|
|
color: root.colour
|
|
}
|
|
|
|
Rectangle {
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
visible: Config.bar.clock.showDate
|
|
height: visible ? 1 : 0
|
|
|
|
width: parent.width * 0.8
|
|
color: root.colour
|
|
opacity: 0.2
|
|
}
|
|
|
|
StyledText {
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
horizontalAlignment: StyledText.AlignHCenter
|
|
text: Time.format(Config.services.useTwelveHourClock ? "hh\nmm\nA" : "hh\nmm")
|
|
font.pointSize: Tokens.font.size.smaller
|
|
font.family: Tokens.font.family.mono
|
|
color: root.colour
|
|
}
|
|
}
|
|
}
|