Move clock font settings to widget-specific configuration

- Moved clock font selection from general settings to clock widget settings
- Added custom font toggle and selection in ClockSettings.qml
- Updated BarWidgetRegistry.qml with new clock font metadata
- Removed global clockFont setting from Settings.qml and GeneralTab.qml
- Updated Clock.qml to use widget-specific custom font setting
- Added proper translation keys for new font options
- Maintained backward compatibility with existing font hierarchy
This commit is contained in:
DiscoNiri
2025-10-01 20:26:13 +10:00
parent 8b0e0f6e0e
commit 68e76abfc7
6 changed files with 46 additions and 18 deletions
@@ -17,6 +17,8 @@ ColumnLayout {
// Local state
property bool valueUsePrimaryColor: widgetData.usePrimaryColor !== undefined ? widgetData.usePrimaryColor : widgetMetadata.usePrimaryColor
property bool valueUseMonospacedFont: widgetData.useMonospacedFont !== undefined ? widgetData.useMonospacedFont : widgetMetadata.useMonospacedFont
property bool valueUseCustomFont: widgetData.useCustomFont !== undefined ? widgetData.useCustomFont : widgetMetadata.useCustomFont
property string valueCustomFont: widgetData.customFont !== undefined ? widgetData.customFont : widgetMetadata.customFont
property string valueFormatHorizontal: widgetData.formatHorizontal !== undefined ? widgetData.formatHorizontal : widgetMetadata.formatHorizontal
property string valueFormatVertical: widgetData.formatVertical !== undefined ? widgetData.formatVertical : widgetMetadata.formatVertical
@@ -30,6 +32,8 @@ ColumnLayout {
var settings = Object.assign({}, widgetData || {})
settings.usePrimaryColor = valueUsePrimaryColor
settings.useMonospacedFont = valueUseMonospacedFont
settings.useCustomFont = valueUseCustomFont
settings.customFont = valueCustomFont
settings.formatHorizontal = valueFormatHorizontal.trim()
settings.formatVertical = valueFormatVertical.trim()
return settings
@@ -78,6 +82,30 @@ ColumnLayout {
onToggled: checked => valueUseMonospacedFont = checked
}
NToggle {
Layout.fillWidth: true
label: I18n.tr("bar.widget-settings.clock.use-custom-font.label")
description: I18n.tr("bar.widget-settings.clock.use-custom-font.description")
checked: valueUseCustomFont
onToggled: checked => valueUseCustomFont = checked
}
NSearchableComboBox {
Layout.fillWidth: true
visible: valueUseCustomFont
label: I18n.tr("bar.widget-settings.clock.custom-font.label")
description: I18n.tr("bar.widget-settings.clock.custom-font.description")
model: FontService.availableFonts
currentKey: valueCustomFont
placeholder: I18n.tr("bar.widget-settings.clock.custom-font.placeholder")
searchPlaceholder: I18n.tr("bar.widget-settings.clock.custom-font.search-placeholder")
popupHeight: 420 * scaling
minimumWidth: 300 * scaling
onSelected: function (key) {
valueCustomFont = key
}
}
NDivider {
Layout.fillWidth: true
}
@@ -186,7 +214,7 @@ ColumnLayout {
delegate: NText {
visible: text !== ""
text: modelData
family: valueUseMonospacedFont ? Settings.data.ui.fontFixed : Settings.data.ui.fontDefault
family: valueUseCustomFont && valueCustomFont ? valueCustomFont : (valueUseMonospacedFont ? Settings.data.ui.fontFixed : Settings.data.ui.fontDefault)
pointSize: Style.fontSizeM * scaling
font.weight: Style.fontWeightBold
color: valueUsePrimaryColor ? Color.mPrimary : Color.mOnSurface
@@ -217,7 +245,7 @@ ColumnLayout {
delegate: NText {
visible: text !== ""
text: modelData
family: valueUseMonospacedFont ? Settings.data.ui.fontFixed : Settings.data.ui.fontDefault
family: valueUseCustomFont && valueCustomFont ? valueCustomFont : (valueUseMonospacedFont ? Settings.data.ui.fontFixed : Settings.data.ui.fontDefault)
pointSize: Style.fontSizeM * scaling
font.weight: Style.fontWeightBold
color: valueUsePrimaryColor ? Color.mPrimary : Color.mOnSurface
-13
View File
@@ -237,19 +237,6 @@ ColumnLayout {
}
}
NSearchableComboBox {
label: "Clock Font"
description: "Font used specifically for clock displays in the bar and widgets."
model: FontService.availableFonts
currentKey: Settings.data.ui.clockFont
placeholder: "Select clock font..."
searchPlaceholder: "Search fonts..."
popupHeight: 420 * scaling
minimumWidth: 300 * scaling
onSelected: function (key) {
Settings.data.ui.clockFont = key
}
}
ColumnLayout {
NLabel {