splitted the code base into more components and implemented safety measures to Crypto.qml, also added missing themes and removed hardcoded values

This commit is contained in:
SomeElse
2026-05-17 01:17:01 +00:00
parent c8343398f9
commit 262fd8afa0
26 changed files with 344 additions and 295 deletions

View File

@@ -9,8 +9,6 @@ import "../../components"
ModuleChip {
id: root
TimezoneProvider { id: timezone }
width: clockLayout.implicitWidth + 24
height: Cfg.Config.moduleHeight
radius: panelRadius
@@ -57,7 +55,7 @@ ModuleChip {
}
Text {
text: timezone.toTz(timeManager.now).toLocaleTimeString(Qt.locale(), "HH:mm")
text: TimezoneProvider.toTz(timeManager.now).toLocaleTimeString(Qt.locale(), "HH:mm")
color: root.t.clockTime
font.pixelSize: 13
font.bold: true
@@ -66,7 +64,7 @@ ModuleChip {
Text {
id: secondsText
text: ":" + timezone.toTz(timeManager.now).toLocaleTimeString(Qt.locale(), "ss")
text: ":" + TimezoneProvider.toTz(timeManager.now).toLocaleTimeString(Qt.locale(), "ss")
color: root.t.clockSeconds
font.pixelSize: 13
font.bold: true
@@ -88,37 +86,19 @@ ModuleChip {
chipRoot: root
cardWidth: 284
Rectangle {
PopupCard {
id: card
width: parent.width
popupOpen: calendarPopup.popupOpen
isTop: root.isTop
animEnabled: calendarPopup.visible
height: cardCol.implicitHeight + 24
anchors.top: root.isTop ? parent.top : undefined
anchors.bottom: root.isTop ? undefined : parent.bottom
transform: Translate {
y: calendarPopup.popupOpen ? 0 : (root.isTop ? -card.height : card.height)
Behavior on y {
NumberAnimation {
duration: Cfg.Config.popupAnimDuration;
easing.type: Easing.OutExpo
}
enabled: calendarPopup.visible
}
}
opacity: calendarPopup.popupOpen ? 1.0 : 0.0
Behavior on opacity { NumberAnimation { duration: 200 } }
color: root.t.calCardBg
radius: Cfg.Config.popupRadius
border.color: root.t.calCardBorder
border.width: Cfg.Config.popupBorderWidth
layer.enabled: true
MouseArea { anchors.fill: parent; propagateComposedEvents: false }
component MonthNavButton: Rectangle {
id: navBtn
required property int direction
@@ -180,7 +160,7 @@ ModuleChip {
Layout.fillWidth: true
Text {
text: timezone.toTz(timeManager.now).toLocaleDateString(Qt.locale(), "dddd")
text: TimezoneProvider.toTz(timeManager.now).toLocaleDateString(Qt.locale(), "dddd")
color: root.t.clockPopupDim
font.pixelSize: 12
font.capitalization: Font.AllUppercase
@@ -189,7 +169,7 @@ ModuleChip {
}
Text {
text: timezone.toTz(timeManager.now).toLocaleDateString(Qt.locale(), "d MMMM yyyy")
text: TimezoneProvider.toTz(timeManager.now).toLocaleDateString(Qt.locale(), "d MMMM yyyy")
color: root.t.clockPopupHeader
font.pixelSize: 22
font.bold: true
@@ -219,8 +199,8 @@ ModuleChip {
id: cal
Layout.fillWidth: true
implicitHeight: gridCol.implicitHeight
property int displayYear: timezone.toTz(timeManager.now).getFullYear()
property int displayMonth: timezone.toTz(timeManager.now).getMonth()
property int displayYear: TimezoneProvider.toTz(timeManager.now).getFullYear()
property int displayMonth: TimezoneProvider.toTz(timeManager.now).getMonth()
property int pendingYear: displayYear
property int pendingMonth: displayMonth
property int slideDir: 1
@@ -229,7 +209,7 @@ ModuleChip {
target: calendarPopup
function onPopupOpenChanged() {
if (calendarPopup.popupOpen) {
let tzd = timezone.toTz(timeManager.now)
let tzd = TimezoneProvider.toTz(timeManager.now)
cal.displayYear = tzd.getFullYear()
cal.displayMonth = tzd.getMonth()
}
@@ -291,7 +271,7 @@ ModuleChip {
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: {
let tzd = timezone.toTz(timeManager.now)
let tzd = TimezoneProvider.toTz(timeManager.now)
return inMonth && dayNum === tzd.getDate()
&& cal.displayYear === tzd.getFullYear()
&& cal.displayMonth === tzd.getMonth()
@@ -300,6 +280,8 @@ ModuleChip {
Rectangle {
anchors.centerIn: parent; width: 22; height: 22; radius: 11
color: isToday ? root.t.accent : "transparent"
border.color: isToday ? root.t.borderToday : "transparent"
border.width: isToday ? 2 : 0
visible: inMonth
}
@@ -327,7 +309,7 @@ ModuleChip {
Layout.rightMargin: 6
Text {
text: "UTC " + (timezone.tzOffsetHours() >= 0 ? "+" : "") + timezone.tzOffsetHours()
text: "UTC " + (TimezoneProvider.tzOffsetHours() >= 0 ? "+" : "") + TimezoneProvider.tzOffsetHours()
color: root.t.clockPopupUtc
font.pixelSize: 13
font.bold: true
@@ -338,7 +320,7 @@ ModuleChip {
Text {
text: {
let d = timezone.toTz(timeManager.now)
let d = TimezoneProvider.toTz(timeManager.now)
let month = d.getMonth() + 1
let day = d.getDate()
let year = d.getFullYear()