feat(dash): adjustable clock card font weight to match desktop/lockscreen

(cherry picked from commit 59ede533d8)
This commit is contained in:
purian23 committed 2026-10-28 01:48:15 -04:00
1 parent 43cb8c70b7
commit d29daf8fdd
5 files changed
+44 -2

No files matched your search

+8 -1
View File
@@ -67,6 +67,13 @@ Singleton {
};
}
function slider(key, text, def, min, max, step, minimumLabel) {
return Object.assign(number(key, text, def, min, max, step), {
"type": "slider",
"minimumLabel": minimumLabel ?? ""
});
}
function toneOption(def = "") {
return choice("tone", I18n.tr("Tone", "noun, dashboard widget color tone option label"), def, toneChoices);
}
@@ -231,7 +238,7 @@ Singleton {
"value": "analog",
"text": I18n.tr("Analog", "clock style option")
}
]), toggle("seconds", I18n.tr("Show seconds"), false), toggle("date", I18n.tr("Show date"), false), toggle("numbers", I18n.tr("Show hour numbers"), false), choice("tone", I18n.tr("Tone"), "primary", toneChoices)]
]), slider("weight", I18n.tr("Weight"), 0, 0, Font.Black, 100, I18n.tr("Default")), toggle("seconds", I18n.tr("Show seconds"), false), toggle("date", I18n.tr("Show date"), false), toggle("numbers", I18n.tr("Show hour numbers"), false), choice("tone", I18n.tr("Tone"), "primary", toneChoices)]
},
{
"id": "calendar",
@@ -42,6 +42,7 @@ Card {
minutes: root.minuteText
seconds: root.showSeconds ? root.secondText : ""
dateText: root.dateText
weight: root.options.weight
color: root.accentColor
supportingColor: root.supportingColor
}
@@ -35,11 +35,19 @@ SettingsRow {
return choiceControl;
case "number":
return numberControl;
case "slider":
return sliderLabel;
}
return null;
}
}
body: Loader {
width: parent?.width ?? 0
active: root.spec.type === "slider"
sourceComponent: sliderControl
}
Component {
id: toggleControl
@@ -79,4 +87,29 @@ SettingsRow {
onDecrement: () => root.commit(current - step)
}
}
Component {
id: sliderLabel
StyledText {
visible: root.value === root.spec.min
text: root.spec.minimumLabel ?? ""
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
}
Component {
id: sliderControl
SettingsSliderControl {
value: Number(root.value) || 0
minimum: root.spec.min
maximum: root.spec.max
step: root.spec.step
showValue: root.value !== root.spec.min
accessibleName: root.title
onSliderValueChanged: newValue => root.commit(newValue)
}
}
}
@@ -7,6 +7,7 @@ function value(spec, stored) {
case "choice":
return spec.choices.some(c => c.value === stored) ? stored : spec.def;
case "number":
case "slider":
if (!Number.isFinite(stored))
return spec.def;
return Math.max(spec.min, Math.min(spec.max, stored));
@@ -34,7 +34,7 @@ DesktopWidgetInstanceSettings {
visible: !root.analog
text: I18n.tr("Weight")
minimum: 0
maximum: 900
maximum: Font.Black
step: 100
minimumLabel: I18n.tr("Default")
value: root.cfg.weight ?? 0