add secondDot , fix settings layout little more

This commit is contained in:
darksignal7
2025-10-04 18:13:06 +03:00
parent ae74354140
commit f7633dd61f
4 changed files with 63 additions and 4 deletions
@@ -25,7 +25,7 @@ Item {
property real centerDotSize: 10
property real hourDotSize: 12
property real centerGlowSize: 135
property real secondDotSize: 20
property color colShadow: Appearance.colors.colShadow
@@ -35,11 +35,27 @@ Item {
property color colMinuteHand: Appearance.colors.colSecondaryActive
property color colOnHourHand: Appearance.colors.colOnPrimary
property color colTimeIndicators: Appearance.colors.colSecondaryContainerHover
property color colSecondDot: Appearance.colors.colTertiary
readonly property list<string> clockNumbers: DateTime.time.split(/[: ]/)
readonly property int clockHour: parseInt(clockNumbers[0]) % 12
readonly property int clockMinute: parseInt(clockNumbers[1])
property int clockSecond: 0
Loader{
active: Config.option.background.clock.cookie.secondDot
sourceComponent: Timer {
interval: 1000
running: true;repeat: true
onTriggered: {
var now = new Date()
clockSecond = now.getSeconds()
}
}
}
implicitWidth: implicitSize
implicitHeight: implicitSize
@@ -134,6 +150,7 @@ Item {
}
}
// Numbers column
Column {
id: timeIndicators
z: 1
@@ -187,6 +204,9 @@ Item {
Item {
anchors.fill: parent
z: 3
Behavior on rotation{
animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
}
rotation: -90 + (360 / 60) * root.clockMinute
Rectangle {
Behavior on height {
@@ -226,6 +246,33 @@ Item {
radius: implicitWidth / 2
}
// Second dot
Item {
opacity: Config.options.background.clock.cookie.secondDot ? 1.0 : 0
Behavior on opacity {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
}
Behavior on rotation{
animation: Appearance.animation.elementMove.numberAnimation.createObject(this)
}
rotation: (360 / 60 * clockSecond) + 90 // +90 degrees to align with minute hand
anchors.fill: parent
Rectangle {
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
leftMargin: 10
}
implicitWidth: root.secondDotSize
implicitHeight: implicitWidth
radius: implicitWidth / 2
color: colSecondDot
opacity: 1.0
}
}
// Quote
Rectangle{
id: quoteBox
@@ -136,6 +136,7 @@ Singleton {
property bool minuteHandSizeAdjust: true
property bool centerGlow: true
property bool waveAnimation: true
property bool secondDot: true
}
}
@@ -53,7 +53,7 @@ Item {
var radius = root.implicitSize / 2 - root.amplitude
for (var i = 0; i <= steps; i++) {
var angle = (i / steps) * 2 * Math.PI
var wave = waveAnimation ? Math.sin(angle * root.sides + Math.PI/2 + root.waveTime) * root.amplitude : Math.sin(angle * root.sides + Math.PI/2) * root.amplitude
var wave = waveAnimation ? Math.sin(angle * root.sides + Math.PI/2 - root.waveTime) * root.amplitude : Math.sin(angle * root.sides + Math.PI/2) * root.amplitude
var x = Math.cos(angle) * (radius + wave) + cx
var y = Math.sin(angle) * (radius + wave) + cy
points.push(Qt.point(x, y))
@@ -106,7 +106,7 @@ ContentPage {
}
}
}
ConfigRow{
enabled: Config.options.background.clock.style === "cookie"
@@ -126,6 +126,17 @@ ContentPage {
Config.options.background.clock.cookie.minuteHandSizeAdjust = checked;
}
}
}
ConfigRow{
enabled: Config.options.background.clock.style === "cookie"
ConfigSwitch {
buttonIcon: "pace"
text: Translation.tr("Second dot")
checked: Config.options.background.clock.cookie.secondDot
onCheckedChanged: {
Config.options.background.clock.cookie.secondDot = checked;
}
}
ConfigSwitch {
buttonIcon: "waves"
text: Translation.tr("Wave animation")