()
| 73 | pub(crate) fn character_volume(&self, name: &str) -> f32 { |
| 74 | *self.character_volume.volumes.get(name).unwrap() |
| 75 | } |
| 76 | |
| 77 | pub(crate) fn from_weak(weak: Weak<MainWindow>) -> Self { |
| 78 | UserConfig { |
| 79 | auto: AutoConfig::from_weak(weak.clone()), |
| 80 | text: TextConfig::from_weak(weak.clone()), |
| 81 | volume: VolumeConfig::from_weak(weak.clone()), |
| 82 | character_volume: CharacterVolumeConfig::from_weak(weak), |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | fn load_user_config() -> UserConfig { |
| 88 | let path = format!("{}/user.toml", ENGINE_CONFIG.save_path()); |
| 89 | |
| 90 | match fs::read_to_string(&path) { |
| 91 | Ok(content) => match toml::from_str::<UserConfig>(&content) { |
| 92 | Ok(mut config) => { |
| 93 | config.character_volume.fill_missing(); |
| 94 | |
| 95 | let resolved = SYSTEM_FONTS.resolve(config.text.font()); |
| 96 | if resolved != config.text.font() { |
| 97 | config.text.set_font(resolved); |
| 98 | let _ = write_config(&path, &config); |
| 99 | } |
nothing calls this directly
no test coverage detected