make MinuteMarks not rely on cascading

This commit is contained in:
end-4
2025-10-07 17:24:22 +02:00
parent e86a0e23bb
commit a77b7f7b66
5 changed files with 33 additions and 20 deletions
@@ -72,6 +72,11 @@ Item {
// Hour/minutes numbers/dots/lines
MinuteMarks {
anchors.fill: parent
property int hourDotSize: root.hourDotSize
property int hourNumberSize: root.hourNumberSize
property int hourLineSize: root.hourLineSize
property int minuteLineSize: root.minuteLineSize
color: root.colOnBackground
}
HourMarks {
anchors.centerIn: parent
@@ -16,8 +16,7 @@ Item {
Canvas {
z: 0
width: parent.width
height: parent.height
anchors.fill: parent
rotation: {
if (!Config.options.time.secondPrecision) return 0;
return (secondHandLoader.item.rotation + 45); // +45 degrees to align text's center
@@ -8,11 +8,20 @@ import qs.modules.common.functions
import QtQuick
Item {
id: root
property int hourDotSize: 16
property int hourNumberSize: 80
property int hourLineSize: 8
property int minuteLineSize: 4
property color color: Appearance.colors.colOnSecondaryContainer
property string style: Config.options.background.clock.cookie.dialNumberStyle // "dots", "numbers", "full", "hide"
Repeater {
model: 12
Item {
required property int index
opacity: Config.options.background.clock.cookie.dialNumberStyle === "dots" ? 1.0 : 0
opacity: root.style === "dots" ? 1.0 : 0
rotation: 360 / 12 * index
anchors.fill: parent
Behavior on opacity {
@@ -22,7 +31,7 @@ Item {
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
leftMargin: Config.options.background.clock.cookie.dialNumberStyle === "dots" ? 10 : 50
leftMargin: root.style === "dots" ? 10 : 50
}
Behavior on anchors.leftMargin {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
@@ -30,7 +39,7 @@ Item {
implicitWidth: root.hourDotSize
implicitHeight: implicitWidth
radius: implicitWidth / 2
color: root.colOnBackground
color: root.color
opacity: 0.5
}
}
@@ -41,7 +50,7 @@ Item {
model: 4
Item {
required property int index
opacity: Config.options.background.clock.cookie.dialNumberStyle === "numbers" ? 1.0 : 0
opacity: root.style === "numbers" ? 1.0 : 0
rotation: 360 / 4 * index
anchors.fill: parent
Behavior on opacity {
@@ -54,13 +63,13 @@ Item {
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
leftMargin: Config.options.background.clock.cookie.dialNumberStyle === "numbers" ? 32 : 96
leftMargin: root.style === "numbers" ? 32 : 96
}
Behavior on anchors.leftMargin {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
}
StyledText {
color: root.colOnBackground
color: root.color
anchors.centerIn: parent
text: index === 0 ? "9" :
index === 1 ? "12" :
@@ -83,7 +92,7 @@ Item {
required property int index
rotation: 360 / 12 * index
anchors.fill: parent
opacity: Config.options.background.clock.cookie.dialNumberStyle === "full" ? 1.0 : 0
opacity: root.style === "full" ? 1.0 : 0
Behavior on opacity {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
}
@@ -91,11 +100,11 @@ Item {
implicitWidth: root.hourLineSize * 3.5
implicitHeight: root.hourLineSize
radius: implicitWidth / 2
color: root.colOnBackground
color: root.color
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
leftMargin: Config.options.background.clock.cookie.dialNumberStyle === "full" ? 10 : 50
leftMargin: root.style === "full" ? 10 : 50
}
Behavior on anchors.leftMargin {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
@@ -110,7 +119,7 @@ Item {
required property int index
rotation: 360 / 60 * index
anchors.fill: parent
opacity: Config.options.background.clock.cookie.dialNumberStyle === "full" ? 1.0 : 0
opacity: root.style === "full" ? 1.0 : 0
Behavior on opacity {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
}
@@ -118,12 +127,12 @@ Item {
implicitWidth: root.minuteLineSize * 3.5
implicitHeight: root.minuteLineSize
radius: implicitWidth / 2
color: root.colOnBackground
color: root.color
opacity: 0.5
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
leftMargin: Config.options.background.clock.cookie.dialNumberStyle === "full" ? 10 : 50
leftMargin: root.style === "full" ? 10 : 50
}
Behavior on anchors.leftMargin {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
@@ -131,11 +131,11 @@ Singleton {
property real scale: 1
property int clockSides: 12
property JsonObject cookie: JsonObject {
property string dialNumberStyle: "dots" // Options: "dots" , "numbers", "full" , "none"
property string hourHandStyle: "fill" // Options: "classic", "fill", "stroke", "hide"
property string minuteHandStyle: "medium" // Options: "classic", "thin", "medium", "bold", "hide"
property string secondHandStyle: "dot" // Options: "dot", "line" , "none"
property string dateStyle: "rotating" // Options: "rotating", "rect", "bubble" , "none"
property string dialNumberStyle: "dots" // Options: "dots" , "numbers", "full" , "none"
property string hourHandStyle: "fill" // Options: "classic", "fill", "stroke", "hide"
property string minuteHandStyle: "medium" // Options "classic", "thin", "medium", "bold", "hide"
property string secondHandStyle: "dot" // Options: "dot", "line" , "none"
property string dateStyle: "rotating" // Options: "rotating", "rect", "bubble" , "none"
property bool timeIndicators: true
property bool hourMarks: true
property bool dateInClock: true
@@ -58,7 +58,7 @@ ContentPage {
ContentSubsection {
visible: Config.options.background.clock.style === "cookie"
title: Translation.tr("Dial number style")
title: Translation.tr("Dial numbers style")
ConfigSelectionArray {
currentValue: Config.options.background.clock.cookie.dialNumberStyle
onSelected: newValue => {