refactor: migrate more controlcenter stuff to new font API

This commit is contained in:
2 * r + 2 * t 2026-04-21 01:05:54 +10:00
parent c21c5fe552
commit c869eee460
12 changed files with 46 additions and 63 deletions

View file

@ -111,8 +111,7 @@ Item {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.bottomMargin: Tokens.spacing.medium Layout.bottomMargin: Tokens.spacing.medium
text: qsTr("Wallpaper") text: qsTr("Wallpaper")
font.pointSize: Tokens.font.size.extraLarge font: Tokens.font.body.builders.large.size(28).weight(600).build()
font.weight: 600
} }
Loader { Loader {
@ -177,8 +176,7 @@ Item {
StyledText { StyledText {
text: qsTr("Appearance") text: qsTr("Appearance")
font.pointSize: Tokens.font.size.large font: Tokens.font.body.builders.large.weight(500).build()
font.weight: 500
} }
Item { Item {

View file

@ -39,8 +39,7 @@ CollapsibleSection {
StyledText { StyledText {
Layout.topMargin: Tokens.spacing.medium Layout.topMargin: Tokens.spacing.medium
text: qsTr("Desktop Clock") text: qsTr("Desktop Clock")
font.pointSize: Tokens.font.size.larger font: Tokens.font.body.builders.large.weight(500).build()
font.weight: 500
} }
SwitchRow { SwitchRow {
@ -69,8 +68,7 @@ CollapsibleSection {
StyledText { StyledText {
text: qsTr("Positioning") text: qsTr("Positioning")
font.pointSize: Tokens.font.size.larger font: Tokens.font.body.builders.large.weight(500).build()
font.weight: 500
} }
SplitButtonRow { SplitButtonRow {
@ -160,8 +158,7 @@ CollapsibleSection {
StyledText { StyledText {
text: qsTr("Shadow") text: qsTr("Shadow")
font.pointSize: Tokens.font.size.larger font: Tokens.font.body.builders.large.weight(500).build()
font.weight: 500
} }
SwitchRow { SwitchRow {
@ -229,8 +226,7 @@ CollapsibleSection {
StyledText { StyledText {
text: qsTr("Background") text: qsTr("Background")
font.pointSize: Tokens.font.size.larger font: Tokens.font.body.builders.large.weight(500).build()
font.weight: 500
} }
SwitchRow { SwitchRow {
@ -280,8 +276,7 @@ CollapsibleSection {
StyledText { StyledText {
Layout.topMargin: Tokens.spacing.medium Layout.topMargin: Tokens.spacing.medium
text: qsTr("Visualiser") text: qsTr("Visualiser")
font.pointSize: Tokens.font.size.larger font: Tokens.font.body.builders.large.weight(500).build()
font.weight: 500
} }
SwitchRow { SwitchRow {

View file

@ -87,7 +87,7 @@ CollapsibleSection {
visible: false visible: false
text: "circle" text: "circle"
font.pointSize: Tokens.font.size.large font: Tokens.font.icon.large
} }
Item { Item {
@ -116,12 +116,12 @@ CollapsibleSection {
StyledText { StyledText {
text: modelData.flavour ?? "" text: modelData.flavour ?? ""
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.medium
} }
StyledText { StyledText {
text: modelData.name ?? "" text: modelData.name ?? ""
font.pointSize: Tokens.font.size.small font: Tokens.font.body.small
color: Colours.palette.m3outline color: Colours.palette.m3outline
elide: Text.ElideRight elide: Text.ElideRight
@ -137,7 +137,7 @@ CollapsibleSection {
sourceComponent: MaterialIcon { sourceComponent: MaterialIcon {
text: "check" text: "check"
color: Colours.palette.m3onSurfaceVariant color: Colours.palette.m3onSurfaceVariant
font.pointSize: Tokens.font.size.large font: Tokens.font.icon.large
} }
} }
} }

View file

@ -68,21 +68,21 @@ CollapsibleSection {
MaterialIcon { MaterialIcon {
text: modelData.icon text: modelData.icon
font.pointSize: Tokens.font.size.large font: Tokens.font.icon.large
fill: modelData.variant === Schemes.currentVariant ? 1 : 0 fill: modelData.variant === Schemes.currentVariant ? 1 : 0
} }
StyledText { StyledText {
Layout.fillWidth: true Layout.fillWidth: true
text: modelData.name text: modelData.name
font.weight: modelData.variant === Schemes.currentVariant ? 500 : 400 font: modelData.variant === Schemes.currentVariant ? Tokens.font.body.builders.small.weight(500).build() : Tokens.font.body.builders.small.weight(400).build()
} }
MaterialIcon { MaterialIcon {
visible: modelData.variant === Schemes.currentVariant visible: modelData.variant === Schemes.currentVariant
text: "check" text: "check"
color: Colours.palette.m3primary color: Colours.palette.m3primary
font.pointSize: Tokens.font.size.large font: Tokens.font.icon.large
} }
} }
} }

View file

@ -76,7 +76,7 @@ CollapsibleSection {
StyledText { StyledText {
text: modelData text: modelData
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.medium
} }
Item { Item {
@ -90,7 +90,7 @@ CollapsibleSection {
sourceComponent: MaterialIcon { sourceComponent: MaterialIcon {
text: "check" text: "check"
color: Colours.palette.m3onSurfaceVariant color: Colours.palette.m3onSurfaceVariant
font.pointSize: Tokens.font.size.large font: Tokens.font.icon.large
} }
} }
} }
@ -157,7 +157,7 @@ CollapsibleSection {
StyledText { StyledText {
text: modelData text: modelData
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.medium
} }
Item { Item {
@ -171,7 +171,7 @@ CollapsibleSection {
sourceComponent: MaterialIcon { sourceComponent: MaterialIcon {
text: "check" text: "check"
color: Colours.palette.m3onSurfaceVariant color: Colours.palette.m3onSurfaceVariant
font.pointSize: Tokens.font.size.large font: Tokens.font.icon.large
} }
} }
} }
@ -240,7 +240,7 @@ CollapsibleSection {
StyledText { StyledText {
text: modelData text: modelData
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.medium
} }
Item { Item {
@ -254,7 +254,7 @@ CollapsibleSection {
sourceComponent: MaterialIcon { sourceComponent: MaterialIcon {
text: "check" text: "check"
color: Colours.palette.m3onSurfaceVariant color: Colours.palette.m3onSurfaceVariant
font.pointSize: Tokens.font.size.large font: Tokens.font.icon.large
} }
} }
} }

View file

@ -46,8 +46,7 @@ Item {
StyledText { StyledText {
text: qsTr("Audio") text: qsTr("Audio")
font.pointSize: Tokens.font.size.large font: Tokens.font.body.builders.large.weight(500).build()
font.weight: 500
} }
Item { Item {
@ -72,8 +71,7 @@ Item {
StyledText { StyledText {
text: qsTr("Devices (%1)").arg(Audio.sinks.length) text: qsTr("Devices (%1)").arg(Audio.sinks.length)
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.builders.medium.weight(500).build()
font.weight: 500
} }
} }
@ -114,7 +112,7 @@ Item {
MaterialIcon { MaterialIcon {
text: Audio.sink?.id === modelData.id ? "speaker" : "speaker_group" text: Audio.sink?.id === modelData.id ? "speaker" : "speaker_group"
font.pointSize: Tokens.font.size.large font: Tokens.font.icon.large
fill: Audio.sink?.id === modelData.id ? 1 : 0 fill: Audio.sink?.id === modelData.id ? 1 : 0
} }
@ -124,7 +122,7 @@ Item {
maximumLineCount: 1 maximumLineCount: 1
text: modelData.description || qsTr("Unknown") text: modelData.description || qsTr("Unknown")
font.weight: Audio.sink?.id === modelData.id ? 500 : 400 font: Audio.sink?.id === modelData.id ? Tokens.font.body.builders.small.weight(500).build() : Tokens.font.body.builders.small.weight(400).build()
} }
} }
} }
@ -149,8 +147,7 @@ Item {
StyledText { StyledText {
text: qsTr("Devices (%1)").arg(Audio.sources.length) text: qsTr("Devices (%1)").arg(Audio.sources.length)
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.builders.medium.weight(500).build()
font.weight: 500
} }
} }
@ -191,7 +188,7 @@ Item {
MaterialIcon { MaterialIcon {
text: "mic" text: "mic"
font.pointSize: Tokens.font.size.large font: Tokens.font.icon.large
fill: Audio.source?.id === modelData.id ? 1 : 0 fill: Audio.source?.id === modelData.id ? 1 : 0
} }
@ -201,7 +198,7 @@ Item {
maximumLineCount: 1 maximumLineCount: 1
text: modelData.description || qsTr("Unknown") text: modelData.description || qsTr("Unknown")
font.weight: Audio.source?.id === modelData.id ? 500 : 400 font: Audio.source?.id === modelData.id ? Tokens.font.body.builders.small.weight(500).build() : Tokens.font.body.builders.small.weight(400).build()
} }
} }
} }
@ -254,8 +251,7 @@ Item {
StyledText { StyledText {
text: qsTr("Volume") text: qsTr("Volume")
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.builders.medium.weight(500).build()
font.weight: 500
} }
Item { Item {
@ -306,7 +302,7 @@ Item {
StyledText { StyledText {
text: "%" text: "%"
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.medium
opacity: Audio.muted ? 0.5 : 1 opacity: Audio.muted ? 0.5 : 1
} }
@ -372,8 +368,7 @@ Item {
StyledText { StyledText {
text: qsTr("Volume") text: qsTr("Volume")
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.builders.medium.weight(500).build()
font.weight: 500
} }
Item { Item {
@ -424,7 +419,7 @@ Item {
StyledText { StyledText {
text: "%" text: "%"
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.medium
opacity: Audio.sourceMuted ? 0.5 : 1 opacity: Audio.sourceMuted ? 0.5 : 1
} }
@ -501,7 +496,7 @@ Item {
MaterialIcon { MaterialIcon {
text: "apps" text: "apps"
font.pointSize: Tokens.font.size.normal font: Tokens.font.icon.medium
fill: 0 fill: 0
} }
@ -510,8 +505,7 @@ Item {
elide: Text.ElideRight elide: Text.ElideRight
maximumLineCount: 1 maximumLineCount: 1
text: Audio.getStreamName(modelData) text: Audio.getStreamName(modelData)
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.builders.medium.weight(500).build()
font.weight: 500
} }
StyledInputField { StyledInputField {
@ -558,7 +552,7 @@ Item {
StyledText { StyledText {
text: "%" text: "%"
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.medium
opacity: Audio.getStreamMuted(modelData) ? 0.5 : 1 opacity: Audio.getStreamMuted(modelData) ? 0.5 : 1
} }
@ -617,7 +611,7 @@ Item {
visible: Audio.streams.length === 0 visible: Audio.streams.length === 0
text: qsTr("No applications currently playing audio") text: qsTr("No applications currently playing audio")
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Tokens.font.size.small font: Tokens.font.body.small
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
} }

View file

@ -35,7 +35,7 @@ StyledRect {
StyledText { StyledText {
visible: root.title !== "" visible: root.title !== ""
text: root.title text: root.title
font.pointSize: Tokens.font.size.normal font: Tokens.font.title.small
} }
GridLayout { GridLayout {

View file

@ -47,8 +47,7 @@ ColumnLayout {
StyledText { StyledText {
visible: root.title !== "" visible: root.title !== ""
text: root.title text: root.title
font.pointSize: Tokens.font.size.large font: Tokens.font.title.builders.medium.weight(500).build()
font.weight: 500
} }
Loader { Loader {

View file

@ -26,7 +26,7 @@ ColumnLayout {
StyledText { StyledText {
visible: root.label !== "" visible: root.label !== ""
text: root.label text: root.label
font.pointSize: Tokens.font.size.normal font: Tokens.font.label.medium
color: root.readonly ? Colours.palette.m3outline : Colours.palette.m3onSurface color: root.readonly ? Colours.palette.m3outline : Colours.palette.m3onSurface
} }
@ -38,12 +38,12 @@ ColumnLayout {
visible: root.readonly visible: root.readonly
text: "lock" text: "lock"
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Tokens.font.size.small font: Tokens.font.icon.small
} }
StyledText { StyledText {
text: Math.round(root.value) + (root.suffix !== "" ? " " + root.suffix : "") text: Math.round(root.value) + (root.suffix !== "" ? " " + root.suffix : "")
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.medium
color: root.readonly ? Colours.palette.m3outline : Colours.palette.m3onSurface color: root.readonly ? Colours.palette.m3outline : Colours.palette.m3onSurface
} }
} }

View file

@ -23,15 +23,13 @@ Item {
MaterialIcon { MaterialIcon {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: root.icon text: root.icon
font.pointSize: Tokens.font.size.extraLarge * 3 font: Tokens.font.icon.builders.xl.size(84).weight(Font.Bold).build()
font.bold: true
} }
StyledText { StyledText {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: root.title text: root.title
font.pointSize: Tokens.font.size.large font: Tokens.font.title.builders.medium.weight(Font.Bold).build()
font.bold: true
} }
} }
} }

View file

@ -76,7 +76,7 @@ ColumnLayout {
StyledText { StyledText {
visible: root.label !== "" visible: root.label !== ""
text: root.label text: root.label
font.pointSize: Tokens.font.size.normal font: Tokens.font.label.medium
} }
Item { Item {
@ -138,7 +138,7 @@ ColumnLayout {
visible: root.suffix !== "" visible: root.suffix !== ""
text: root.suffix text: root.suffix
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Tokens.font.size.normal font: Tokens.font.body.medium
} }
} }

View file

@ -195,7 +195,7 @@ GridView {
visible: isCurrent visible: isCurrent
text: "check_circle" text: "check_circle"
color: Colours.palette.m3primary color: Colours.palette.m3primary
font.pointSize: Tokens.font.size.large font: Tokens.font.icon.large
} }
} }
@ -210,8 +210,7 @@ GridView {
anchors.bottomMargin: Tokens.padding.medium anchors.bottomMargin: Tokens.padding.medium
text: modelData.name text: modelData.name
font.pointSize: Tokens.font.size.smaller font: Tokens.font.body.builders.small.weight(500).build()
font.weight: 500
color: isCurrent ? Colours.palette.m3primary : Colours.palette.m3onSurface color: isCurrent ? Colours.palette.m3primary : Colours.palette.m3onSurface
elide: Text.ElideMiddle elide: Text.ElideMiddle
maximumLineCount: 1 maximumLineCount: 1