small component patches + code cleanup

This commit is contained in:
SomeElse
2026-05-17 22:30:27 +00:00
parent 262fd8afa0
commit 6db876fc8a
21 changed files with 469 additions and 465 deletions

View File

@@ -9,29 +9,17 @@ import "../../components"
ModuleChip {
id: root
chipColor: t.clockBg
chipColorHovered: t.clockBgHover
chipBorderColor: t.clockBorder
chipBorderColorHovered: t.clockBorderHover
chipHoverEnabled: true
chipTapAction: () => calendarPopup.toggle()
chipAnimWidth: true
width: clockLayout.implicitWidth + 24
height: Cfg.Config.moduleHeight
radius: panelRadius
color: hoverHandler.hovered ? t.clockBgHover : t.clockBg
border.color: hoverHandler.hovered ? t.clockBorderHover : t.clockBorder
border.width: borderWidth
anchors.right: parent.right
Behavior on width { NumberAnimation { duration: 250; easing.type: Easing.OutCubic } }
Behavior on color { ColorAnimation { duration: 150 } }
Behavior on border.color { ColorAnimation { duration: 150 } }
HoverHandler {
id: hoverHandler
cursorShape: Qt.PointingHandCursor
}
TapHandler {
onTapped: calendarPopup.toggle()
}
Item {
id: timeManager
property date now: new Date()
@@ -70,9 +58,9 @@ ModuleChip {
font.bold: true
verticalAlignment: Text.AlignVCenter
opacity: (hoverHandler.hovered || calendarPopup.popupOpen) && Cfg.Config.clockExtendEnabled ? 1.0 : 0.0
opacity: (root.hovered || calendarPopup.popupOpen) && Cfg.Config.clockExtendEnabled ? 1.0 : 0.0
visible: opacity > 0
Layout.preferredWidth: (hoverHandler.hovered || calendarPopup.popupOpen) && Cfg.Config.clockExtendEnabled ? implicitWidth : 0
Layout.preferredWidth: (root.hovered || calendarPopup.popupOpen) && Cfg.Config.clockExtendEnabled ? implicitWidth : 0
clip: true
Behavior on opacity { NumberAnimation { duration: 200 } }
@@ -80,32 +68,22 @@ ModuleChip {
}
}
PopupPanel {
StandardPopup {
id: calendarPopup
ns: "calendar"
chipRoot: root
cardWidth: 284
cardColor: t.calCardBg
cardBorderColor: t.calCardBorder
cardHeight: cardCol.implicitHeight + 28
PopupCard {
id: card
popupOpen: calendarPopup.popupOpen
isTop: root.isTop
animEnabled: calendarPopup.visible
height: cardCol.implicitHeight + 24
component MonthNavButton: Rectangle {
id: navBtn
required property int direction
color: root.t.calCardBg
radius: Cfg.Config.popupRadius
border.color: root.t.calCardBorder
border.width: Cfg.Config.popupBorderWidth
layer.enabled: true
width: 26; height: 26; radius: 6
component MonthNavButton: Rectangle {
id: navBtn
required property int direction
width: 26; height: 26; radius: 6
color: btnMouse.containsMouse
color: btnMouse.containsMouse
? (btnMouse.pressed ? root.t.calArrowBgPress : root.t.calArrowBgHover)
: root.t.calArrowBg
scale: btnMouse.pressed ? 0.88 : 1.0
@@ -252,7 +230,7 @@ ModuleChip {
Repeater {
model: ["Mo","Tu","We","Th","Fr","Sa","Su"]
Text {
width: (card.width - 32) / 7
width: (calendarPopup.card.width - 32) / 7
text: modelData; color: root.t.clockPopupDim
font.pixelSize: 11; horizontalAlignment: Text.AlignHCenter
}
@@ -267,7 +245,7 @@ ModuleChip {
Repeater {
model: 7
delegate: Item {
width: (card.width - 32) / 7; height: 26
width: (calendarPopup.card.width - 32) / 7; height: 26
readonly property int dayNum: (weekRow.weekIndex * 7 + index) - ((new Date(cal.displayYear, cal.displayMonth, 1).getDay() + 6) % 7) + 1
readonly property bool inMonth: dayNum >= 1 && dayNum <= new Date(cal.displayYear, cal.displayMonth + 1, 0).getDate()
readonly property bool isToday: {
@@ -337,6 +315,5 @@ ModuleChip {
Item { height: 4 }
}
}
}
}