Render microphone toggle
This commit is contained in:
parent
bee6c59154
commit
b16b6dcec7
3 changed files with 60 additions and 3 deletions
4
assets/icons/microphone_active_12.svg
Normal file
4
assets/icons/microphone_active_12.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg width="15" height="16" viewBox="0 0 15 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.72742 9.33338C3.63539 9.07302 3.34973 8.93656 3.08937 9.02858C2.82901 9.1206 2.69255 9.40626 2.78458 9.66662C2.86101 9.88288 2.95188 10.0923 3.056 10.2936C3.81427 11.7601 5.27842 12.8044 7.00014 12.9753L7.00014 14.5L5.50014 14.5C5.22399 14.5 5.00014 14.7239 5.00014 15C5.00014 15.2761 5.22399 15.5 5.50014 15.5L7.50014 15.5L9.50014 15.5C9.77628 15.5 10.0001 15.2761 10.0001 15C10.0001 14.7239 9.77628 14.5 9.50014 14.5L8.00014 14.5L8.00014 12.9753C9.72168 12.8043 11.1857 11.76 11.9439 10.2936C12.048 10.0923 12.1389 9.88288 12.2153 9.66662C12.3073 9.40626 12.1709 9.1206 11.9105 9.02858C11.6501 8.93656 11.3645 9.07302 11.2725 9.33338C11.2114 9.50607 11.1388 9.67337 11.0556 9.83433C10.3899 11.1218 9.04706 12 7.49994 12C5.95282 12 4.60997 11.1218 3.94428 9.83433C3.86104 9.67337 3.78845 9.50607 3.72742 9.33338ZM5.5 4L5.5 8C5.5 9.10457 6.39543 10 7.5 10C8.60457 10 9.5 9.10457 9.5 8L9.5 4C9.5 2.89543 8.60457 2 7.5 2C6.39543 2 5.5 2.89543 5.5 4ZM4.5 8C4.5 9.65685 5.84315 11 7.5 11C9.15685 11 10.5 9.65685 10.5 8L10.5 4C10.5 2.34315 9.15685 1 7.5 1C5.84315 1 4.5 2.34315 4.5 4L4.5 8Z" fill="#CCCAC2"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
5
assets/icons/microphone_inactive_12.svg
Normal file
5
assets/icons/microphone_inactive_12.svg
Normal file
|
@ -0,0 +1,5 @@
|
|||
<svg width="15" height="16" viewBox="0 0 15 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.72742 9.33338C3.63539 9.07302 3.34973 8.93656 3.08937 9.02858C2.82901 9.1206 2.69255 9.40626 2.78458 9.66662C2.86101 9.88288 2.95188 10.0923 3.056 10.2936C3.81427 11.7601 5.27842 12.8044 7.00014 12.9753L7.00014 14.5L5.50014 14.5C5.22399 14.5 5.00014 14.7239 5.00014 15C5.00014 15.2761 5.22399 15.5 5.50014 15.5L7.50014 15.5L9.50014 15.5C9.77628 15.5 10.0001 15.2761 10.0001 15C10.0001 14.7239 9.77628 14.5 9.50014 14.5L8.00014 14.5L8.00014 12.9753C9.72168 12.8043 11.1857 11.76 11.9439 10.2936C12.048 10.0923 12.1389 9.88288 12.2153 9.66662C12.3073 9.40626 12.1709 9.1206 11.9105 9.02858C11.6501 8.93656 11.3645 9.07302 11.2725 9.33338C11.2114 9.50607 11.1388 9.67337 11.0556 9.83433C10.3899 11.1218 9.04706 12 7.49994 12C5.95282 12 4.60997 11.1218 3.94428 9.83433C3.86104 9.67337 3.78845 9.50607 3.72742 9.33338ZM5.5 4L5.5 8C5.5 9.10457 6.39543 10 7.5 10C8.60457 10 9.5 9.10457 9.5 8L9.5 4C9.5 2.89543 8.60457 2 7.5 2C6.39543 2 5.5 2.89543 5.5 4ZM4.5 8C4.5 9.65685 5.84315 11 7.5 11C9.15685 11 10.5 9.65685 10.5 8L10.5 4C10.5 2.34315 9.15685 1 7.5 1C5.84315 1 4.5 2.34315 4.5 4L4.5 8Z" fill="#F18779"/>
|
||||
<path d="M12.5 2.00003L2.5 13" stroke="#F18779" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
contact_notification::ContactNotification, contacts_popover, face_pile::FacePile,
|
||||
toggle_screen_sharing, ToggleScreenSharing,
|
||||
contact_notification::ContactNotification, contacts_popover, face_pile::FacePile, toggle_mute,
|
||||
toggle_screen_sharing, ToggleMute, ToggleScreenSharing,
|
||||
};
|
||||
use call::{ActiveCall, ParticipantLocation, Room};
|
||||
use client::{proto::PeerId, Client, ContactEventKind, SignIn, SignOut, User, UserStore};
|
||||
|
@ -88,6 +88,7 @@ impl View for CollabTitlebarItem {
|
|||
left_container
|
||||
.add_child(self.render_current_user(&workspace, &theme, &user, peer_id, cx));
|
||||
left_container.add_children(self.render_collaborators(&workspace, &theme, &room, cx));
|
||||
right_container.add_child(self.render_toggle_microphone(&theme, &room, cx));
|
||||
right_container.add_child(self.render_toggle_screen_sharing_button(&theme, &room, cx));
|
||||
}
|
||||
|
||||
|
@ -396,7 +397,6 @@ impl CollabTitlebarItem {
|
|||
.with_children(self.render_contacts_popover_host(titlebar, cx))
|
||||
.into_any()
|
||||
}
|
||||
|
||||
fn render_toggle_screen_sharing_button(
|
||||
&self,
|
||||
theme: &Theme,
|
||||
|
@ -441,6 +441,54 @@ impl CollabTitlebarItem {
|
|||
.aligned()
|
||||
.into_any()
|
||||
}
|
||||
fn render_toggle_microphone(
|
||||
&self,
|
||||
theme: &Theme,
|
||||
room: &ModelHandle<Room>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> AnyElement<Self> {
|
||||
let icon;
|
||||
let tooltip;
|
||||
let background;
|
||||
if room.read(cx).is_muted().unwrap_or(false) {
|
||||
icon = "icons/microphone_inactive_12.svg";
|
||||
tooltip = "Unmute microphone\nRight click for options";
|
||||
background = Color::red();
|
||||
} else {
|
||||
icon = "icons/microphone_active_12.svg";
|
||||
tooltip = "Mute microphone\nRight click for options";
|
||||
background = Color::transparent_black();
|
||||
}
|
||||
|
||||
let titlebar = &theme.workspace.titlebar;
|
||||
MouseEventHandler::<ToggleMute, Self>::new(0, cx, |state, _| {
|
||||
let style = titlebar.call_control.style_for(state);
|
||||
Svg::new(icon)
|
||||
.with_color(style.color)
|
||||
.constrained()
|
||||
.with_width(style.icon_width)
|
||||
.aligned()
|
||||
.constrained()
|
||||
.with_width(style.button_width)
|
||||
.with_height(style.button_width)
|
||||
.contained()
|
||||
.with_style(style.container)
|
||||
.with_background_color(background)
|
||||
})
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
.on_click(MouseButton::Left, move |_, _, cx| {
|
||||
toggle_mute(&Default::default(), cx)
|
||||
})
|
||||
.with_tooltip::<ToggleMute>(
|
||||
0,
|
||||
tooltip.into(),
|
||||
Some(Box::new(ToggleMute)),
|
||||
theme.tooltip.clone(),
|
||||
cx,
|
||||
)
|
||||
.aligned()
|
||||
.into_any()
|
||||
}
|
||||
|
||||
fn render_in_call_share_unshare_button(
|
||||
&self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue