forked from Shinonome/dots-hyprland
add settings for clock, add quote for cookie clock, make quote editable from settings
This commit is contained in:
@@ -313,7 +313,7 @@ Variants {
|
|||||||
}
|
}
|
||||||
StyledText {
|
StyledText {
|
||||||
// Somehow gets fucked up if made a ClockText???
|
// 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
|
Layout.fillWidth: true
|
||||||
horizontalAlignment: bgRoot.textHorizontalAlignment
|
horizontalAlignment: bgRoot.textHorizontalAlignment
|
||||||
font {
|
font {
|
||||||
@@ -332,10 +332,11 @@ Variants {
|
|||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: cookieClockLoader
|
id: cookieClockLoader
|
||||||
visible: root.clockStyle === "cookie" || root.clockStyle === "simpler-cookie"
|
visible: root.clockStyle === "cookie"
|
||||||
active: visible
|
active: visible
|
||||||
sourceComponent: CookieClock {}
|
sourceComponent: CookieClock {}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@@ -409,7 +410,7 @@ Variants {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Components
|
// ComponentsCookieClock {}
|
||||||
component ClockText: StyledText {
|
component ClockText: StyledText {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
horizontalAlignment: bgRoot.textHorizontalAlignment
|
horizontalAlignment: bgRoot.textHorizontalAlignment
|
||||||
|
|||||||
@@ -14,14 +14,16 @@ Item {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property string clockStyle: Config.options.background.clock.style
|
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 implicitSize: 230
|
||||||
property real hourHandLength: 72
|
property real hourHandLength: 72
|
||||||
property real hourHandWidth: 20
|
property real hourHandWidth: 20
|
||||||
property real minuteHandLength: 95
|
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 centerDotSize: 10
|
||||||
property real hourDotSize: minuteHandWidth
|
property real hourDotSize: 12
|
||||||
|
|
||||||
property color colShadow: Appearance.colors.colShadow
|
property color colShadow: Appearance.colors.colShadow
|
||||||
property color colBackground: Appearance.colors.colSecondaryContainer
|
property color colBackground: Appearance.colors.colSecondaryContainer
|
||||||
@@ -38,7 +40,17 @@ Item {
|
|||||||
implicitHeight: implicitSize
|
implicitHeight: implicitSize
|
||||||
|
|
||||||
DropShadow {
|
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
|
anchors.fill: source
|
||||||
horizontalOffset: 0
|
horizontalOffset: 0
|
||||||
verticalOffset: 2
|
verticalOffset: 2
|
||||||
@@ -60,7 +72,7 @@ Item {
|
|||||||
Repeater {
|
Repeater {
|
||||||
model: 12
|
model: 12
|
||||||
Item {
|
Item {
|
||||||
visible: clockStyle === "simpler-cookie" ? false : true
|
visible: Config.options.background.clock.cookie.hourDots
|
||||||
required property int index
|
required property int index
|
||||||
rotation: 360 / 12 * index
|
rotation: 360 / 12 * index
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -85,7 +97,7 @@ Item {
|
|||||||
z: 1
|
z: 1
|
||||||
anchors.centerIn: cookie
|
anchors.centerIn: cookie
|
||||||
spacing: -16
|
spacing: -16
|
||||||
visible: clockStyle === "simpler-cookie" ? false : true
|
visible: Config.options.background.clock.cookie.timeIndicators
|
||||||
|
|
||||||
// Numbers
|
// Numbers
|
||||||
Repeater {
|
Repeater {
|
||||||
@@ -137,7 +149,7 @@ Item {
|
|||||||
|
|
||||||
// Center dot
|
// Center dot
|
||||||
Rectangle {
|
Rectangle {
|
||||||
visible: clockStyle === "simpler-cookie" ? false : true
|
visible: !Config.options.background.clock.cookie.minuteHandSizeAdjust
|
||||||
z: 4
|
z: 4
|
||||||
color: root.colOnHourHand
|
color: root.colOnHourHand
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
@@ -145,4 +157,43 @@ Item {
|
|||||||
implicitHeight: implicitWidth
|
implicitHeight: implicitWidth
|
||||||
radius: implicitWidth / 2
|
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 x: -500
|
||||||
property real y: -500
|
property real y: -500
|
||||||
property bool show: true
|
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 real scale: 1
|
||||||
property int clockSides: 12
|
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 wallpaperPath: ""
|
||||||
property string thumbnailPath: ""
|
property string thumbnailPath: ""
|
||||||
property string quote: ""
|
property string quote: ""
|
||||||
|
property bool showQuote: true
|
||||||
property bool hideWhenFullscreen: true
|
property bool hideWhenFullscreen: true
|
||||||
property JsonObject parallax: JsonObject {
|
property JsonObject parallax: JsonObject {
|
||||||
property bool vertical: false
|
property bool vertical: false
|
||||||
|
|||||||
@@ -12,11 +12,20 @@ ContentPage {
|
|||||||
icon: "wallpaper"
|
icon: "wallpaper"
|
||||||
title: Translation.tr("Background")
|
title: Translation.tr("Background")
|
||||||
|
|
||||||
ConfigSwitch {
|
ConfigRow{
|
||||||
text: Translation.tr("Show clock")
|
ConfigSwitch {
|
||||||
checked: Config.options.background.clock.show
|
text: Translation.tr("Show clock")
|
||||||
onCheckedChanged: {
|
checked: Config.options.background.clock.show
|
||||||
Config.options.background.clock.show = checked;
|
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 {
|
ContentSubsection {
|
||||||
title: Translation.tr("Clock style")
|
title: Translation.tr("Clock style")
|
||||||
ConfigSelectionArray {
|
ConfigSelectionArray {
|
||||||
@@ -61,16 +71,51 @@ ContentPage {
|
|||||||
displayName: Translation.tr("Material cookie"),
|
displayName: Translation.tr("Material cookie"),
|
||||||
icon: "cookie",
|
icon: "cookie",
|
||||||
value: "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 {
|
ContentSubsection {
|
||||||
title: Translation.tr("Wallpaper parallax")
|
title: Translation.tr("Wallpaper parallax")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user