mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
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:
@@ -990,6 +990,16 @@
|
||||
"label": "Use monospaced font",
|
||||
"description": "When enabled, the clock will use the monospaced font."
|
||||
},
|
||||
"use-custom-font": {
|
||||
"label": "Use custom font",
|
||||
"description": "Override the default font selection with a custom font for the clock."
|
||||
},
|
||||
"custom-font": {
|
||||
"label": "Custom font",
|
||||
"description": "Select a custom font for the clock display.",
|
||||
"placeholder": "Select custom font...",
|
||||
"search-placeholder": "Search fonts..."
|
||||
},
|
||||
"clock-display": {
|
||||
"label": "Clock display",
|
||||
"description": "Customize your clock's display by adding tokens from the list below. To use the 12-hour format, you must include the 'AP' token."
|
||||
|
||||
@@ -272,7 +272,6 @@ Singleton {
|
||||
property JsonObject ui: JsonObject {
|
||||
property string fontDefault: "Roboto"
|
||||
property string fontFixed: "DejaVu Sans Mono"
|
||||
property string clockFont: "Roboto"
|
||||
property real fontDefaultScale: 1.0
|
||||
property real fontFixedScale: 1.0
|
||||
property list<var> monitorsScaling: []
|
||||
|
||||
@@ -37,6 +37,8 @@ Rectangle {
|
||||
// Resolve settings: try user settings or defaults from BarWidgetRegistry
|
||||
readonly property bool usePrimaryColor: widgetSettings.usePrimaryColor !== undefined ? widgetSettings.usePrimaryColor : widgetMetadata.usePrimaryColor
|
||||
property bool useMonospacedFont: widgetSettings.useMonospacedFont !== undefined ? widgetSettings.useMonospacedFont : widgetMetadata.useMonospacedFont
|
||||
readonly property bool useCustomFont: widgetSettings.useCustomFont !== undefined ? widgetSettings.useCustomFont : widgetMetadata.useCustomFont
|
||||
readonly property string customFont: widgetSettings.customFont !== undefined ? widgetSettings.customFont : widgetMetadata.customFont
|
||||
readonly property string formatHorizontal: widgetSettings.formatHorizontal !== undefined ? widgetSettings.formatHorizontal : widgetMetadata.formatHorizontal
|
||||
readonly property string formatVertical: widgetSettings.formatVertical !== undefined ? widgetSettings.formatVertical : widgetMetadata.formatVertical
|
||||
|
||||
@@ -65,7 +67,7 @@ Rectangle {
|
||||
NText {
|
||||
visible: text !== ""
|
||||
text: modelData
|
||||
family: Settings.data.ui.clockFont || (useMonospacedFont ? Settings.data.ui.fontFixed : Settings.data.ui.fontDefault)
|
||||
family: useCustomFont && customFont ? customFont : (useMonospacedFont ? Settings.data.ui.fontFixed : Settings.data.ui.fontDefault)
|
||||
pointSize: {
|
||||
if (repeater.model.length == 1) {
|
||||
return Style.fontSizeS * scaling
|
||||
@@ -95,7 +97,7 @@ Rectangle {
|
||||
delegate: NText {
|
||||
visible: text !== ""
|
||||
text: modelData
|
||||
family: Settings.data.ui.clockFont || (useMonospacedFont ? Settings.data.ui.fontFixed : Settings.data.ui.fontDefault)
|
||||
family: useCustomFont && customFont ? customFont : (useMonospacedFont ? Settings.data.ui.fontFixed : Settings.data.ui.fontDefault)
|
||||
pointSize: Style.fontSizeS * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
color: usePrimaryColor ? Color.mPrimary : Color.mOnSurface
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -57,6 +57,8 @@ Singleton {
|
||||
"allowUserSettings": true,
|
||||
"usePrimaryColor": true,
|
||||
"useMonospacedFont": true,
|
||||
"useCustomFont": false,
|
||||
"customFont": "",
|
||||
"formatHorizontal": "HH:mm ddd, MMM dd",
|
||||
"formatVertical": "HH mm - dd MM"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user