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
}
}
}
}
}
@@ -127,13 +127,20 @@ Singleton {
property real x: -500
property real y: -500
property bool show: true
property string style: "cookie" // Options: "cookie", "digital", "simpler-cookie"
property string style: "cookie" // Options: "cookie", "digital"
property real scale: 1
property int clockSides: 12
property JsonObject cookie: JsonObject {
property bool hourDots: true
property bool timeIndicators: true
property bool minuteHandSizeAdjust: true
}
}
property string wallpaperPath: ""
property string thumbnailPath: ""
property string quote: ""
property bool showQuote: true
property bool hideWhenFullscreen: true
property JsonObject parallax: JsonObject {
property bool vertical: false
@@ -12,11 +12,20 @@ ContentPage {
icon: "wallpaper"
title: Translation.tr("Background")
ConfigSwitch {
text: Translation.tr("Show clock")
checked: Config.options.background.clock.show
onCheckedChanged: {
Config.options.background.clock.show = checked;
ConfigRow{
ConfigSwitch {
text: Translation.tr("Show clock")
checked: Config.options.background.clock.show
onCheckedChanged: {
Config.options.background.clock.show = checked;
}
}
ConfigSwitch {
text: Translation.tr("Show quote")
checked: Config.options.background.showQuote
onCheckedChanged: {
Config.options.background.showQuote = checked;
}
}
}
@@ -43,7 +52,8 @@ ContentPage {
}
}
}
ContentSubsection {
title: Translation.tr("Clock style")
ConfigSelectionArray {
@@ -61,16 +71,51 @@ ContentPage {
displayName: Translation.tr("Material cookie"),
icon: "cookie",
value: "cookie"
},
{
displayName: Translation.tr("Material simpler cookie"),
icon: "circle",
value: "simpler-cookie"
},
}
]
}
}
ContentSubsection {
title: Translation.tr("Cookie clock options")
ConfigRow{
ConfigSwitch {
text: Translation.tr("Hour dots")
checked: Config.options.background.clock.cookie.hourDots
onCheckedChanged: {
Config.options.background.clock.cookie.hourDots = checked;
}
}
ConfigSwitch {
text: Translation.tr("Time indicator")
checked: Config.options.background.clock.cookie.timeIndicators
onCheckedChanged: {
Config.options.background.clock.cookie.timeIndicators = checked;
}
}
ConfigSwitch {
text: Translation.tr("Minute hand adjust")
checked: Config.options.background.clock.cookie.minuteHandSizeAdjust
onCheckedChanged: {
Config.options.background.clock.cookie.minuteHandSizeAdjust = checked;
}
}
}
}
ContentSubsection {
title: Translation.tr("Quote settings")
MaterialTextArea {
Layout.fillWidth: true
placeholderText: Translation.tr("Quote")
text: Config.options.background.quote
wrapMode: TextEdit.Wrap
onTextChanged: {
Config.options.background.quote = text;
}
}
}
ContentSubsection {
title: Translation.tr("Wallpaper parallax")