forge
Explore
Log in

Don't you dare go Hollow

Stage strip for cameras and screens, auto watch quality, voice panel keeps call members

Browse files at this commit

ae944e76a3428fa319bd03e47169321028809fe8Ahmet Kaan GümüşParent: 63d5a7f
  • feat
    • stage strip for cameras and screens, auto watch quality, voice panel keeps call members
Show full message
✨ feat: stage strip for cameras and screens, auto watch quality, voice panel keeps call members
crates/client/src/gui/camera_view.rsmodified+94 -33
@@ -4,14 +4,17 @@ use std::sync::Arc;
4 use common::share::{Fps, Kind, Quality, Resolution};4 use common::share::{Fps, Kind, Quality, Resolution};
5 use gpui_kit::{5 use gpui_kit::{
6 Context, Entity, InteractiveElement, IntoElement, ObjectFit, ParentElement, RenderImage,6 Context, Entity, InteractiveElement, IntoElement, ObjectFit, ParentElement, RenderImage,
7- StatefulInteractiveElement, Styled, StyledImage, Task, Window, assets::IconName, div, img, px,7+ StatefulInteractiveElement, Styled, StyledImage, Task, Window,
8+ assets::IconName,
9+ component::Icon,
10+ div, img, px,
8 };11 };
9 12
10 use super::{13 use super::{
11- Palette, Tooltip as _, Yumush, clickable,14+ Palette, Tooltip as _, Yumush, avatar, clickable,
12 media_view::to_render_image,15 media_view::to_render_image,
13 notify_error,16 notify_error,
14- share_view::FRAME_TICK,17+ share_view::{self, FRAME_TICK},
15 text,18 text,
16 widget::{icon_button, spawn_warn},19 widget::{icon_button, spawn_warn},
17 };20 };
@@ -131,35 +134,50 @@ impl Yumush {
131 .detach();134 .detach();
132 }135 }
133 136
134- pub(super) fn camera_row(137+ pub(super) fn stage_sources(&self) -> Vec<(Id, Kind)> {
138+ let Some(community_id) = self.chat.voice_community() else {
139+ return Vec::new();
140+ };
141+ let mut sources: Vec<(Id, Kind)> = self
142+ .chat
143+ .shares
144+ .get(&community_id)
145+ .into_iter()
146+ .flatten()
147+ .map(|share| (share.user_id, share.kind))
148+ .collect();
149+ sources.sort();
150+ sources
151+ }
152+
153+ pub(super) fn stage_strip(
135 &self,154 &self,
136 entity: &Entity<Self>,155 entity: &Entity<Self>,
137 palette: Palette,156 palette: Palette,
138 ) -> Option<impl IntoElement> {157 ) -> Option<impl IntoElement> {
139- if self.chat.cameras.is_empty() {158+ let sources = self.stage_sources();
159+ if self.chat.stage_hidden
160+ || sources.is_empty()
161+ || self.chat.selected_community_id != self.chat.voice_community()
162+ {
140 return None;163 return None;
141 }164 }
142- let tiles: Vec<_> = self165+ let tiles: Vec<_> = sources
143- .chat166+ .into_iter()
144- .cameras167+ .map(|source| stage_tile(entity, self, palette, source))
145- .iter()
146- .map(|(user_id, tile)| {
147- let name = self
148- .chat
149- .author(*user_id)
150- .map_or("Someone", |user| user.username.as_str());
151- camera_tile(entity, *user_id, name, tile, palette)
152- })
153 .collect();168 .collect();
154 169
155 Some(170 Some(
156 div()171 div()
157- .id("camera_row")172+ .id("stage_strip")
158 .flex()173 .flex()
159 .flex_shrink_0()174 .flex_shrink_0()
175+ .h(px(108.))
160 .gap(px(6.))176 .gap(px(6.))
161 .p(px(6.))177 .p(px(6.))
162 .overflow_x_scroll()178 .overflow_x_scroll()
179+ .border_b_1()
180+ .border_color(palette.border)
163 .children(tiles),181 .children(tiles),
164 )182 )
165 }183 }
@@ -206,33 +224,72 @@ pub(super) fn camera_toggle(
206 .text_color(if on { palette.ok } else { palette.muted })224 .text_color(if on { palette.ok } else { palette.muted })
207 }225 }
208 226
209-fn camera_tile(227+fn stage_tile(
210 entity: &Entity<Yumush>,228 entity: &Entity<Yumush>,
211- user_id: Id,229+ yumush: &Yumush,
212- name: &str,
213- tile: &CameraTile,
214 palette: Palette,230 palette: Palette,
231+ (user_id, kind): (Id, Kind),
215 ) -> impl IntoElement {232 ) -> impl IntoElement {
216 let entity = entity.clone();233 let entity = entity.clone();
234+ let focused = yumush.is_watching(user_id, kind);
235+ let speaking = yumush.chat.waves.speaking.contains(&user_id);
236+ let frame = match kind {
237+ Kind::Camera => yumush
238+ .chat
239+ .cameras
240+ .get(&user_id)
241+ .and_then(|tile| tile.frame.clone()),
242+ Kind::Screen => yumush.viewer_frame(user_id, kind),
243+ };
244+ let user = yumush.chat.author(user_id);
245+ let name = user.map_or("Someone", |user| user.username.as_str());
246+ let content = match (frame, user) {
247+ (Some(frame), _) => img(frame)
248+ .size_full()
249+ .object_fit(ObjectFit::Cover)
250+ .into_any_element(),
251+ (None, Some(user)) => div()
252+ .size_full()
253+ .flex()
254+ .items_center()
255+ .justify_center()
256+ .child(avatar(
257+ palette,
258+ user,
259+ px(36.),
260+ text(14.),
261+ &yumush.chat.avatars,
262+ ))
263+ .into_any_element(),
264+ (None, None) => div().into_any_element(),
265+ };
217 266
218- clickable(format!("camera_{user_id}"), palette, move |window, cx| {267+ clickable(
219- entity.update(cx, |yumush, cx| {268+ format!("stage_{user_id}_{kind:?}"),
220- yumush.toggle_viewer(user_id, Kind::Camera, window, cx)269+ palette,
221- });270+ move |window, cx| {
222- })271+ entity.update(cx, |yumush, cx| {
272+ yumush.toggle_viewer(user_id, kind, window, cx)
273+ });
274+ },
275+ )
223 .tip("Watch")276 .tip("Watch")
224 .relative()277 .relative()
225 .flex_shrink_0()278 .flex_shrink_0()
226- .w(px(213.))279+ .w(px(171.))
227- .h(px(120.))280+ .h(px(96.))
228 .rounded(px(8.))281 .rounded(px(8.))
229 .overflow_hidden()282 .overflow_hidden()
230 .bg(gpui_kit::black())283 .bg(gpui_kit::black())
231- .children(284+ .border_2()
232- tile.frame285+ .border_color(if focused {
233- .clone()286+ palette.accent
234- .map(|frame| img(frame).size_full().object_fit(ObjectFit::Cover)),287+ } else if speaking {
235- )288+ palette.ok
289+ } else {
290+ palette.ok.opacity(0.)
291+ })
292+ .child(content)
236 .child(293 .child(
237 div()294 div()
238 .absolute()295 .absolute()
@@ -243,6 +300,10 @@ fn camera_tile(
243 .rounded(px(4.))300 .rounded(px(4.))
244 .bg(palette.panel)301 .bg(palette.panel)
245 .text_size(text(11.))302 .text_size(text(11.))
303+ .flex()
304+ .items_center()
305+ .gap(px(4.))
306+ .child(Icon::new(share_view::kind_icon(kind)).w(px(12.)).h(px(12.)))
246 .child(name.to_string()),307 .child(name.to_string()),
247 )308 )
248 }309 }
crates/client/src/gui/chat.rsmodified+55 -30
@@ -22,7 +22,7 @@ use crate::gui::{
22 primary_button,22 primary_button,
23 profile::profile_popover,23 profile::profile_popover,
24 rank_tag,24 rank_tag,
25- share_view::{self, Viewer},25+ share_view::Viewer,
26 sidebar::{SidebarTab, unread_badge},26 sidebar::{SidebarTab, unread_badge},
27 snippet,27 snippet,
28 voice_note::{self, VoiceNote},28 voice_note::{self, VoiceNote},
@@ -257,6 +257,7 @@ pub struct Chat {
257 pub(super) viewer: Option<Viewer>,257 pub(super) viewer: Option<Viewer>,
258 pub(super) cameras: BTreeMap<Id, CameraTile>,258 pub(super) cameras: BTreeMap<Id, CameraTile>,
259 pub(super) camera_task: Option<Task<()>>,259 pub(super) camera_task: Option<Task<()>>,
260+ pub(super) stage_hidden: bool,
260 pub(super) typing: HashMap<Id, HashMap<Id, Instant>>,261 pub(super) typing: HashMap<Id, HashMap<Id, Instant>>,
261 pub(super) typing_sent: HashMap<Id, Instant>,262 pub(super) typing_sent: HashMap<Id, Instant>,
262 }263 }
@@ -487,6 +488,7 @@ impl Chat {
487 viewer: None,488 viewer: None,
488 cameras: BTreeMap::new(),489 cameras: BTreeMap::new(),
489 camera_task: None,490 camera_task: None,
491+ stage_hidden: false,
490 composer: Composer::Compose { reply: None },492 composer: Composer::Compose { reply: None },
491 }493 }
492 }494 }
@@ -703,7 +705,8 @@ impl Chat {
703 self.delete_step = DeleteStep::Idle;705 self.delete_step = DeleteStep::Idle;
704 }706 }
705 self.selected_community_id = community_id;707 self.selected_community_id = community_id;
706- self.members.clear();708+ self.users
709+ .extend(self.members.drain(..).map(|member| (member.user.id, member.user)));
707 self.bans.clear();710 self.bans.clear();
708 self.logs.clear();711 self.logs.clear();
709 self.pending_user_delete = None;712 self.pending_user_delete = None;
@@ -896,16 +899,22 @@ impl Chat {
896 }899 }
897 900
898 fn missing_authors(&self) -> Vec<Id> {901 fn missing_authors(&self) -> Vec<Id> {
899- if self.members.is_empty() {902+ let mut ids: Vec<Id> = if self.members.is_empty() {
900- return vec![];903+ vec![]
904+ } else {
905+ self.messages
906+ .iter()
907+ .flat_map(|message| {
908+ std::iter::once(message.user_id)
909+ .chain(message.reply.as_ref().map(|quote| quote.user_id))
910+ })
911+ .collect()
912+ };
913+ if let Some(community_id) = self.voice_community() {
914+ ids.extend_from_slice(self.voice_ids(community_id));
901 }915 }
902- let mut missing: Vec<Id> = self916+ let mut missing: Vec<Id> = ids
903- .messages917+ .into_iter()
904- .iter()
905- .flat_map(|message| {
906- std::iter::once(message.user_id)
907- .chain(message.reply.as_ref().map(|quote| quote.user_id))
908- })
909 .filter(|id| self.author(*id).is_none() && !self.user_requests.contains(id))918 .filter(|id| self.author(*id).is_none() && !self.user_requests.contains(id))
910 .collect();919 .collect();
911 missing.sort();920 missing.sort();
@@ -1103,10 +1112,6 @@ impl Chat {
1103 .find(|share| share.user_id == user_id && share.kind == kind)1112 .find(|share| share.user_id == user_id && share.kind == kind)
1104 }1113 }
1105 1114
1106- pub fn is_sharing(&self, community_id: Id, user_id: Id) -> bool {
1107- self.share_of(community_id, user_id, Kind::Screen).is_some()
1108- }
1109-
1110 pub fn voice_ids(&self, community_id: Id) -> &[Id] {1115 pub fn voice_ids(&self, community_id: Id) -> &[Id] {
1111 self.voice1116 self.voice
1112 .get(&community_id)1117 .get(&community_id)
@@ -1270,7 +1275,7 @@ impl Yumush {
1270 View::Chat => match self.chat.selected_community_id {1275 View::Chat => match self.chat.selected_community_id {
1271 Some(_) => panel1276 Some(_) => panel
1272 .child(self.header(entity, themed))1277 .child(self.header(entity, themed))
1273- .children(self.camera_row(entity, themed))1278+ .children(self.stage_strip(entity, themed))
1274 .children(self.unread_bar(entity, themed))1279 .children(self.unread_bar(entity, themed))
1275 .children(self.poll_banner(entity, themed))1280 .children(self.poll_banner(entity, themed))
1276 .map(|panel| match self.inline_viewer(entity, themed) {1281 .map(|panel| match self.inline_viewer(entity, themed) {
@@ -1737,7 +1742,11 @@ impl Yumush {
1737 .users1742 .users
1738 .insert(member.user.id, member.user.clone());1743 .insert(member.user.id, member.user.clone());
1739 }1744 }
1740- yumush.chat.members = members;1745+ let old = std::mem::replace(&mut yumush.chat.members, members);
1746+ yumush
1747+ .chat
1748+ .users
1749+ .extend(old.into_iter().map(|member| (member.user.id, member.user)));
1741 yumush.load_bans(window, cx);1750 yumush.load_bans(window, cx);
1742 yumush.request_authors(cx);1751 yumush.request_authors(cx);
1743 cx.notify();1752 cx.notify();
@@ -1956,6 +1965,7 @@ impl Yumush {
1956 1965
1957 let _ = this.update(cx, |yumush, cx| {1966 let _ = this.update(cx, |yumush, cx| {
1958 yumush.chat.voice.insert(community_id, participants);1967 yumush.chat.voice.insert(community_id, participants);
1968+ yumush.request_authors(cx);
1959 cx.notify();1969 cx.notify();
1960 });1970 });
1961 })1971 })
@@ -2005,6 +2015,7 @@ impl Yumush {
2005 muted || yumush.is_server_muted() || yumush.hidden_in(community_id);2015 muted || yumush.is_server_muted() || yumush.hidden_in(community_id);
2006 yumush.network.set_muted(muted);2016 yumush.network.set_muted(muted);
2007 yumush.chat.voice.insert(community_id, participants);2017 yumush.chat.voice.insert(community_id, participants);
2018+ yumush.request_authors(cx);
2008 yumush.load_shares(community_id, cx);2019 yumush.load_shares(community_id, cx);
2009 yumush.chat.voice_state = VoiceState::In {2020 yumush.chat.voice_state = VoiceState::In {
2010 community_id,2021 community_id,
@@ -2444,11 +2455,8 @@ impl Yumush {
2444 if users.is_empty() {2455 if users.is_empty() {
2445 return None;2456 return None;
2446 }2457 }
2447- let sharers: Vec<Id> = users2458+ let stage = self.stage_sources().len();
2448- .iter()2459+ let hidden = self.chat.stage_hidden;
2449- .filter(|user| self.chat.is_sharing(community_id, user.id))
2450- .map(|user| user.id)
2451- .collect();
2452 2460
2453 Some(2461 Some(
2454 div()2462 div()
@@ -2474,14 +2482,31 @@ impl Yumush {
2474 .when(index > 0, |this| this.ml(px(-6.))),2482 .when(index > 0, |this| this.ml(px(-6.))),
2475 )2483 )
2476 }))2484 }))
2477- .children(sharers.iter().map(|user_id| {2485+ .children(
2478- share_view::share_badge(2486+ (stage > 0 && self.chat.selected_community_id == self.chat.voice_community())
2479- entity,2487+ .then(|| {
2480- *user_id,2488+ clickable(
2481- self.chat.waves.share(*user_id),2489+ "stage_toggle",
2482- palette,2490+ palette,
2483- )2491+ entity_action(entity, |yumush: &mut Yumush, _, cx| {
2484- })),2492+ yumush.chat.stage_hidden = !yumush.chat.stage_hidden;
2493+ cx.notify();
2494+ }),
2495+ )
2496+ .tip(if hidden { "Show stage" } else { "Hide stage" })
2497+ .ml(px(8.))
2498+ .h(px(22.))
2499+ .px(px(6.))
2500+ .flex()
2501+ .items_center()
2502+ .gap(px(4.))
2503+ .rounded(px(6.))
2504+ .text_size(text(11.))
2505+ .text_color(if hidden { palette.muted } else { palette.accent })
2506+ .child(Icon::new(IconName::LayoutDashboard).w(px(14.)).h(px(14.)))
2507+ .child(stage.to_string())
2508+ }),
2509+ ),
2485 )2510 )
2486 }2511 }
2487 2512
crates/client/src/gui/share_view.rsmodified+47 -113
@@ -1,9 +1,9 @@
1 use common::model::Id;1 use common::model::Id;
2-use std::{collections::VecDeque, sync::Arc, time::Duration};2+use std::{sync::Arc, time::Duration};
3 3
4-use common::share::{Codec, Fps, Kind, Quality, Resolution, Source, options};4+use common::share::{Codec, Fps, Kind, Resolution, Source, options};
5 use gpui_kit::{5 use gpui_kit::{
6- Anchor, AnyElement, AppContext, Context, Div, Entity, FontWeight, InteractiveElement,6+ Anchor, AnyElement, AppContext, Context, Div, Entity, InteractiveElement,
7 IntoElement, MouseButton, ObjectFit, ParentElement, RenderImage, StatefulInteractiveElement,7 IntoElement, MouseButton, ObjectFit, ParentElement, RenderImage, StatefulInteractiveElement,
8 Styled, StyledImage, Subscription, Task, Window,8 Styled, StyledImage, Subscription, Task, Window,
9 assets::IconName,9 assets::IconName,
@@ -28,7 +28,7 @@ use super::{
28 widget::{icon_button, spawn_warn},28 widget::{icon_button, spawn_warn},
29 };29 };
30 use crate::{30 use crate::{
31- settings::{self, SHARE_QUALITY, ShareAudio, ShareCodec, ShareSettings},31+ settings::{self, ShareAudio, ShareCodec, ShareSettings},
32 share::{32 share::{
33 audio::{AudioApp, AudioKind},33 audio::{AudioApp, AudioKind},
34 encode::capabilities,34 encode::capabilities,
@@ -192,10 +192,6 @@ impl Yumush {
192 });192 });
193 }193 }
194 194
195- pub(super) fn set_share_watch(&mut self, watch: WatchQuality, cx: &mut Context<Self>) {
196- self.update_share(cx, |settings| settings.watch = watch);
197- }
198-
199 pub(super) fn is_watching(&self, user_id: Id, kind: Kind) -> bool {195 pub(super) fn is_watching(&self, user_id: Id, kind: Kind) -> bool {
200 self.chat196 self.chat
201 .viewer197 .viewer
@@ -203,6 +199,14 @@ impl Yumush {
203 .is_some_and(|viewer| viewer.user_id == user_id && viewer.kind == kind)199 .is_some_and(|viewer| viewer.user_id == user_id && viewer.kind == kind)
204 }200 }
205 201
202+ pub(super) fn viewer_frame(&self, user_id: Id, kind: Kind) -> Option<Arc<RenderImage>> {
203+ self.chat
204+ .viewer
205+ .as_ref()
206+ .filter(|viewer| viewer.user_id == user_id && viewer.kind == kind)
207+ .and_then(|viewer| viewer.frame.clone())
208+ }
209+
206 pub(super) fn viewing_camera(&self) -> Option<Id> {210 pub(super) fn viewing_camera(&self) -> Option<Id> {
207 self.chat211 self.chat
208 .viewer212 .viewer
@@ -261,7 +265,7 @@ impl Yumush {
261 });265 });
262 266
263 let network = self.network.clone();267 let network = self.network.clone();
264- let watch = self.settings.share.watch;268+ let watch = WatchQuality::Auto;
265 let volume = self.settings.share.volume;269 let volume = self.settings.share.volume;
266 let choice = self.settings.voice.choice.clone();270 let choice = self.settings.voice.choice.clone();
267 if kind == Kind::Camera && self.chat.cameras.contains_key(&user_id) {271 if kind == Kind::Camera && self.chat.cameras.contains_key(&user_id) {
@@ -405,7 +409,8 @@ impl Yumush {
405 .chat409 .chat
406 .viewer410 .viewer
407 .as_ref()411 .as_ref()
408- .filter(|viewer| !viewer.fullscreen)?;412+ .filter(|viewer| !viewer.fullscreen)
413+ .filter(|_| self.chat.selected_community_id == self.chat.voice_community())?;
409 Some(self.viewer_pane(viewer, entity, palette))414 Some(self.viewer_pane(viewer, entity, palette))
410 }415 }
411 416
@@ -422,21 +427,17 @@ impl Yumush {
422 )427 )
423 }428 }
424 429
425- fn share_top(&self, user_id: Id, kind: Kind) -> Quality {
426- self.chat
427- .voice_community()
428- .and_then(|community_id| self.chat.share_of(community_id, user_id, kind))
429- .map_or(SHARE_QUALITY, |share| share.source.top)
430- }
431-
432 fn viewer_pane(&self, viewer: &Viewer, entity: &Entity<Self>, palette: Palette) -> Div {430 fn viewer_pane(&self, viewer: &Viewer, entity: &Entity<Self>, palette: Palette) -> Div {
433 let (fullscreen_icon, fullscreen_tip) = if viewer.fullscreen {431 let (fullscreen_icon, fullscreen_tip) = if viewer.fullscreen {
434 (IconName::Minimize, "Exit fullscreen")432 (IconName::Minimize, "Exit fullscreen")
435 } else {433 } else {
436 (IconName::Maximize, "Fullscreen")434 (IconName::Maximize, "Fullscreen")
437 };435 };
438- let top = self.share_top(viewer.user_id, viewer.kind);
439 let audio = viewer.kind == Kind::Screen;436 let audio = viewer.kind == Kind::Screen;
437+ let name = self
438+ .chat
439+ .author(viewer.user_id)
440+ .map_or("Someone", |user| user.username.as_str());
440 441
441 div()442 div()
442 .flex_1()443 .flex_1()
@@ -454,6 +455,24 @@ impl Yumush {
454 div()455 div()
455 .absolute()456 .absolute()
456 .left(px(10.))457 .left(px(10.))
458+ .top(px(10.))
459+ .px(px(8.))
460+ .py(px(4.))
461+ .flex()
462+ .items_center()
463+ .gap(px(6.))
464+ .rounded(px(6.))
465+ .border_1()
466+ .border_color(palette.border)
467+ .bg(palette.panel)
468+ .occlude()
469+ .text_size(text(12.))
470+ .child(Icon::new(kind_icon(viewer.kind)).w(px(14.)).h(px(14.)))
471+ .child(name.to_string()),
472+ )
473+ .child(
474+ div()
475+ .absolute()
457 .right(px(10.))476 .right(px(10.))
458 .bottom(px(10.))477 .bottom(px(10.))
459 .p(px(6.))478 .p(px(6.))
@@ -466,13 +485,6 @@ impl Yumush {
466 .bg(palette.panel)485 .bg(palette.panel)
467 .occlude()486 .occlude()
468 .text_size(text(12.))487 .text_size(text(12.))
469- .child(quality_chips(
470- entity,
471- self.settings.share.watch,
472- top,
473- palette,
474- ))
475- .child(div().flex_1())
476 .children(488 .children(
477 audio489 audio
478 .then(|| {490 .then(|| {
@@ -490,7 +502,11 @@ impl Yumush {
490 .text_color(palette.muted)502 .text_color(palette.muted)
491 }))503 }))
492 .children(504 .children(
493- audio.then(|| Slider::new(&viewer.volume).bg(palette.muted).w(px(80.))),505+ audio.then(|| {
506+ div()
507+ .w(px(100.))
508+ .child(Slider::new(&viewer.volume).bg(palette.muted))
509+ }),
494 )510 )
495 .child(icon_button(511 .child(icon_button(
496 "share_fullscreen".to_string(),512 "share_fullscreen".to_string(),
@@ -510,95 +526,13 @@ impl Yumush {
510 }526 }
511 }527 }
512 528
513-fn quality_chips(529+pub(super) fn kind_icon(kind: Kind) -> IconName {
514- entity: &Entity<Yumush>,530+ match kind {
515- watch: WatchQuality,531+ Kind::Screen => IconName::ScreenShare,
516- top: Quality,532+ Kind::Camera => IconName::Video,
517- palette: Palette,
518-) -> Div {
519- let fps = match watch {
520- WatchQuality::Auto => top.fps,
521- WatchQuality::Fixed(quality) => quality.fps,
522- };
523- let resolutions = std::iter::once((WatchQuality::Auto, "Auto")).chain(
524- RESOLUTIONS
525- .into_iter()
526- .filter(|(resolution, _)| resolution.height() <= top.resolution.height())
527- .map(|(resolution, label)| (WatchQuality::Fixed(Quality { resolution, fps }), label)),
528- );
529- let row = div().flex().items_center().gap(px(6.)).child(segmented(
530- resolutions,
531- watch,
532- entity,
533- palette,
534- Yumush::set_share_watch,
535- ));
536-
537- match watch {
538- WatchQuality::Auto => row,
539- WatchQuality::Fixed(quality) => {
540- let fps = FPS
541- .into_iter()
542- .filter(|(fps, _)| fps.value() <= top.fps.value())
543- .map(|(fps, label)| {
544- (
545- WatchQuality::Fixed(Quality {
546- resolution: quality.resolution,
547- fps,
548- }),
549- label,
550- )
551- });
552- row.child(segmented(
553- fps,
554- watch,
555- entity,
556- palette,
557- Yumush::set_share_watch,
558- ))
559- }
560 }533 }
561 }534 }
562 535
563-pub(super) fn share_badge(
564- entity: &Entity<Yumush>,
565- user_id: Id,
566- sound: Option<&VecDeque<f32>>,
567- palette: Palette,
568-) -> impl IntoElement {
569- let entity = entity.clone();
570-
571- clickable(
572- format!("share_badge_{user_id}"),
573- palette,
574- move |window, cx| {
575- entity.update(cx, |yumush, cx| {
576- yumush.toggle_viewer(user_id, Kind::Screen, window, cx)
577- });
578- },
579- )
580- .tip("Watch")
581- .ml(px(6.))
582- .h(px(18.))
583- .px(px(5.))
584- .flex()
585- .items_center()
586- .gap(px(3.))
587- .rounded(px(4.))
588- .bg(palette.alert)
589- .text_color(palette.on_accent)
590- .text_size(text(10.))
591- .font_weight(FontWeight::SEMIBOLD)
592- .child(match sound {
593- Some(history) => wave(history, 10., palette.on_accent).into_any_element(),
594- None => Icon::new(IconName::ScreenShare)
595- .w(px(10.))
596- .h(px(10.))
597- .into_any_element(),
598- })
599- .child("Live")
600-}
601-
602 fn settings_card(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) -> Div {536 fn settings_card(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) -> Div {
603 let settings = &yumush.settings.share;537 let settings = &yumush.settings.share;
604 let (resolutions, fps) = share_limits(yumush.network.share_source());538 let (resolutions, fps) = share_limits(yumush.network.share_source());
@@ -690,7 +624,7 @@ fn audio_list(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) -> Opt
690 apps.into_iter()624 apps.into_iter()
691 .map(|app| exclude_row(entity, settings, app)),625 .map(|app| exclude_row(entity, settings, app)),
692 );626 );
693- field("Exclude", app_list(rows), palette).into_any_element()627+ field("Include", app_list(rows), palette).into_any_element()
694 })628 })
695 }629 }
696 ShareAudio::Source(selected) => Some(630 ShareAudio::Source(selected) => Some(
crates/client/src/gui/sidebar.rsmodified+12 -4
@@ -3,6 +3,7 @@ use common::model::Id;
3 use common::{3 use common::{
4 model::{Community, CommunityKind, Invitation, Role, Unread, User},4 model::{Community, CommunityKind, Invitation, Role, Unread, User},
5 permission,5 permission,
6+ share::Kind,
6 validate::validate_community_name,7 validate::validate_community_name,
7 };8 };
8 use gpui_kit::{9 use gpui_kit::{
@@ -236,8 +237,8 @@ impl Yumush {
236 palette: Palette,237 palette: Palette,
237 ) -> impl IntoElement {238 ) -> impl IntoElement {
238 let speaking = self.chat.waves.speaking.contains(&user.id);239 let speaking = self.chat.waves.speaking.contains(&user.id);
239- let share = self.chat.waves.share(user.id);240+ let screen = self.chat.share_of(community_id, user.id, Kind::Screen).is_some();
240- let sharing = share.is_none() && self.chat.is_sharing(community_id, user.id);241+ let camera = self.chat.share_of(community_id, user.id, Kind::Camera).is_some();
241 242
242 profile_popover(243 profile_popover(
243 format!("voice_member_{}", user.id),244 format!("voice_member_{}", user.id),
@@ -271,7 +272,7 @@ impl Yumush {
271 .text_color(palette.text)272 .text_color(palette.text)
272 .child(user.username.clone()),273 .child(user.username.clone()),
273 )274 )
274- .when(sharing, |row| {275+ .when(screen, |row| {
275 row.child(276 row.child(
276 Icon::new(IconName::ScreenShare)277 Icon::new(IconName::ScreenShare)
277 .w(px(12.))278 .w(px(12.))
@@ -279,7 +280,14 @@ impl Yumush {
279 .text_color(palette.alert),280 .text_color(palette.alert),
280 )281 )
281 })282 })
282- .children(share.map(|history| wave(history, 12., palette.alert)))283+ .when(camera, |row| {
284+ row.child(
285+ Icon::new(IconName::Video)
286+ .w(px(12.))
287+ .h(px(12.))
288+ .text_color(palette.alert),
289+ )
290+ })
283 .children(291 .children(
284 self.chat292 self.chat
285 .waves293 .waves
crates/client/src/net/media.rsmodified+0 -1
@@ -673,7 +673,6 @@ impl NetworkHandle {
673 for ((_, kind), watching) in self.media().lock().watching.iter_mut() {673 for ((_, kind), watching) in self.media().lock().watching.iter_mut() {
674 if *kind == Kind::Screen {674 if *kind == Kind::Screen {
675 watching.set_volume(settings.volume);675 watching.set_volume(settings.volume);
676- watching.set_quality(settings.watch);
677 }676 }
678 }677 }
679 }678 }
crates/client/src/settings.rsmodified+1 -11
@@ -14,7 +14,7 @@ use gpui_kit::{
14 14
15 use crate::{15 use crate::{
16 read_config,16 read_config,
17- share::{audio::AudioMode, encode::capabilities, session::WatchQuality},17+ share::{audio::AudioMode, encode::capabilities},
18 voice::audio::Choice,18 voice::audio::Choice,
19 write_config,19 write_config,
20 };20 };
@@ -145,7 +145,6 @@ pub struct ShareSettings {
145 pub codec: ShareCodec,145 pub codec: ShareCodec,
146 pub audio: ShareAudio,146 pub audio: ShareAudio,
147 pub excluded: Vec<String>,147 pub excluded: Vec<String>,
148- pub watch: WatchQuality,
149 pub volume: f32,148 pub volume: f32,
150 }149 }
151 150
@@ -156,7 +155,6 @@ impl Default for ShareSettings {
156 codec: ShareCodec::Auto,155 codec: ShareCodec::Auto,
157 audio: ShareAudio::Everything,156 audio: ShareAudio::Everything,
158 excluded: Vec::new(),157 excluded: Vec::new(),
159- watch: WatchQuality::Auto,
160 volume: 100.0,158 volume: 100.0,
161 }159 }
162 }160 }
@@ -293,9 +291,6 @@ pub fn load() -> Settings {
293 excluded: text("share.excluded")291 excluded: text("share.excluded")
294 .map(|value| value.split('\t').map(str::to_string).collect())292 .map(|value| value.split('\t').map(str::to_string).collect())
295 .unwrap_or_default(),293 .unwrap_or_default(),
296- watch: text("share.watch")
297- .and_then(|value| parse_quality(&value))
298- .map_or(WatchQuality::Auto, WatchQuality::Fixed),
299 volume: number("share.volume", defaults.share.volume, &VOLUME),294 volume: number("share.volume", defaults.share.volume, &VOLUME),
300 };295 };
301 296
@@ -325,10 +320,6 @@ pub fn save(settings: &Settings) {
325 ShareAudio::Everything => ("everything", ""),320 ShareAudio::Everything => ("everything", ""),
326 ShareAudio::Source(name) => ("source", name.as_str()),321 ShareAudio::Source(name) => ("source", name.as_str()),
327 };322 };
328- let watch = match share.watch {
329- WatchQuality::Auto => "auto".to_string(),
330- WatchQuality::Fixed(quality) => quality_text(quality),
331- };
332 let content = [323 let content = [
333 line("theme", settings.theme.as_str()),324 line("theme", settings.theme.as_str()),
334 line("font_size", settings.font_size.as_str()),325 line("font_size", settings.font_size.as_str()),
@@ -367,7 +358,6 @@ pub fn save(settings: &Settings) {
367 line("share.audio", audio),358 line("share.audio", audio),
368 line("share.audio_source", source),359 line("share.audio_source", source),
369 line("share.excluded", share.excluded.join("\t")),360 line("share.excluded", share.excluded.join("\t")),
370- line("share.watch", watch),
371 line("share.volume", share.volume),361 line("share.volume", share.volume),
372 ]362 ]
373 .concat();363 .concat();