Add global Wine preferences tab

Phase 3 of the Wine/Proton stage (decisions 6, 9, 13, 19 in docs/testing/wine-proton.md): a global-only Wine tab modeled on the Pronunciation page, with the controller-only checkbox and a typed editable program list. Wine values flow through the preferences protocol so a global Apply reaches the live Wine settings from Phase 2 with no reader restart. Entries are validated as edited and named in-tab, blocking Apply until fixed; case-insensitive duplicates collapse. Per-application preferences expose no Wine editing and an app-scoped Apply cannot change the governing list.
This commit is contained in:
hjozwiak committed 2026-11-02 02:49:33 -05:00
1 parent dc6a961032
commit 75f34ea767
15 files changed
+543 -5

No files matched your search

+9 -1
View File
@@ -12,7 +12,7 @@ import (
)
func FromSettings(settings config.Settings) Values {
return Values{StructuralNavigationTriggersFocusMode: settings.StructuralNavigationTriggersFocusMode, OCR: settings.OCR, Pronunciations: append([]config.PronunciationEntry(nil), settings.Pronunciations...),
return Values{StructuralNavigationTriggersFocusMode: settings.StructuralNavigationTriggersFocusMode, Wine: cloneWineSettings(settings.Wine), OCR: settings.OCR, Pronunciations: append([]config.PronunciationEntry(nil), settings.Pronunciations...),
TextAttributes: config.TextAttributeSettings{Choices: append([]config.TextAttributeChoice(nil), settings.TextAttributes.Choices...), Indicator: settings.TextAttributes.Indicator},
KeyboardLayout: settings.KeyboardLayout, CthulhuModifierKeys: append([]string(nil), settings.CthulhuModifierKeys...),
KeyBindings: input.CloneBindingOverrides(settings.KeyBindings), TimeFormat: settings.TimeFormat, DateFormat: settings.DateFormat,
@@ -71,6 +71,14 @@ func FromSettings(settings config.Settings) Values {
}
func (values Values) Merge(settings config.Settings) (config.Settings, error) {
// Validate Wine before changing anything: an invalid entry is named and
// rejected here rather than silently dropped, so a rejected Apply leaves
// the governing settings untouched.
wine, err := normalizedWineSettings(values.Wine)
if err != nil {
return settings, err
}
settings.Wine = wine
settings.Pronunciations = append([]config.PronunciationEntry(nil), values.Pronunciations...)
settings.TextAttributes = config.TextAttributeSettings{Choices: append([]config.TextAttributeChoice(nil), values.TextAttributes.Choices...), Indicator: values.TextAttributes.Indicator}
settings.OCR = values.OCR