From 369d0c79d7272b4059c39ecedb10a62121bfbe56 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sat, 12 Feb 2022 14:35:44 +0100 Subject: Calls: Fix device selector for multi-party calls, allow picking device before call started --- .../src/ui/call_window/audio_settings_popover.vala | 24 +++++++++++++--------- .../src/ui/call_window/call_window_controller.vala | 12 ++++------- .../src/ui/call_window/video_settings_popover.vala | 12 ++++++----- 3 files changed, 25 insertions(+), 23 deletions(-) (limited to 'main/src/ui') diff --git a/main/src/ui/call_window/audio_settings_popover.vala b/main/src/ui/call_window/audio_settings_popover.vala index 3b5dff3f..f7e490cd 100644 --- a/main/src/ui/call_window/audio_settings_popover.vala +++ b/main/src/ui/call_window/audio_settings_popover.vala @@ -37,10 +37,6 @@ public class Dino.Ui.AudioSettingsPopover : Gtk.Popover { micro_frame.add(micro_list_box); foreach (Plugins.MediaDevice device in devices) { Label display_name_label = new Label(device.display_name) { xalign=0, visible=true }; - Label detail_name_label = new Label(device.detail_name) { xalign=0, visible=true }; - detail_name_label.get_style_context().add_class("dim-label"); - detail_name_label.attributes = new Pango.AttrList(); - detail_name_label.attributes.insert(Pango.attr_scale_new(0.8)); Image image = new Image.from_icon_name("object-select-symbolic", IconSize.BUTTON) { visible=true }; if (current_microphone_device == null || current_microphone_device.id != device.id) { image.opacity = 0; @@ -56,7 +52,13 @@ public class Dino.Ui.AudioSettingsPopover : Gtk.Popover { device_box.add(image); Box label_box = new Box(Orientation.VERTICAL, 0) { visible = true }; label_box.add(display_name_label); - label_box.add(detail_name_label); + if (device.detail_name != null) { + Label detail_name_label = new Label(device.detail_name) { xalign=0, visible=true }; + detail_name_label.get_style_context().add_class("dim-label"); + detail_name_label.attributes = new Pango.AttrList(); + detail_name_label.attributes.insert(Pango.attr_scale_new(0.8)); + label_box.add(detail_name_label); + } device_box.add(label_box); ListBoxRow list_box_row = new ListBoxRow() { visible=true }; list_box_row.add(device_box); @@ -94,10 +96,6 @@ public class Dino.Ui.AudioSettingsPopover : Gtk.Popover { speaker_frame.add(speaker_list_box); foreach (Plugins.MediaDevice device in devices) { Label display_name_label = new Label(device.display_name) { xalign=0, visible=true }; - Label detail_name_label = new Label(device.detail_name) { xalign=0, visible=true }; - detail_name_label.get_style_context().add_class("dim-label"); - detail_name_label.attributes = new Pango.AttrList(); - detail_name_label.attributes.insert(Pango.attr_scale_new(0.8)); Image image = new Image.from_icon_name("object-select-symbolic", IconSize.BUTTON) { visible=true }; if (current_speaker_device == null || current_speaker_device.id != device.id) { image.opacity = 0; @@ -113,7 +111,13 @@ public class Dino.Ui.AudioSettingsPopover : Gtk.Popover { device_box.add(image); Box label_box = new Box(Orientation.VERTICAL, 0) { visible = true }; label_box.add(display_name_label); - label_box.add(detail_name_label); + if (device.detail_name != null) { + Label detail_name_label = new Label(device.detail_name) { xalign=0, visible=true }; + detail_name_label.get_style_context().add_class("dim-label"); + detail_name_label.attributes = new Pango.AttrList(); + detail_name_label.attributes.insert(Pango.attr_scale_new(0.8)); + label_box.add(detail_name_label); + } device_box.add(label_box); ListBoxRow list_box_row = new ListBoxRow() { visible=true }; list_box_row.add(device_box); diff --git a/main/src/ui/call_window/call_window_controller.vala b/main/src/ui/call_window/call_window_controller.vala index 445f88ea..e929aedc 100644 --- a/main/src/ui/call_window/call_window_controller.vala +++ b/main/src/ui/call_window/call_window_controller.vala @@ -115,6 +115,9 @@ public class Dino.Ui.CallWindowController : Object { call_window.menu_dump_dot.connect(() => { call_plugin.dump_dot(); }); update_own_video(); + + update_audio_device_choices(); + update_video_device_choices(); } private void invite_button_clicked() { @@ -135,13 +138,6 @@ public class Dino.Ui.CallWindowController : Object { Jid peer_jid = peer_state.jid; peer_states[peer_id] = peer_state; - peer_state.stream_created.connect((media) => { - if (media == "audio") { - update_audio_device_choices(); - } else if (media == "video") { - update_video_device_choices(); - } - }); peer_state.connection_ready.connect(() => { call_window.set_status(peer_state.internal_id, ""); if (participant_widgets.size == 1) { @@ -331,7 +327,7 @@ public class Dino.Ui.CallWindowController : Object { } else { Widget widget = (Widget) own_video; call_window.set_own_video(widget); - own_video.display_device(devices.first()); + own_video.display_device(call_state.get_video_device()); } } else { own_video.detach(); diff --git a/main/src/ui/call_window/video_settings_popover.vala b/main/src/ui/call_window/video_settings_popover.vala index 48ab3cab..7dd5ec9f 100644 --- a/main/src/ui/call_window/video_settings_popover.vala +++ b/main/src/ui/call_window/video_settings_popover.vala @@ -33,10 +33,6 @@ public class Dino.Ui.VideoSettingsPopover : Gtk.Popover { frame.add(list_box); foreach (Plugins.MediaDevice device in devices) { Label display_name_label = new Label(device.display_name) { xalign=0, visible=true }; - Label detail_name_label = new Label(device.detail_name) { xalign=0, visible=true }; - detail_name_label.get_style_context().add_class("dim-label"); - detail_name_label.attributes = new Pango.AttrList(); - detail_name_label.attributes.insert(Pango.attr_scale_new(0.8)); Image image = new Image.from_icon_name("object-select-symbolic", IconSize.BUTTON) { visible=true }; if (current_device == null || current_device.id != device.id) { image.opacity = 0; @@ -52,7 +48,13 @@ public class Dino.Ui.VideoSettingsPopover : Gtk.Popover { device_box.add(image); Box label_box = new Box(Orientation.VERTICAL, 0) { visible = true }; label_box.add(display_name_label); - label_box.add(detail_name_label); + if (device.detail_name != null) { + Label detail_name_label = new Label(device.detail_name) { xalign=0, visible=true }; + detail_name_label.get_style_context().add_class("dim-label"); + detail_name_label.attributes = new Pango.AttrList(); + detail_name_label.attributes.insert(Pango.attr_scale_new(0.8)); + label_box.add(detail_name_label); + } device_box.add(label_box); ListBoxRow list_box_row = new ListBoxRow() { visible=true }; list_box_row.add(device_box); -- cgit v1.2.3-70-g09d2