refactor: migrate lock to new font API

This commit is contained in:
2 * r + 2 * t 2026-04-21 01:09:10 +10:00
parent a3e84b555e
commit a43fc61fad
8 changed files with 38 additions and 63 deletions

View file

@ -30,27 +30,21 @@ ColumnLayout {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
text: Time.hourStr text: Time.hourStr
color: Colours.palette.m3secondary color: Colours.palette.m3secondary
font.pointSize: Math.floor(Tokens.font.size.extraLarge * 3 * root.centerScale) font: Tokens.font.clock.size(Math.floor(28 * 3 * root.centerScale)).weight(Font.Bold).build()
font.family: Tokens.font.family.clock
font.bold: true
} }
StyledText { StyledText {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
text: ":" text: ":"
color: Colours.palette.m3primary color: Colours.palette.m3primary
font.pointSize: Math.floor(Tokens.font.size.extraLarge * 3 * root.centerScale) font: Tokens.font.clock.size(Math.floor(28 * 3 * root.centerScale)).weight(Font.Bold).build()
font.family: Tokens.font.family.clock
font.bold: true
} }
StyledText { StyledText {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
text: Time.minuteStr text: Time.minuteStr
color: Colours.palette.m3secondary color: Colours.palette.m3secondary
font.pointSize: Math.floor(Tokens.font.size.extraLarge * 3 * root.centerScale) font: Tokens.font.clock.size(Math.floor(28 * 3 * root.centerScale)).weight(Font.Bold).build()
font.family: Tokens.font.family.clock
font.bold: true
} }
Loader { Loader {
@ -64,9 +58,7 @@ ColumnLayout {
sourceComponent: StyledText { sourceComponent: StyledText {
text: Time.amPmStr text: Time.amPmStr
color: Colours.palette.m3primary color: Colours.palette.m3primary
font.pointSize: Math.floor(Tokens.font.size.extraLarge * 2 * root.centerScale) font: Tokens.font.clock.size(Math.floor(28 * 2 * root.centerScale)).weight(Font.Bold).build()
font.family: Tokens.font.family.clock
font.bold: true
} }
} }
} }
@ -77,9 +69,7 @@ ColumnLayout {
text: Time.format("dddd, d MMMM yyyy") text: Time.format("dddd, d MMMM yyyy")
color: Colours.palette.m3tertiary color: Colours.palette.m3tertiary
font.pointSize: Math.floor(Tokens.font.size.extraLarge * root.centerScale) font: Tokens.font.mono.builders.large.size(Math.floor(28 * root.centerScale)).weight(Font.Bold).build()
font.family: Tokens.font.family.mono
font.bold: true
} }
StyledClippingRect { StyledClippingRect {
@ -97,7 +87,7 @@ ColumnLayout {
text: "person" text: "person"
color: Colours.palette.m3onSurfaceVariant color: Colours.palette.m3onSurfaceVariant
font.pointSize: Math.floor(root.centerWidth / 4) font: Tokens.font.icon.builders.large.size(Math.floor(root.centerWidth / 4)).build()
visible: pfp.status !== Image.Ready visible: pfp.status !== Image.Ready
} }
@ -204,7 +194,7 @@ ColumnLayout {
anchors.centerIn: parent anchors.centerIn: parent
text: "arrow_forward" text: "arrow_forward"
color: root.lock.pam.buffer ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface color: root.lock.pam.buffer ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface
font.weight: 500 font: Tokens.font.icon.builders.large.weight(500).build()
} }
} }
} }
@ -269,7 +259,7 @@ ColumnLayout {
color: Colours.palette.m3onSurfaceVariant color: Colours.palette.m3onSurfaceVariant
animateProp: "opacity" animateProp: "opacity"
font.family: Tokens.font.family.mono font: Tokens.font.mono.small
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
wrapMode: Text.WrapAtWordBoundaryOrAnywhere wrapMode: Text.WrapAtWordBoundaryOrAnywhere
lineHeight: 1.2 lineHeight: 1.2
@ -324,8 +314,7 @@ ColumnLayout {
opacity: 0 opacity: 0
color: Colours.palette.m3error color: Colours.palette.m3error
font.pointSize: Tokens.font.size.small font: Tokens.font.mono.small
font.family: Tokens.font.family.mono
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
wrapMode: Text.WrapAtWordBoundaryOrAnywhere wrapMode: Text.WrapAtWordBoundaryOrAnywhere

View file

@ -35,7 +35,7 @@ ColumnLayout {
anchors.centerIn: parent anchors.centerIn: parent
text: ">" text: ">"
font.pointSize: root.width > 400 ? Tokens.font.size.larger : Tokens.font.size.normal font: root.width > 400 ? Tokens.font.mono.large : Tokens.font.mono.medium
color: Colours.palette.m3onPrimary color: Colours.palette.m3onPrimary
} }
} }
@ -43,7 +43,7 @@ ColumnLayout {
MonoText { MonoText {
Layout.fillWidth: true Layout.fillWidth: true
text: "caelestiafetch.sh" text: "caelestiafetch.sh"
font.pointSize: root.width > 400 ? Tokens.font.size.larger : Tokens.font.size.normal font: root.width > 400 ? Tokens.font.mono.large : Tokens.font.mono.medium
elide: Text.ElideRight elide: Text.ElideRight
} }
@ -128,13 +128,13 @@ ColumnLayout {
spacing: Tokens.spacing.largeIncreased spacing: Tokens.spacing.largeIncreased
Repeater { Repeater {
model: Math.max(0, Math.min(8, root.width / (Tokens.font.size.larger * 2 + Tokens.spacing.largeIncreased))) model: Math.max(0, Math.min(8, root.width / (Tokens.font.body.large.pointSize * 2 + Tokens.spacing.large)))
StyledRect { StyledRect {
required property int index required property int index
implicitWidth: implicitHeight implicitWidth: implicitHeight
implicitHeight: Tokens.font.size.larger * 2 implicitHeight: Tokens.font.body.large.pointSize * 2
color: Colours.palette[`term${index}`] color: Colours.palette[`term${index}`]
radius: Tokens.rounding.medium radius: Tokens.rounding.medium
} }
@ -168,11 +168,11 @@ ColumnLayout {
component FetchText: MonoText { component FetchText: MonoText {
Layout.fillWidth: true Layout.fillWidth: true
font.pointSize: root.width > 400 ? Tokens.font.size.larger : Tokens.font.size.normal font: root.width > 400 ? Tokens.font.mono.large : Tokens.font.mono.medium
elide: Text.ElideRight elide: Text.ElideRight
} }
component MonoText: StyledText { component MonoText: StyledText {
font.family: Tokens.font.family.mono font: Tokens.font.mono.small
} }
} }

View file

@ -49,8 +49,7 @@ Item {
animate: true animate: true
color: root.pam.passwd.active ? Colours.palette.m3secondary : Colours.palette.m3outline color: root.pam.passwd.active ? Colours.palette.m3secondary : Colours.palette.m3outline
font.pointSize: Tokens.font.size.normal font: Tokens.font.mono.medium
font.family: Tokens.font.family.mono
opacity: root.buffer ? 0 : 1 opacity: root.buffer ? 0 : 1
@ -74,7 +73,7 @@ Item {
anchors.horizontalCenterOffset: implicitWidth > root.width ? -(implicitWidth - root.width) / 2 : 0 anchors.horizontalCenterOffset: implicitWidth > root.width ? -(implicitWidth - root.width) / 2 : 0
implicitWidth: fullWidth implicitWidth: fullWidth
implicitHeight: Tokens.font.size.normal implicitHeight: Tokens.font.body.medium.pointSize
orientation: Qt.Horizontal orientation: Qt.Horizontal
spacing: Tokens.spacing.extraSmall spacing: Tokens.spacing.extraSmall

View file

@ -207,8 +207,7 @@ WlSessionLockSurface {
anchors.centerIn: parent anchors.centerIn: parent
text: "lock" text: "lock"
font.pointSize: Tokens.font.size.extraLarge * 4 font: Tokens.font.icon.builders.extraLarge.size(Tokens.font.icon.extraLarge.pointSize * 4).weight(Font.Bold).build()
font.bold: true
rotation: 180 rotation: 180
} }

View file

@ -76,8 +76,7 @@ Item {
Layout.bottomMargin: Tokens.spacing.large Layout.bottomMargin: Tokens.spacing.large
text: qsTr("Now playing") text: qsTr("Now playing")
color: Colours.palette.m3onSurfaceVariant color: Colours.palette.m3onSurfaceVariant
font.family: Tokens.font.family.mono font: Tokens.font.mono.builders.small.weight(500).build()
font.weight: 500
} }
StyledText { StyledText {
@ -86,9 +85,7 @@ Item {
text: Players.active?.trackArtist ?? qsTr("No media") text: Players.active?.trackArtist ?? qsTr("No media")
color: Colours.palette.m3primary color: Colours.palette.m3primary
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
font.pointSize: Tokens.font.size.large font: Tokens.font.mono.builders.large.weight(600).build()
font.family: Tokens.font.family.mono
font.weight: 600
elide: Text.ElideRight elide: Text.ElideRight
} }
@ -97,8 +94,7 @@ Item {
animate: true animate: true
text: Players.active?.trackTitle ?? qsTr("No media") text: Players.active?.trackTitle ?? qsTr("No media")
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
font.pointSize: Tokens.font.size.larger font: Tokens.font.mono.large
font.family: Tokens.font.family.mono
elide: Text.ElideRight elide: Text.ElideRight
} }
@ -176,7 +172,7 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
color: control.active ? Colours.palette[`m3on${control.colour}`] : Colours.palette[`m3on${control.colour}Container`] color: control.active ? Colours.palette[`m3on${control.colour}`] : Colours.palette[`m3on${control.colour}Container`]
font.pointSize: Tokens.font.size.large font: Tokens.font.icon.large
fill: control.active ? 1 : 0 fill: control.active ? 1 : 0
Behavior on fill { Behavior on fill {

View file

@ -25,8 +25,7 @@ ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
text: Notifs.list.length > 0 ? qsTr("%1 notification%2").arg(Notifs.list.length).arg(Notifs.list.length === 1 ? "" : "s") : qsTr("Notifications") text: Notifs.list.length > 0 ? qsTr("%1 notification%2").arg(Notifs.list.length).arg(Notifs.list.length === 1 ? "" : "s") : qsTr("Notifications")
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.family: Tokens.font.family.mono font: Tokens.font.mono.builders.small.weight(500).build()
font.weight: 500
elide: Text.ElideRight elide: Text.ElideRight
} }
@ -65,9 +64,7 @@ ColumnLayout {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: Config.lock.hideNotifs ? qsTr("Unlock for Notifications") : qsTr("No Notifications") text: Config.lock.hideNotifs ? qsTr("Unlock for Notifications") : qsTr("No Notifications")
color: Colours.palette.m3outlineVariant color: Colours.palette.m3outlineVariant
font.pointSize: Tokens.font.size.large font: Tokens.font.mono.builders.large.weight(500).build()
font.family: Tokens.font.family.mono
font.weight: 500
} }
} }

View file

@ -99,7 +99,7 @@ StyledRect {
MaterialIcon { MaterialIcon {
text: Icons.getNotifIcon(root.notifs[0]?.summary, root.urgency) text: Icons.getNotifIcon(root.notifs[0]?.summary, root.urgency)
color: root.urgency === "critical" ? Colours.palette.m3onError : root.urgency === "low" ? Colours.palette.m3onSurface : Colours.palette.m3onSecondaryContainer color: root.urgency === "critical" ? Colours.palette.m3onError : root.urgency === "low" ? Colours.palette.m3onSurface : Colours.palette.m3onSecondaryContainer
font.pointSize: Tokens.font.size.large font: Tokens.font.icon.large
} }
} }
@ -154,7 +154,7 @@ StyledRect {
Layout.fillWidth: true Layout.fillWidth: true
text: root.modelData text: root.modelData
color: Colours.palette.m3onSurfaceVariant color: Colours.palette.m3onSurfaceVariant
font.pointSize: Tokens.font.size.small font: Tokens.font.body.small
elide: Text.ElideRight elide: Text.ElideRight
} }
@ -162,7 +162,7 @@ StyledRect {
animate: true animate: true
text: root.notifs[0]?.timeStr ?? "" text: root.notifs[0]?.timeStr ?? ""
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Tokens.font.size.small font: Tokens.font.body.small
} }
StyledRect { StyledRect {
@ -193,7 +193,7 @@ StyledRect {
animate: true animate: true
text: root.notifs.length text: root.notifs.length
color: root.urgency === "critical" ? Colours.palette.m3onError : Colours.palette.m3onSurface color: root.urgency === "critical" ? Colours.palette.m3onError : Colours.palette.m3onSurface
font.pointSize: Tokens.font.size.small font: Tokens.font.body.small
} }
MaterialIcon { MaterialIcon {
@ -329,8 +329,7 @@ StyledRect {
id: metrics id: metrics
text: `${notifLine.modelData.summary} ${notifLine.modelData.body}`.replace(/\n/g, " ") text: `${notifLine.modelData.summary} ${notifLine.modelData.body}`.replace(/\n/g, " ")
font.pointSize: notifLine.font.pointSize font: notifLine.font
font.family: notifLine.font.family
elideWidth: notifLine.width elideWidth: notifLine.width
elide: Text.ElideRight elide: Text.ElideRight
} }

View file

@ -29,8 +29,7 @@ ColumnLayout {
sourceComponent: StyledText { sourceComponent: StyledText {
text: qsTr("Weather") text: qsTr("Weather")
color: Colours.palette.m3primary color: Colours.palette.m3primary
font.pointSize: Tokens.font.size.extraLarge font: Tokens.font.body.builders.large.size(28).weight(500).build()
font.weight: 500
} }
} }
@ -42,7 +41,7 @@ ColumnLayout {
animate: true animate: true
text: Weather.icon text: Weather.icon
color: Colours.palette.m3secondary color: Colours.palette.m3secondary
font.pointSize: Tokens.font.size.extraLarge * 2.5 font: Tokens.font.icon.builders.extraLarge.size(Tokens.font.icon.extraLarge.pointSize * 2.5).build()
} }
ColumnLayout { ColumnLayout {
@ -54,8 +53,7 @@ ColumnLayout {
animate: true animate: true
text: Weather.description text: Weather.description
color: Colours.palette.m3secondary color: Colours.palette.m3secondary
font.pointSize: Tokens.font.size.large font: Tokens.font.body.builders.large.weight(500).build()
font.weight: 500
elide: Text.ElideRight elide: Text.ElideRight
} }
@ -65,7 +63,7 @@ ColumnLayout {
animate: true animate: true
text: qsTr("Humidity: %1%").arg(Weather.humidity) text: qsTr("Humidity: %1%").arg(Weather.humidity)
color: Colours.palette.m3onSurfaceVariant color: Colours.palette.m3onSurfaceVariant
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.medium
elide: Text.ElideRight elide: Text.ElideRight
} }
} }
@ -86,8 +84,7 @@ ColumnLayout {
text: Weather.temp text: Weather.temp
color: Colours.palette.m3primary color: Colours.palette.m3primary
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
font.pointSize: Tokens.font.size.extraLarge font: Tokens.font.body.builders.large.size(28).weight(500).build()
font.weight: 500
elide: Text.ElideLeft elide: Text.ElideLeft
} }
@ -98,7 +95,7 @@ ColumnLayout {
text: qsTr("Feels like: %1").arg(Weather.feelsLike) text: qsTr("Feels like: %1").arg(Weather.feelsLike)
color: Colours.palette.m3outline color: Colours.palette.m3outline
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
font.pointSize: Tokens.font.size.smaller font: Tokens.font.body.small
elide: Text.ElideLeft elide: Text.ElideLeft
} }
} }
@ -147,21 +144,20 @@ ColumnLayout {
} }
color: Colours.palette.m3outline color: Colours.palette.m3outline
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
font.pointSize: Tokens.font.size.larger font: Tokens.font.body.large
} }
MaterialIcon { MaterialIcon {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: forecastHour.modelData?.icon ?? "cloud_alert" text: forecastHour.modelData?.icon ?? "cloud_alert"
font.pointSize: Tokens.font.size.extraLarge * 1.5 font: Tokens.font.icon.builders.extraLarge.size(Tokens.font.icon.extraLarge.pointSize * 1.5).weight(500).build()
font.weight: 500
} }
StyledText { StyledText {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: GlobalConfig.services.useFahrenheit ? `${forecastHour.modelData?.tempF ?? 0}°F` : `${forecastHour.modelData?.tempC ?? 0}°C` text: GlobalConfig.services.useFahrenheit ? `${forecastHour.modelData?.tempF ?? 0}°F` : `${forecastHour.modelData?.tempC ?? 0}°C`
color: Colours.palette.m3secondary color: Colours.palette.m3secondary
font.pointSize: Tokens.font.size.larger font: Tokens.font.body.large
} }
} }
} }