add setting to show/hide the clock in background (#1881)

This commit is contained in:
end-4
2025-08-31 13:06:16 +07:00
committed by GitHub
3 changed files with 99 additions and 83 deletions
@@ -117,8 +117,8 @@ Variants {
function updateClockPosition() { function updateClockPosition() {
// Somehow all this manual setting is needed to make the proc correctly use the new values // Somehow all this manual setting is needed to make the proc correctly use the new values
leastBusyRegionProc.path = bgRoot.wallpaperPath leastBusyRegionProc.path = bgRoot.wallpaperPath
leastBusyRegionProc.contentWidth = clock.implicitWidth + root.clockSizePadding * 2 leastBusyRegionProc.contentWidth = clockLoader.implicitWidth + root.clockSizePadding * 2
leastBusyRegionProc.contentHeight = clock.implicitHeight + root.clockSizePadding * 2 leastBusyRegionProc.contentHeight = clockLoader.implicitHeight + root.clockSizePadding * 2
leastBusyRegionProc.horizontalPadding = bgRoot.movableXSpace + root.screenSizePadding * 2 leastBusyRegionProc.horizontalPadding = bgRoot.movableXSpace + root.screenSizePadding * 2
leastBusyRegionProc.verticalPadding = bgRoot.movableYSpace + root.screenSizePadding * 2 leastBusyRegionProc.verticalPadding = bgRoot.movableYSpace + root.screenSizePadding * 2
leastBusyRegionProc.running = false; leastBusyRegionProc.running = false;
@@ -215,8 +215,9 @@ Variants {
} }
// The clock // The clock
Item { Loader {
id: clock id: clockLoader
active: Config.options.background.showClock
anchors { anchors {
left: wallpaper.left left: wallpaper.left
top: wallpaper.top top: wallpaper.top
@@ -229,7 +230,8 @@ Variants {
animation: Appearance.animation.elementMove.numberAnimation.createObject(this) animation: Appearance.animation.elementMove.numberAnimation.createObject(this)
} }
} }
sourceComponent: Item {
id: clock
implicitWidth: clockColumn.implicitWidth implicitWidth: clockColumn.implicitWidth
implicitHeight: clockColumn.implicitHeight implicitHeight: clockColumn.implicitHeight
@@ -320,3 +322,4 @@ Variants {
} }
} }
} }
}
@@ -119,6 +119,7 @@ Singleton {
property bool fixedClockPosition: false property bool fixedClockPosition: false
property real clockX: -500 property real clockX: -500
property real clockY: -500 property real clockY: -500
property bool showClock: true
property string wallpaperPath: "" property string wallpaperPath: ""
property string thumbnailPath: "" property string thumbnailPath: ""
property JsonObject parallax: JsonObject { property JsonObject parallax: JsonObject {
@@ -69,6 +69,18 @@ ContentPage {
} }
} }
ContentSection {
title: Translation.tr("Background")
ConfigSwitch {
text: Translation.tr("Show clock")
checked: Config.options.background.showClock
onCheckedChanged: {
Config.options.background.showClock = checked;
}
}
}
ContentSection { ContentSection {
title: Translation.tr("Bar") title: Translation.tr("Bar")