Application specific preferences saving now enabled.

This commit is contained in:
Storm Dragon committed 2026-10-28 04:51:39 -04:00
1 parent f88e5b81a2
commit 60abcc37d9
23 files changed
+1004 -248

No files matched your search

+27 -6
View File
@@ -139,6 +139,10 @@ func (a *application) open_settings() {
selected := a.settings.live.Presentation.Speech
a.ui.speechOverride = &selected
}
if selected := a.overrideCurrent; selected != nil {
a.ui.open_application_settings(a.settings_to_save(), selected.path, selected.base, i18n.T(selected.adapter.Name()))
return
}
if a.quick.changed {
a.ui.open_settings(a.settings.live, a.options.ConfigPath, a.settings.live)
} else {
@@ -155,7 +159,7 @@ func (a *application) save_settings() {
a.voice.Say(i18n.T("Failed to save settings."))
return
}
if a.saver.save(a.ctx, a.options.ConfigPath, a.settings_to_save()) {
if a.start_settings_save(a.settings_path(), a.settings_to_save()) {
a.saver.revision = a.settings.remoteRevision
}
}
@@ -172,6 +176,7 @@ func (a *application) save_menu_settings(doc *config.Document, draft config.Sett
a.ui.failed("Could not save settings: {0}", fmt.Errorf("speech selection in progress"))
return false
}
previousDraft := a.settings.saveDraft
speechApplied := a.settings.speechAvailable && draft.Presentation.Speech.Driver == a.settings.live.Presentation.Speech.Driver && !same_speech_selection(draft.Presentation.Speech, a.settings.saveDraft.Presentation.Speech)
if !a.saver.start(a.ctx, draft, func() error {
var prepared speech.Transport
@@ -220,7 +225,24 @@ func (a *application) save_menu_settings(doc *config.Document, draft config.Sett
if a.quick.fields["presentation.progress.enabled"] > quickRevision {
merged.Presentation.Progress = a.settings.live.Presentation.Progress
}
a.apply_saved_settings(merged, speechApplied && err == nil)
if a.overrideCurrent != nil {
live := config.Apply_application_settings(a.effective_settings(), merged)
if merged.Presentation.Speech.Enabled == previousDraft.Presentation.Speech.Enabled {
live.Presentation.Speech.Enabled = !a.muted
}
if merged.Reading.Automatic == previousDraft.Reading.Automatic {
live.Reading.Automatic = a.engine.Automatic_reading()
}
if !speechApplied || err != nil {
copy_speech_selection(&live.Presentation.Speech, a.settings.live.Presentation.Speech)
}
a.apply_remote_state(live, false)
a.configure_reader()
a.settings.saveDraft = merged
a.quick.selectionChanged = false
} else {
a.apply_saved_settings(merged, speechApplied && err == nil)
}
a.settings.resetBase = draft // RESET reflects disk, not later overrides.
a.quick.changed = newerQuick
}
@@ -249,6 +271,9 @@ func (a *application) effective_settings() config.Settings {
// Remote assignments are validated against effective session state, then
// separately overlaid on the save draft so unrelated next-launch choices survive.
func (a *application) apply_remote_settings(text string) string {
if err := a.check_application_remote(text); err != nil {
return err.Error()
}
updated, err := remote_settings(a.effective_settings(), text)
if err != nil {
return err.Error()
@@ -256,10 +281,6 @@ func (a *application) apply_remote_settings(text string) string {
if updated.Presentation.Speech.Enabled && !a.settings.speechAvailable {
return "Speech was disabled at startup; enable it in settings and relaunch"
}
if a.overrideCurrent != nil {
a.apply_remote_state(updated, false)
return ""
}
// Apply only the requested assignments to the persistence
// draft, retaining unrelated next-launch menu settings.
draftBase := a.settings.saveDraft