59 lines
2.1 KiB
Go
59 lines
2.1 KiB
Go
// Cthulhu screen reader.
|
|
// Copyright (c) 2026 Storm Dragon
|
|
// Authors: Storm Dragon, Angus Kola
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify it
|
|
// under the terms of the GNU General Public License as published by the Free
|
|
// Software Foundation, either version 3 of the License, or (at your option)
|
|
// any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
// more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License along with
|
|
// this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
|
|
|
|
package config
|
|
|
|
import (
|
|
"git.stormux.org/storm/cthulhu/internal/input"
|
|
)
|
|
|
|
func cloneSettings(settings Settings) Settings {
|
|
settings.Wine.ExcludedPrograms = append([]string(nil), settings.Wine.ExcludedPrograms...)
|
|
settings.SpeechInterruption.Keys = append([]string(nil), settings.SpeechInterruption.Keys...)
|
|
settings.KeyBindings = input.CloneBindingOverrides(settings.KeyBindings)
|
|
settings.CthulhuModifierKeys = append([]string(nil), settings.CthulhuModifierKeys...)
|
|
settings.Pronunciations = append([]PronunciationEntry(nil), settings.Pronunciations...)
|
|
settings.TextAttributes.Choices = append([]TextAttributeChoice(nil), settings.TextAttributes.Choices...)
|
|
settings.DefaultVoice = cloneVoice(settings.DefaultVoice)
|
|
settings.UppercaseVoice = cloneVoice(settings.UppercaseVoice)
|
|
settings.HyperlinkVoice = cloneVoice(settings.HyperlinkVoice)
|
|
settings.SystemVoice = cloneVoice(settings.SystemVoice)
|
|
settings.EchoVoice = cloneVoice(settings.EchoVoice)
|
|
return settings
|
|
}
|
|
|
|
func cloneVoice(voice Voice) Voice {
|
|
clone := voice
|
|
if voice.Rate != nil {
|
|
value := *voice.Rate
|
|
clone.Rate = &value
|
|
}
|
|
if voice.AveragePitch != nil {
|
|
value := *voice.AveragePitch
|
|
clone.AveragePitch = &value
|
|
}
|
|
if voice.Gain != nil {
|
|
value := *voice.Gain
|
|
clone.Gain = &value
|
|
}
|
|
if voice.Family != nil {
|
|
family := *voice.Family
|
|
clone.Family = &family
|
|
}
|
|
return clone
|
|
}
|