Rearrange for tidier structure (#2212)

This commit is contained in:
clsty
2025-10-16 07:19:55 +08:00
parent 13065d7e5a
commit 8b493e091d
529 changed files with 165 additions and 138 deletions
@@ -0,0 +1,36 @@
pragma ComponentBehavior: Bound
import qs.services
import qs.modules.common
import qs.modules.common.widgets
import QtQuick
Item {
id: root
property bool isMonth: false
property real targetSize: 0
property alias text: bubbleText.text
text: Qt.locale().toString(DateTime.clock.date, root.isMonth ? "MM" : "d")
MaterialCookie {
z: 5
sides: root.isMonth ? 1 : 4
anchors.centerIn: parent
color: root.isMonth ? Appearance.colors.colPrimaryContainer : Appearance.colors.colTertiaryContainer
implicitSize: targetSize
constantlyRotate: Config.options.background.clock.cookie.constantlyRotate
}
StyledText {
id: bubbleText
z: 6
anchors.centerIn: parent
color: root.isMonth ? Appearance.colors.colPrimary : Appearance.colors.colTertiary
font {
family: Appearance.font.family.expressive
pixelSize: 30
weight: Font.Black
}
}
}
@@ -0,0 +1,76 @@
pragma ComponentBehavior: Bound
import qs.modules.common
import qs.modules.common.widgets
import qs.modules.common.functions
import QtQuick
Item {
id: root
property string style: "bubble"
property color color: Appearance.colors.colOnSecondaryContainer
property real dateSquareSize: 64
// Rotating date
FadeLoader {
anchors.fill: parent
shown: Config.options.background.clock.cookie.dateStyle === "border"
sourceComponent: RotatingDate {
color: root.color
}
}
// Rectangle date (only today's number) in right side of the clock
FadeLoader {
id: rectLoader
shown: root.style === "rect"
anchors {
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: 40 - rectLoader.opacity * 30
}
sourceComponent: RectangleDate {
color: ColorUtils.mix(root.color, Appearance.colors.colSecondaryContainerHover, 0.5)
radius: Appearance.rounding.small
implicitWidth: 45 * rectLoader.opacity
implicitHeight: 30 * rectLoader.opacity
}
}
// Bubble style: day of month
FadeLoader {
id: dayBubbleLoader
shown: root.style === "bubble"
property real targetSize: root.dateSquareSize * opacity
anchors {
left: parent.left
top: parent.top
}
sourceComponent: BubbleDate {
implicitWidth: dayBubbleLoader.targetSize
implicitHeight: dayBubbleLoader.targetSize
isMonth: false
targetSize: dayBubbleLoader.targetSize
}
}
// Bubble style: month
FadeLoader {
id: monthBubbleLoader
shown: root.style === "bubble"
property real targetSize: root.dateSquareSize * opacity
anchors {
right: parent.right
bottom: parent.bottom
}
sourceComponent: BubbleDate {
implicitWidth: monthBubbleLoader.targetSize
implicitHeight: monthBubbleLoader.targetSize
isMonth: true
targetSize: monthBubbleLoader.targetSize
}
}
}
@@ -0,0 +1,21 @@
import qs.services
import qs.modules.common
import qs.modules.common.widgets
import QtQuick
Rectangle {
id: rect
readonly property string dialStyle: Config.options.background.clock.cookie.dialNumberStyle
StyledText {
anchors.centerIn: parent
color: Appearance.colors.colSecondaryHover
text: Qt.locale().toString(DateTime.clock.date, "dd")
font {
family: Appearance.font.family.expressive
pixelSize: 20
weight: 1000
}
}
}
@@ -0,0 +1,50 @@
pragma ComponentBehavior: Bound
import qs.services
import qs.modules.common
import qs.modules.common.widgets
import QtQuick
Item {
id: root
property string style: Config.options.background.clock.cookie.dateStyle
property color color: Appearance.colors.colOnSecondaryContainer
property real angleStep: 12 * Math.PI / 180
property string dateText: Qt.locale().toString(DateTime.clock.date, "ddd dd")
readonly property int clockSecond: DateTime.clock.seconds
readonly property string dialStyle: Config.options.background.clock.cookie.dialNumberStyle
readonly property bool timeIndicators: Config.options.background.clock.cookie.timeIndicators
property real radius: style === "border" ? 90 : 0
Behavior on radius {
animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
}
rotation: {
if (!Config.options.time.secondPrecision) return 0
else return (360 / 60 * clockSecond) + 180 - (angleStep / Math.PI * 180 * dateText.length) / 2
}
Repeater {
model: root.dateText.length
delegate: Text {
required property int index
property real angle: index * root.angleStep - Math.PI / 2
x: root.width / 2 + root.radius * Math.cos(angle) - width / 2
y: root.height / 2 + root.radius * Math.sin(angle) - height / 2
rotation: angle * 180 / Math.PI + 90
color: root.color
font {
family: Appearance.font.family.title
pixelSize: 30
weight: Font.DemiBold
}
text: root.dateText.charAt(index)
}
}
}