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    pub share_on_join: bool,
11}
12
13/// Configuration of voice calls in Zed.
14#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
15pub struct CallSettingsContent {
16    /// Whether the microphone should be muted when joining a channel or a call.
17    ///
18    /// Default: false
19    pub mute_on_join: Option<bool>,
20
21    /// Whether your current project should be shared when joining an empty channel.
22    ///
23    /// Default: true
24    pub share_on_join: Option<bool>,
25}
26
27impl Settings for CallSettings {
28    const KEY: Option<&'static str> = Some("calls");
29
30    type FileContent = CallSettingsContent;
31
32    fn load(
33        default_value: &Self::FileContent,
34        user_values: &[&Self::FileContent],
35        _cx: &mut AppContext,
36    ) -> Result<Self>
37    where
38        Self: Sized,
39    {
40        Self::load_via_json_merge(default_value, user_values)
41    }
42}