call_settings.rs

 1use anyhow::Result;
 2use gpui::AppContext;
 3use schemars::JsonSchema;
 4use serde_derive::{Deserialize, Serialize};
 5use settings::Settings;
 6
 7#[derive(Deserialize, Debug)]
 8pub struct CallSettings {
 9    pub mute_on_join: bool,
10}
11
12/// Configuration of voice calls in Zed.
13#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
14pub struct CallSettingsContent {
15    /// Whether the microphone should be muted when joining a channel or a call.
16    ///
17    /// Default: false
18    pub mute_on_join: Option<bool>,
19}
20
21impl Settings for CallSettings {
22    const KEY: Option<&'static str> = Some("calls");
23
24    type FileContent = CallSettingsContent;
25
26    fn load(
27        default_value: &Self::FileContent,
28        user_values: &[&Self::FileContent],
29        _cx: &mut AppContext,
30    ) -> Result<Self>
31    where
32        Self: Sized,
33    {
34        Self::load_via_json_merge(default_value, user_values)
35    }
36}