feat: fontbuilder to streamline font styling
This commit is contained in:
@@ -13,6 +13,7 @@ import qs.Services
|
||||
WidgetBase {
|
||||
id: root
|
||||
|
||||
readonly property font font: Tokens.font.clock.family(Config.appearance.font.family.clock).build()
|
||||
readonly property color contentColor: screenState.dashboard ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||
readonly property string effectiveFormat: {
|
||||
let fmt = Config.general.dateFormat;
|
||||
@@ -57,7 +58,7 @@ WidgetBase {
|
||||
|
||||
anchors.centerIn: parent
|
||||
color: root.contentColor
|
||||
font.family: Config.appearance.font.family.mono // qmllint disable incompatible-type
|
||||
font: root.font
|
||||
height: implicitHeight
|
||||
text: Time.dateStr
|
||||
visible: root.horizontal
|
||||
@@ -84,7 +85,7 @@ WidgetBase {
|
||||
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
color: root.contentColor
|
||||
font.family: Config.appearance.font.family.mono // qmllint disable incompatible-type
|
||||
font: root.font
|
||||
text: Qt.formatDateTime(Time.date, modelData)
|
||||
|
||||
Behavior on color {
|
||||
@@ -114,7 +115,7 @@ WidgetBase {
|
||||
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
color: root.contentColor
|
||||
font.family: Config.appearance.font.family.mono // qmllint disable incompatible-type
|
||||
font: root.font
|
||||
text: {
|
||||
if (modelData.includes("h"))
|
||||
return Time.hourStr;
|
||||
@@ -135,7 +136,7 @@ WidgetBase {
|
||||
CustomText {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
color: root.contentColor
|
||||
font.family: Config.appearance.font.family.mono // qmllint disable incompatible-type
|
||||
font: root.font
|
||||
text: Qt.formatDateTime(Time.date, "AP")
|
||||
visible: Config.services.useTwelveHourClock && root.formatParts.timeTokens.length > 0
|
||||
|
||||
|
||||
@@ -28,8 +28,7 @@ Row {
|
||||
|
||||
CustomText {
|
||||
color: Battery.getColors(root.percentage, root.devState).fg
|
||||
font.pointSize: Tokens.font.size.larger / 1.5
|
||||
font.weight: 800
|
||||
font: Tokens.font.body.builders.small.size(11).weight(Font.Bold).build()
|
||||
height: track.height
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: Math.round(root.percentage * 100)
|
||||
@@ -60,8 +59,7 @@ Row {
|
||||
|
||||
clip: true
|
||||
color: Battery.getColors(root.percentage, root.devState).bg
|
||||
font.pointSize: Tokens.font.size.larger / 1.5
|
||||
font.weight: 800
|
||||
font: Tokens.font.body.builders.small.size(11).weight(Font.Bold).build()
|
||||
height: track.height
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: Math.round(root.percentage * 100)
|
||||
|
||||
@@ -25,12 +25,11 @@ WidgetBase {
|
||||
animate: true
|
||||
color: root.tempEnabled ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||
fill: root.tempEnabled ? 1 : 0
|
||||
font.pointSize: Tokens.font.size.larger
|
||||
fontStyle: Tokens.font.icon.small
|
||||
text: root.tempEnabled ? "lightbulb" : "light_off"
|
||||
|
||||
Behavior on fill {
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,14 +19,12 @@ WidgetBase {
|
||||
Behavior on implicitHeight {
|
||||
enabled: !root.horizontal
|
||||
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
Behavior on implicitWidth {
|
||||
enabled: root.horizontal
|
||||
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
|
||||
TextMetrics {
|
||||
@@ -47,15 +45,14 @@ WidgetBase {
|
||||
columns: root.horizontal ? -1 : 1
|
||||
|
||||
Behavior on implicitWidth {
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
|
||||
MaterialIcon {
|
||||
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
||||
animate: true
|
||||
color: Players.active?.isPlaying ? Colors.palette.m3primary : Colors.palette.m3onSurface
|
||||
font.pointSize: Tokens.font.size.larger
|
||||
fontStyle: Tokens.font.icon.small
|
||||
text: Players.active?.isPlaying ? "music_note" : "music_off"
|
||||
}
|
||||
|
||||
@@ -65,7 +62,6 @@ WidgetBase {
|
||||
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
||||
animate: true
|
||||
color: Players.active?.isPlaying ? Colors.palette.m3primary : Colors.palette.m3onSurface
|
||||
font.pointSize: Tokens.font.size.normal
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
implicitHeight: root.horizontal ? root.implicitHeight : root.textWidth
|
||||
implicitWidth: root.horizontal ? root.textWidth : root.implicitWidth
|
||||
|
||||
@@ -22,16 +22,14 @@ WidgetBase {
|
||||
anchors.centerIn: parent
|
||||
color: root.screenState.sidebar ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||
fill: root.screenState.sidebar ? 1 : 0
|
||||
font.pointSize: Tokens.font.size.larger
|
||||
fontStyle: Tokens.font.icon.size(16).build()
|
||||
text: NotifServer.list.length ? "\uf4fe" : "\ue7f4"
|
||||
|
||||
Behavior on color {
|
||||
CAnim {
|
||||
}
|
||||
CAnim {}
|
||||
}
|
||||
Behavior on fill {
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,7 @@ GridLayout {
|
||||
percentage: 0
|
||||
|
||||
Behavior on animatedPercentage {
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
|
||||
Component.onCompleted: animatedPercentage = percentage
|
||||
@@ -44,7 +43,7 @@ GridLayout {
|
||||
|
||||
Layout.preferredWidth: 16
|
||||
color: root.iconColor
|
||||
font.pointSize: Tokens.font.size.larger
|
||||
fontStyle: Tokens.font.icon.small
|
||||
text: root.icon
|
||||
}
|
||||
|
||||
|
||||
@@ -13,19 +13,16 @@ MaterialIcon {
|
||||
animate: true
|
||||
color: Audio.muted ? Colors.palette.m3error : Colors.palette.m3onSurface
|
||||
fill: 1
|
||||
font.pointSize: Tokens.font.size.larger
|
||||
fontStyle: Tokens.font.icon.small
|
||||
text: Audio.muted ? "volume_off" : "volume_up"
|
||||
|
||||
Behavior on Layout.maximumWidth {
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
Behavior on scale {
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,19 +13,16 @@ MaterialIcon {
|
||||
animate: true
|
||||
color: (Audio.sourceMuted ?? false) ? Colors.palette.m3error : Colors.palette.m3onSurface
|
||||
fill: 1
|
||||
font.pointSize: Tokens.font.size.larger
|
||||
fontStyle: Tokens.font.icon.small
|
||||
text: Audio.sourceMuted ? "mic_off" : "mic"
|
||||
|
||||
Behavior on Layout.maximumWidth {
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
Behavior on scale {
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,20 +15,16 @@ Item {
|
||||
implicitWidth: currentItem?.implicitWidth ?? 0
|
||||
|
||||
Behavior on Layout.preferredHeight {
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
Behavior on Layout.preferredWidth {
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
Behavior on scale {
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
|
||||
Component.onCompleted: Battery.startDaemon()
|
||||
@@ -67,7 +63,7 @@ Item {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
animate: true
|
||||
fill: 1
|
||||
font.pointSize: Tokens.font.size.larger
|
||||
fontStyle: Tokens.font.icon.small
|
||||
text: {
|
||||
if (PowerProfiles.profile === PowerProfile.PowerSaver)
|
||||
return "energy_savings_leaf";
|
||||
|
||||
@@ -27,14 +27,13 @@ WidgetBase {
|
||||
|
||||
MaterialIcon {
|
||||
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
||||
font.pointSize: root.horizontal ? Tokens.font.size.larger : Tokens.font.size.large
|
||||
fontStyle: Tokens.font.icon.small
|
||||
text: "package_2"
|
||||
}
|
||||
|
||||
CustomText {
|
||||
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
||||
color: root.textColor
|
||||
font.pointSize: Tokens.font.size.normal
|
||||
text: root.countUpdates
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,8 +52,7 @@ Item {
|
||||
|
||||
elide: Qt.ElideRight
|
||||
elideWidth: root.maxSize - (root.horizontal ? root.current.anchors.leftMargin : 0)
|
||||
font.family: "Rubik"
|
||||
font.pointSize: Tokens.font.size.normal
|
||||
font: Tokens.font.body.small
|
||||
text: Hypr.activeToplevel?.title ?? qsTr("Desktop")
|
||||
|
||||
onElideWidthChanged: root.current.text = elidedText
|
||||
@@ -81,8 +80,7 @@ Item {
|
||||
width: root.horizontal ? implicitWidth : implicitHeight
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
transform: [
|
||||
Translate {
|
||||
|
||||
Reference in New Issue
Block a user