forked from Shinonome/dots-hyprland
put time column in loader, use fewer Behaviors
This commit is contained in:
@@ -77,7 +77,8 @@ Item {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: root.colOnBackground
|
color: root.colOnBackground
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stupid extra hour marks in the middle
|
||||||
FadeLoader {
|
FadeLoader {
|
||||||
id: hourMarksLoader
|
id: hourMarksLoader
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
@@ -90,11 +91,20 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Number column in the middle
|
// Number column in the middle
|
||||||
TimeColumn {
|
FadeLoader {
|
||||||
|
id: timeColumnLoader
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: root.colOnBackground
|
shown: Config.options.background.clock.cookie.timeIndicators
|
||||||
clockNumbers: root.clockNumbers
|
scale: 1.4 - 0.4 * timeColumnLoader.shown
|
||||||
|
Behavior on scale {
|
||||||
|
animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceComponent: TimeColumn {
|
||||||
|
color: root.colOnBackground
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Hour hand
|
// Hour hand
|
||||||
HourHand {
|
HourHand {
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ import QtQuick.Layouts
|
|||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: root
|
id: root
|
||||||
required property list<string> clockNumbers
|
property list<string> clockNumbers: DateTime.time.split(/[: ]/)
|
||||||
property bool isEnabled: Config.options.background.clock.cookie.timeIndicators
|
property bool isEnabled: Config.options.background.clock.cookie.timeIndicators
|
||||||
property color color: Appearance.colors.colOnSecondaryContainer
|
property color color: Appearance.colors.colOnSecondaryContainer
|
||||||
|
|
||||||
z: 0
|
property bool hourMarksEnabled: Config.options.background.clock.cookie.hourMarks
|
||||||
spacing: -16
|
spacing: -16
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
@@ -22,31 +22,24 @@ ColumnLayout {
|
|||||||
|
|
||||||
delegate: StyledText {
|
delegate: StyledText {
|
||||||
required property string modelData
|
required property string modelData
|
||||||
property bool hourMarksEnabled: Config.options.background.clock.cookie.hourMarks
|
|
||||||
property bool isAmPm: !modelData.match(/\d{2}/i)
|
property bool isAmPm: !modelData.match(/\d{2}/i)
|
||||||
property real numberSizeWithoutGlow: isAmPm ? 26 : 68
|
property real numberSizeWithoutGlow: isAmPm ? 26 : 68
|
||||||
property real numberSizeWithGlow: isAmPm ? 20 : 40
|
property real numberSizeWithGlow: isAmPm ? 20 : 40
|
||||||
property real numberSize: root.isEnabled ? (hourMarksEnabled ? numberSizeWithGlow : numberSizeWithoutGlow) : 100 // open/close animation
|
property real numberSize: root.hourMarksEnabled ? numberSizeWithGlow : numberSizeWithoutGlow
|
||||||
|
|
||||||
anchors.horizontalCenter: root.horizontalCenter
|
anchors.horizontalCenter: root.horizontalCenter
|
||||||
visible: opacity > 0
|
|
||||||
color: root.color
|
color: root.color
|
||||||
opacity: root.isEnabled ? 1.0 : 0
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
text: modelData.padStart(2, "0")
|
|
||||||
|
|
||||||
font {
|
font {
|
||||||
family: Appearance.font.family.expressive
|
family: Appearance.font.family.expressive
|
||||||
weight: Font.Bold
|
weight: Font.Bold
|
||||||
pixelSize: numberSize
|
pixelSize: numberSize
|
||||||
Behavior on pixelSize {
|
|
||||||
animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Behavior on numberSize {
|
||||||
|
animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
text: modelData.padStart(2, "0")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user