refactor: migrate controlcenter bluetooth to new font API

This commit is contained in:
2 * r + 2 * t 2026-04-21 01:08:56 +10:00
parent d04963160b
commit c21c5fe552
3 changed files with 36 additions and 43 deletions

View file

@ -59,8 +59,7 @@ StyledFlickable {
StyledText { StyledText {
Layout.topMargin: Tokens.spacing.largeIncreased Layout.topMargin: Tokens.spacing.largeIncreased
text: qsTr("Connection status") text: qsTr("Connection status")
font.pointSize: Tokens.font.size.larger font: Tokens.font.body.builders.large.weight(500).build()
font.weight: 500
} }
StyledText { StyledText {
@ -118,8 +117,7 @@ StyledFlickable {
StyledText { StyledText {
Layout.topMargin: Tokens.spacing.largeIncreased Layout.topMargin: Tokens.spacing.largeIncreased
text: qsTr("Device properties") text: qsTr("Device properties")
font.pointSize: Tokens.font.size.larger font: Tokens.font.body.builders.large.weight(500).build()
font.weight: 500
} }
StyledText { StyledText {
@ -187,7 +185,7 @@ StyledFlickable {
text: qsTr("Device name") text: qsTr("Device name")
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Tokens.font.size.small font: Tokens.font.label.small
} }
StyledTextField { StyledTextField {
@ -324,8 +322,7 @@ StyledFlickable {
StyledText { StyledText {
Layout.topMargin: Tokens.spacing.largeIncreased Layout.topMargin: Tokens.spacing.largeIncreased
text: qsTr("Device information") text: qsTr("Device information")
font.pointSize: Tokens.font.size.larger font: Tokens.font.body.builders.large.weight(500).build()
font.weight: 500
} }
StyledText { StyledText {
@ -389,7 +386,7 @@ StyledFlickable {
StyledText { StyledText {
text: root.device?.dbusPath ?? "" text: root.device?.dbusPath ?? ""
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Tokens.font.size.small font: Tokens.font.body.small
} }
StyledText { StyledText {
@ -400,7 +397,7 @@ StyledFlickable {
StyledText { StyledText {
text: root.device?.address ?? "" text: root.device?.address ?? ""
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Tokens.font.size.small font: Tokens.font.body.small
} }
StyledText { StyledText {
@ -411,7 +408,7 @@ StyledFlickable {
StyledText { StyledText {
text: root.device?.bonded ? qsTr("Yes") : qsTr("No") text: root.device?.bonded ? qsTr("Yes") : qsTr("No")
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Tokens.font.size.small font: Tokens.font.body.small
} }
StyledText { StyledText {
@ -422,7 +419,7 @@ StyledFlickable {
StyledText { StyledText {
text: root.device?.deviceName ?? "" text: root.device?.deviceName ?? ""
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Tokens.font.size.small font: Tokens.font.body.small
} }
} }
} }
@ -557,7 +554,7 @@ StyledFlickable {
animate: true animate: true
text: (root.device && root.device[`${fabMenuItem.modelData.name}ed`] ? fabMenuItem.modelData.name === "connect" ? "dis" : "un" : "") + fabMenuItem.modelData.name text: (root.device && root.device[`${fabMenuItem.modelData.name}ed`] ? fabMenuItem.modelData.name === "connect" ? "dis" : "un" : "") + fabMenuItem.modelData.name
color: Colours.palette.m3onPrimaryContainer color: Colours.palette.m3onPrimaryContainer
font.capitalization: Font.Capitalize font: Tokens.font.body.builders.small.capitalisation(Font.Capitalize).build()
Layout.preferredWidth: implicitWidth Layout.preferredWidth: implicitWidth
Behavior on Layout.preferredWidth { Behavior on Layout.preferredWidth {
@ -600,7 +597,7 @@ StyledFlickable {
fabBg.implicitWidth: 48 fabBg.implicitWidth: 48
fabBg.implicitHeight: 48 fabBg.implicitHeight: 48
fabBg.radius: 48 / 2 fabBg.radius: 48 / 2
fab.font.pointSize: Tokens.font.size.larger fab.font: Tokens.font.icon.large
} }
} }
@ -638,7 +635,7 @@ StyledFlickable {
animate: true animate: true
text: root.session.bt.fabMenuOpen ? "close" : "settings" text: root.session.bt.fabMenuOpen ? "close" : "settings"
color: root.session.bt.fabMenuOpen ? Colours.palette.m3onPrimary : Colours.palette.m3onPrimaryContainer color: root.session.bt.fabMenuOpen ? Colours.palette.m3onPrimary : Colours.palette.m3onPrimaryContainer
font.pointSize: Tokens.font.size.large font: Tokens.font.icon.large
fill: 1 fill: 1
} }
} }

View file

@ -36,8 +36,7 @@ DeviceList {
StyledText { StyledText {
text: qsTr("Bluetooth") text: qsTr("Bluetooth")
font.pointSize: Tokens.font.size.large font: Tokens.font.body.builders.large.weight(500).build()
font.weight: 500
} }
Item { Item {
@ -48,9 +47,9 @@ DeviceList {
toggled: Bluetooth.defaultAdapter?.enabled ?? false toggled: Bluetooth.defaultAdapter?.enabled ?? false
icon: "power" icon: "power"
accent: "Tertiary" accent: "Tertiary"
iconSize: Tokens.font.size.normal iconSize: Tokens.font.body.medium.pointSize
horizontalPadding: Tokens.padding.medium horizontalPadding: Tokens.padding.normal
verticalPadding: Tokens.padding.small verticalPadding: Tokens.padding.smaller
tooltip: qsTr("Toggle Bluetooth") tooltip: qsTr("Toggle Bluetooth")
onClicked: { onClicked: {
@ -64,9 +63,9 @@ DeviceList {
toggled: Bluetooth.defaultAdapter?.discoverable ?? false toggled: Bluetooth.defaultAdapter?.discoverable ?? false
icon: root.smallDiscoverable ? "group_search" : "" icon: root.smallDiscoverable ? "group_search" : ""
label: root.smallDiscoverable ? "" : qsTr("Discoverable") label: root.smallDiscoverable ? "" : qsTr("Discoverable")
iconSize: Tokens.font.size.normal iconSize: Tokens.font.body.medium.pointSize
horizontalPadding: Tokens.padding.medium horizontalPadding: Tokens.padding.normal
verticalPadding: Tokens.padding.small verticalPadding: Tokens.padding.smaller
tooltip: qsTr("Make discoverable") tooltip: qsTr("Make discoverable")
onClicked: { onClicked: {
@ -80,9 +79,9 @@ DeviceList {
toggled: Bluetooth.defaultAdapter?.pairable ?? false toggled: Bluetooth.defaultAdapter?.pairable ?? false
icon: "missing_controller" icon: "missing_controller"
label: root.smallPairable ? "" : qsTr("Pairable") label: root.smallPairable ? "" : qsTr("Pairable")
iconSize: Tokens.font.size.normal iconSize: Tokens.font.body.medium.pointSize
horizontalPadding: Tokens.padding.medium horizontalPadding: Tokens.padding.normal
verticalPadding: Tokens.padding.small verticalPadding: Tokens.padding.smaller
tooltip: qsTr("Make pairable") tooltip: qsTr("Make pairable")
onClicked: { onClicked: {
@ -96,9 +95,9 @@ DeviceList {
toggled: Bluetooth.defaultAdapter?.discovering ?? false toggled: Bluetooth.defaultAdapter?.discovering ?? false
icon: "bluetooth_searching" icon: "bluetooth_searching"
accent: "Secondary" accent: "Secondary"
iconSize: Tokens.font.size.normal iconSize: Tokens.font.body.medium.pointSize
horizontalPadding: Tokens.padding.medium horizontalPadding: Tokens.padding.normal
verticalPadding: Tokens.padding.small verticalPadding: Tokens.padding.smaller
tooltip: qsTr("Scan for devices") tooltip: qsTr("Scan for devices")
onClicked: { onClicked: {
@ -112,9 +111,9 @@ DeviceList {
toggled: !root.session.bt.active toggled: !root.session.bt.active
icon: "settings" icon: "settings"
accent: "Primary" accent: "Primary"
iconSize: Tokens.font.size.normal iconSize: Tokens.font.body.medium.pointSize
horizontalPadding: Tokens.padding.medium horizontalPadding: Tokens.padding.normal
verticalPadding: Tokens.padding.small verticalPadding: Tokens.padding.smaller
tooltip: qsTr("Bluetooth settings") tooltip: qsTr("Bluetooth settings")
onClicked: { onClicked: {
@ -178,7 +177,7 @@ DeviceList {
anchors.centerIn: parent anchors.centerIn: parent
text: Icons.getBluetoothIcon(device.modelData ? device.modelData.icon : "") text: Icons.getBluetoothIcon(device.modelData ? device.modelData.icon : "")
color: device.connected ? Colours.palette.m3onPrimaryContainer : (device.modelData && device.modelData.bonded) ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface color: device.connected ? Colours.palette.m3onPrimaryContainer : (device.modelData && device.modelData.bonded) ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface
font.pointSize: Tokens.font.size.large font: Tokens.font.icon.large
fill: device.connected ? 1 : 0 fill: device.connected ? 1 : 0
Behavior on fill { Behavior on fill {
@ -202,7 +201,7 @@ DeviceList {
Layout.fillWidth: true Layout.fillWidth: true
text: (device.modelData ? device.modelData.address : "") + (device.connected ? qsTr(" (Connected)") : (device.modelData && device.modelData.bonded) ? qsTr(" (Paired)") : "") text: (device.modelData ? device.modelData.address : "") + (device.connected ? qsTr(" (Connected)") : (device.modelData && device.modelData.bonded) ? qsTr(" (Paired)") : "")
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Tokens.font.size.small font: Tokens.font.body.small
elide: Text.ElideRight elide: Text.ElideRight
} }
} }

View file

@ -26,8 +26,7 @@ ColumnLayout {
StyledText { StyledText {
Layout.topMargin: Tokens.spacing.largeIncreased Layout.topMargin: Tokens.spacing.largeIncreased
text: qsTr("Adapter status") text: qsTr("Adapter status")
font.pointSize: Tokens.font.size.larger font: Tokens.font.body.builders.large.weight(500).build()
font.weight: 500
} }
StyledText { StyledText {
@ -87,8 +86,7 @@ ColumnLayout {
StyledText { StyledText {
Layout.topMargin: Tokens.spacing.largeIncreased Layout.topMargin: Tokens.spacing.largeIncreased
text: qsTr("Adapter properties") text: qsTr("Adapter properties")
font.pointSize: Tokens.font.size.larger font: Tokens.font.body.builders.large.weight(500).build()
font.weight: 500
} }
StyledText { StyledText {
@ -325,7 +323,7 @@ ColumnLayout {
text: qsTr("Rename adapter (currently does not work)") text: qsTr("Rename adapter (currently does not work)")
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Tokens.font.size.small font: Tokens.font.label.small
} }
StyledTextField { StyledTextField {
@ -444,8 +442,7 @@ ColumnLayout {
StyledText { StyledText {
Layout.topMargin: Tokens.spacing.largeIncreased Layout.topMargin: Tokens.spacing.largeIncreased
text: qsTr("Adapter information") text: qsTr("Adapter information")
font.pointSize: Tokens.font.size.larger font: Tokens.font.body.builders.large.weight(500).build()
font.weight: 500
} }
StyledText { StyledText {
@ -477,7 +474,7 @@ ColumnLayout {
StyledText { StyledText {
text: Bluetooth.defaultAdapter ? BluetoothAdapterState.toString(Bluetooth.defaultAdapter.state) : qsTr("Unknown") text: Bluetooth.defaultAdapter ? BluetoothAdapterState.toString(Bluetooth.defaultAdapter.state) : qsTr("Unknown")
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Tokens.font.size.small font: Tokens.font.body.small
} }
StyledText { StyledText {
@ -488,7 +485,7 @@ ColumnLayout {
StyledText { StyledText {
text: Bluetooth.defaultAdapter?.dbusPath ?? "" text: Bluetooth.defaultAdapter?.dbusPath ?? ""
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Tokens.font.size.small font: Tokens.font.body.small
} }
StyledText { StyledText {
@ -499,7 +496,7 @@ ColumnLayout {
StyledText { StyledText {
text: Bluetooth.defaultAdapter?.adapterId ?? "" text: Bluetooth.defaultAdapter?.adapterId ?? ""
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Tokens.font.size.small font: Tokens.font.body.small
} }
} }
} }