cookie clock: put hands in loaders

This commit is contained in:
end-4
2025-10-11 16:55:20 +02:00
parent 22316b4684
commit 410da66834
6 changed files with 71 additions and 104 deletions
@@ -1,6 +1,7 @@
pragma ComponentBehavior: Bound
import qs.modules.common
import qs.modules.common.widgets
import QtQuick
Item {
@@ -14,50 +15,23 @@ Item {
property string style: "hide"
property color color: Appearance.colors.colSecondary
z: root.style === "line" ? 2 : 3
rotation: (360 / 60 * clockSecond) + 90 // +90 degrees to align with minute hand
opacity: root.style !== "hide" ? 1.0 : 0
rotation: (360 / 60 * clockSecond) + 90
Behavior on opacity {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
}
Behavior on rotation {
enabled: Config.options.background.clock.cookie.constantlyRotate // Animating every second is expensive...
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
}
Rectangle {
implicitWidth: root.style === "dot" ? root.dotSize : root.handLength
implicitHeight: root.style === "dot" ? root.dotSize : root.handWidth
radius: root.style === "dot" ? implicitWidth / 2 : root.handWidth / 2
color: root.color
Behavior on implicitHeight {
animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
}
Behavior on implicitWidth {
animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
}
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
leftMargin: 10
}
}
Rectangle {
// Dot on the classic style
opacity: root.style === "classic" ? 1.0 : 0.0
implicitHeight: root.style === "classic" ? 14 : 0
implicitWidth: root.style === "classic" ? 14 : 0
implicitWidth: root.style === "dot" ? root.dotSize : root.handLength
implicitHeight: root.style === "dot" ? root.dotSize : root.handWidth
radius: Math.min(width, height) / 2
color: root.color
radius: Appearance.rounding.small
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
leftMargin: 40
}
Behavior on opacity {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
}
Behavior on implicitHeight {
animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
}
@@ -65,4 +39,29 @@ Item {
animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
}
}
}
// Classic style dot in the middle of the hand
FadeLoader {
id: classicDotLoader
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
}
shown: root.style === "classic"
Rectangle {
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
leftMargin: 40
}
implicitWidth: root.style === "classic" ? 14 : 0
implicitHeight: implicitWidth
color: root.color
radius: Appearance.rounding.small
Behavior on implicitWidth {
animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
}
}
}
}