2023-07-19 01:55:54 +00:00
|
|
|
use anyhow;
|
|
|
|
use schemars::JsonSchema;
|
|
|
|
use serde_derive::{Deserialize, Serialize};
|
|
|
|
use settings::Setting;
|
2023-09-08 20:28:19 +00:00
|
|
|
use workspace::dock::DockPosition;
|
2023-07-19 01:55:54 +00:00
|
|
|
|
2023-09-08 20:28:19 +00:00
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct CollaborationPanelSettings {
|
|
|
|
pub button: bool,
|
|
|
|
pub dock: DockPosition,
|
|
|
|
pub default_width: f32,
|
2023-07-19 01:55:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
2023-09-08 20:28:19 +00:00
|
|
|
pub struct ChatPanelSettings {
|
2023-08-07 23:27:47 +00:00
|
|
|
pub button: bool,
|
2023-09-08 20:28:19 +00:00
|
|
|
pub dock: DockPosition,
|
2023-07-19 01:55:54 +00:00
|
|
|
pub default_width: f32,
|
|
|
|
}
|
|
|
|
|
2023-10-06 19:56:18 +00:00
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct NotificationPanelSettings {
|
|
|
|
pub button: bool,
|
|
|
|
pub dock: DockPosition,
|
|
|
|
pub default_width: f32,
|
|
|
|
}
|
|
|
|
|
2023-07-19 01:55:54 +00:00
|
|
|
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
|
2023-09-08 20:28:19 +00:00
|
|
|
pub struct PanelSettingsContent {
|
2023-08-07 23:27:47 +00:00
|
|
|
pub button: Option<bool>,
|
2023-09-08 20:28:19 +00:00
|
|
|
pub dock: Option<DockPosition>,
|
2023-07-19 01:55:54 +00:00
|
|
|
pub default_width: Option<f32>,
|
|
|
|
}
|
|
|
|
|
2023-08-07 23:27:47 +00:00
|
|
|
impl Setting for CollaborationPanelSettings {
|
|
|
|
const KEY: Option<&'static str> = Some("collaboration_panel");
|
2023-09-08 20:28:19 +00:00
|
|
|
type FileContent = PanelSettingsContent;
|
|
|
|
fn load(
|
|
|
|
default_value: &Self::FileContent,
|
|
|
|
user_values: &[&Self::FileContent],
|
|
|
|
_: &gpui::AppContext,
|
|
|
|
) -> anyhow::Result<Self> {
|
|
|
|
Self::load_via_json_merge(default_value, user_values)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Setting for ChatPanelSettings {
|
|
|
|
const KEY: Option<&'static str> = Some("chat_panel");
|
|
|
|
type FileContent = PanelSettingsContent;
|
2023-10-06 19:56:18 +00:00
|
|
|
fn load(
|
|
|
|
default_value: &Self::FileContent,
|
|
|
|
user_values: &[&Self::FileContent],
|
|
|
|
_: &gpui::AppContext,
|
|
|
|
) -> anyhow::Result<Self> {
|
|
|
|
Self::load_via_json_merge(default_value, user_values)
|
|
|
|
}
|
|
|
|
}
|
2023-07-19 01:55:54 +00:00
|
|
|
|
2023-10-06 19:56:18 +00:00
|
|
|
impl Setting for NotificationPanelSettings {
|
|
|
|
const KEY: Option<&'static str> = Some("notification_panel");
|
|
|
|
type FileContent = PanelSettingsContent;
|
2023-07-19 01:55:54 +00:00
|
|
|
fn load(
|
|
|
|
default_value: &Self::FileContent,
|
|
|
|
user_values: &[&Self::FileContent],
|
|
|
|
_: &gpui::AppContext,
|
|
|
|
) -> anyhow::Result<Self> {
|
|
|
|
Self::load_via_json_merge(default_value, user_values)
|
|
|
|
}
|
|
|
|
}
|