add settings for clock, add quote for cookie clock, make quote editable from settings

This commit is contained in:
darksignal7
2025-10-04 13:47:40 +03:00
parent 2399600169
commit 26b9d8193c
4 changed files with 126 additions and 22 deletions
@@ -313,7 +313,7 @@ Variants {
}
StyledText {
// Somehow gets fucked up if made a ClockText???
visible: Config.options.background.quote.length > 0
visible: Config.options.background.showQuote && Config.options.background.quote.length > 0
Layout.fillWidth: true
horizontalAlignment: bgRoot.textHorizontalAlignment
font {
@@ -332,10 +332,11 @@ Variants {
Loader {
id: cookieClockLoader
visible: root.clockStyle === "cookie" || root.clockStyle === "simpler-cookie"
visible: root.clockStyle === "cookie"
active: visible
sourceComponent: CookieClock {}
}
}
Item {
@@ -409,7 +410,7 @@ Variants {
}
}
// Components
// ComponentsCookieClock {}
component ClockText: StyledText {
Layout.fillWidth: true
horizontalAlignment: bgRoot.textHorizontalAlignment
@@ -14,14 +14,16 @@ Item {
id: root
readonly property string clockStyle: Config.options.background.clock.style
readonly property bool showQuote: Config.options.background.showQuote && Config.options.background.quote.length > 0 && !GlobalStates.screenLocked
property real implicitSize: 230
property real hourHandLength: 72
property real hourHandWidth: 20
property real minuteHandLength: 95
property real minuteHandWidth: clockStyle === "simpler-cookie" ? hourHandWidth : 12
property real minuteHandWidth: Config.options.background.clock.cookie.minuteHandSizeAdjust ? hourHandWidth : 12
property real centerDotSize: 10
property real hourDotSize: minuteHandWidth
property real hourDotSize: 12
property color colShadow: Appearance.colors.colShadow
property color colBackground: Appearance.colors.colSecondaryContainer
@@ -38,7 +40,17 @@ Item {
implicitHeight: implicitSize
DropShadow {
source: cookie
source: cookie
anchors.fill: source
horizontalOffset: 0
verticalOffset: 2
radius: 12
samples: radius * 2 + 1
color: root.colShadow
transparentBorder: true
}
DropShadow {
source: quoteBox
anchors.fill: source
horizontalOffset: 0
verticalOffset: 2
@@ -60,7 +72,7 @@ Item {
Repeater {
model: 12
Item {
visible: clockStyle === "simpler-cookie" ? false : true
visible: Config.options.background.clock.cookie.hourDots
required property int index
rotation: 360 / 12 * index
anchors.fill: parent
@@ -85,7 +97,7 @@ Item {
z: 1
anchors.centerIn: cookie
spacing: -16
visible: clockStyle === "simpler-cookie" ? false : true
visible: Config.options.background.clock.cookie.timeIndicators
// Numbers
Repeater {
@@ -137,7 +149,7 @@ Item {
// Center dot
Rectangle {
visible: clockStyle === "simpler-cookie" ? false : true
visible: !Config.options.background.clock.cookie.minuteHandSizeAdjust
z: 4
color: root.colOnHourHand
anchors.centerIn: parent
@@ -145,4 +157,43 @@ Item {
implicitHeight: implicitWidth
radius: implicitWidth / 2
}
// Quote
Rectangle{
id: quoteBox
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.bottom
anchors.topMargin: 24
implicitWidth: quoteText.width + quoteIcon.width + 12 // 12 for spacing on both sides
implicitHeight: showQuote ? 30 : 0 // A better way to hide can be found
radius: Appearance.rounding.small
color: Appearance.colors.colSecondaryContainer
RowLayout{
anchors.centerIn: parent
spacing: 4
Behavior on opacity {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
}
MaterialSymbol{
id: quoteIcon
visible: showQuote > 0
iconSize: Appearance.font.pixelSize.huge
text: "comic_bubble"
}
StyledText{
id: quoteText
visible : showQuote > 0
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
text: Config.options.background.quote
font {
family: Appearance.font.family.main
pixelSize: Appearance.font.pixelSize.large
weight: Font.Normal
}
}
}
}
}