refactor: migrate dashboard dash to new font API

This commit is contained in:
2 * r + 2 * t 2026-04-21 01:16:35 +10:00
parent ee60493bec
commit 71bbebb242
5 changed files with 21 additions and 34 deletions

View file

@ -61,8 +61,7 @@ CustomMouseArea {
anchors.centerIn: parent anchors.centerIn: parent
text: "chevron_left" text: "chevron_left"
color: Colours.palette.m3tertiary color: Colours.palette.m3tertiary
font.pointSize: Tokens.font.size.normal font: Tokens.font.icon.builders.medium.weight(700).build()
font.weight: 700
} }
} }
@ -95,9 +94,7 @@ CustomMouseArea {
anchors.centerIn: parent anchors.centerIn: parent
text: grid.title text: grid.title
color: Colours.palette.m3primary color: Colours.palette.m3primary
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.builders.medium.weight(500).capitalisation(Font.Capitalize).build()
font.weight: 500
font.capitalization: Font.Capitalize
} }
} }
@ -121,8 +118,7 @@ CustomMouseArea {
anchors.centerIn: parent anchors.centerIn: parent
text: "chevron_right" text: "chevron_right"
color: Colours.palette.m3tertiary color: Colours.palette.m3tertiary
font.pointSize: Tokens.font.size.normal font: Tokens.font.icon.builders.medium.weight(700).build()
font.weight: 700
} }
} }
} }
@ -138,7 +134,7 @@ CustomMouseArea {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: model.shortName text: model.shortName
font.weight: 500 font: Tokens.font.body.builders.medium.weight(500).build()
color: (model.day === 0 || model.day === 6) ? Colours.palette.m3secondary : Colours.palette.m3onSurfaceVariant color: (model.day === 0 || model.day === 6) ? Colours.palette.m3secondary : Colours.palette.m3onSurfaceVariant
} }
} }
@ -181,8 +177,7 @@ CustomMouseArea {
return Colours.palette.m3onSurfaceVariant; return Colours.palette.m3onSurfaceVariant;
} }
opacity: dayItem.model.today || dayItem.model.month === grid.month ? 1 : 0.4 opacity: dayItem.model.today || dayItem.model.month === grid.month ? 1 : 0.4
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.builders.medium.weight(500).build()
font.weight: 500
} }
} }
} }

View file

@ -24,17 +24,14 @@ Item {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: Time.hourStr text: Time.hourStr
color: Colours.palette.m3secondary color: Colours.palette.m3secondary
font.pointSize: Tokens.font.size.extraLarge font: Tokens.font.clock.builders.size(28).weight(600).build()
font.family: Tokens.font.family.clock
font.weight: 600
} }
StyledText { StyledText {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: "•••" text: "•••"
color: Colours.palette.m3primary color: Colours.palette.m3primary
font.pointSize: Tokens.font.size.extraLarge * 0.9 font: Tokens.font.clock.builders.size(28 * 0.9).build()
font.family: Tokens.font.family.clock
} }
StyledText { StyledText {
@ -42,9 +39,7 @@ Item {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: Time.minuteStr text: Time.minuteStr
color: Colours.palette.m3secondary color: Colours.palette.m3secondary
font.pointSize: Tokens.font.size.extraLarge font: Tokens.font.clock.builders.size(28).weight(600).build()
font.family: Tokens.font.family.clock
font.weight: 600
} }
Loader { Loader {
@ -57,9 +52,7 @@ Item {
sourceComponent: StyledText { sourceComponent: StyledText {
text: Time.amPmStr text: Time.amPmStr
color: Colours.palette.m3primary color: Colours.palette.m3primary
font.pointSize: Tokens.font.size.large font: Tokens.font.clock.builders.size(18).weight(600).build()
font.family: Tokens.font.family.clock
font.weight: 600
} }
} }
} }

View file

@ -98,7 +98,7 @@ Item {
grade: 200 grade: 200
text: "art_track" text: "art_track"
color: Colours.palette.m3onSurfaceVariant color: Colours.palette.m3onSurfaceVariant
font.pointSize: (parent.width * 0.4) || 1 font: Tokens.font.icon.builders.medium.size((parent.width * 0.4) || 1).build()
} }
Image { Image {
@ -125,7 +125,7 @@ Item {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: (Players.active?.trackTitle ?? qsTr("No media")) || qsTr("Unknown title") text: (Players.active?.trackTitle ?? qsTr("No media")) || qsTr("Unknown title")
color: Colours.palette.m3primary color: Colours.palette.m3primary
font.pointSize: Tokens.font.size.normal font: Tokens.font.title.small
width: parent.implicitWidth - Tokens.padding.extraLargeIncreased width: parent.implicitWidth - Tokens.padding.extraLargeIncreased
elide: Text.ElideRight elide: Text.ElideRight
@ -142,7 +142,7 @@ Item {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: (Players.active?.trackAlbum ?? qsTr("No media")) || qsTr("Unknown album") text: (Players.active?.trackAlbum ?? qsTr("No media")) || qsTr("Unknown album")
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Tokens.font.size.small font: Tokens.font.body.small
width: parent.implicitWidth - Tokens.padding.extraLargeIncreased width: parent.implicitWidth - Tokens.padding.extraLargeIncreased
elide: Text.ElideRight elide: Text.ElideRight
@ -236,7 +236,7 @@ Item {
animate: true animate: true
text: control.icon text: control.icon
color: control.canUse ? Colours.palette.m3onSurface : Colours.palette.m3outline color: control.canUse ? Colours.palette.m3onSurface : Colours.palette.m3outline
font.pointSize: Tokens.font.size.large font: Tokens.font.icon.large
} }
} }
} }

View file

@ -21,7 +21,7 @@ Item {
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 font: Tokens.font.icon.builders.xl.size(Tokens.font.icon.xl.pointSize * 2).build()
} }
Column { Column {
@ -39,8 +39,7 @@ Item {
animate: true animate: true
text: Weather.temp text: Weather.temp
color: Colours.palette.m3primary color: Colours.palette.m3primary
font.pointSize: Tokens.font.size.extraLarge font: Tokens.font.body.builders.size(28).weight(500).build()
font.weight: 500
} }
StyledText { StyledText {

View file

@ -29,7 +29,7 @@ Row {
text: "person" text: "person"
fill: 1 fill: 1
grade: 200 grade: 200
font.pointSize: Math.floor(info.implicitHeight / 2) || 1 font: Tokens.font.icon.builders.medium.size(Math.floor(info.implicitHeight / 2) || 1).build()
visible: pfp.status !== Image.Ready visible: pfp.status !== Image.Ready
} }
@ -84,7 +84,7 @@ Row {
text: "frame_person" text: "frame_person"
color: Colours.palette.m3onPrimary color: Colours.palette.m3onPrimary
font.pointSize: Tokens.font.size.extraLarge font: Tokens.font.icon.xl
} }
Behavior on scale { Behavior on scale {
@ -121,7 +121,7 @@ Row {
anchors.leftMargin: (Tokens.sizes.dashboard.infoIconSize - implicitWidth) / 2 anchors.leftMargin: (Tokens.sizes.dashboard.infoIconSize - implicitWidth) / 2
source: SysInfo.osLogo source: SysInfo.osLogo
implicitSize: Math.floor(Tokens.font.size.normal * 1.34) implicitSize: Math.floor(Tokens.font.body.medium.pointSize * 1.34)
colour: Colours.palette.m3primary colour: Colours.palette.m3primary
} }
@ -132,7 +132,7 @@ Row {
anchors.left: icon.right anchors.left: icon.right
anchors.leftMargin: icon.anchors.leftMargin anchors.leftMargin: icon.anchors.leftMargin
text: `: ${SysInfo.osPrettyName || SysInfo.osName}` text: `: ${SysInfo.osPrettyName || SysInfo.osName}`
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.medium
width: Tokens.sizes.dashboard.infoWidth width: Tokens.sizes.dashboard.infoWidth
elide: Text.ElideRight elide: Text.ElideRight
@ -173,7 +173,7 @@ Row {
fill: 1 fill: 1
text: line.icon text: line.icon
color: line.colour color: line.colour
font.pointSize: Tokens.font.size.normal font: Tokens.font.icon.medium
} }
StyledText { StyledText {
@ -183,7 +183,7 @@ Row {
anchors.left: icon.right anchors.left: icon.right
anchors.leftMargin: icon.anchors.leftMargin anchors.leftMargin: icon.anchors.leftMargin
text: `: ${line.text}` text: `: ${line.text}`
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.medium
width: Tokens.sizes.dashboard.infoWidth width: Tokens.sizes.dashboard.infoWidth
elide: Text.ElideRight elide: Text.ElideRight