From 43ea088f646a8b3a5c41699f48cf5f0b4e7d4107 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Tue, 8 Feb 2022 21:57:48 +0100 Subject: Calls: Device picker --- .../src/ui/call_window/audio_settings_popover.vala | 30 ++++++++++++++++------ .../src/ui/call_window/call_window_controller.vala | 20 ++------------- .../src/ui/call_window/video_settings_popover.vala | 15 ++++++++--- 3 files changed, 35 insertions(+), 30 deletions(-) (limited to 'main') diff --git a/main/src/ui/call_window/audio_settings_popover.vala b/main/src/ui/call_window/audio_settings_popover.vala index feb84f32..f13f346b 100644 --- a/main/src/ui/call_window/audio_settings_popover.vala +++ b/main/src/ui/call_window/audio_settings_popover.vala @@ -26,17 +26,21 @@ public class Dino.Ui.AudioSettingsPopover : Gtk.Popover { Gee.List devices = call_plugin.get_devices("audio", false); Box micro_box = new Box(Orientation.VERTICAL, 10) { visible=true }; - micro_box.add(new Label("" + "Microphones" + "") { use_markup=true, xalign=0, visible=true, can_focus=true /* grab initial focus*/ }); + micro_box.add(new Label("" + _("Microphones") + "") { use_markup=true, xalign=0, visible=true, can_focus=true /* grab initial focus*/ }); if (devices.size == 0) { - micro_box.add(new Label("No microphones found.")); + micro_box.add(new Label(_("No microphones found."))); } else { ListBox micro_list_box = new ListBox() { activate_on_single_click=true, selection_mode=SelectionMode.SINGLE, visible=true }; micro_list_box.set_header_func(listbox_header_func); Frame micro_frame = new Frame(null) { visible=true }; micro_frame.add(micro_list_box); foreach (Plugins.MediaDevice device in devices) { - Label label = new Label(device.display_name) { xalign=0, visible=true }; + 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; @@ -50,7 +54,10 @@ public class Dino.Ui.AudioSettingsPopover : Gtk.Popover { }); Box device_box = new Box(Orientation.HORIZONTAL, 0) { spacing=7, margin=7, visible=true }; device_box.add(image); - device_box.add(label); + Box label_box = new Box(Orientation.VERTICAL, 0) { visible = true }; + label_box.add(display_name_label); + 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); micro_list_box.add(list_box_row); @@ -73,10 +80,10 @@ public class Dino.Ui.AudioSettingsPopover : Gtk.Popover { Gee.List devices = call_plugin.get_devices("audio", true); Box speaker_box = new Box(Orientation.VERTICAL, 10) { visible=true }; - speaker_box.add(new Label("" + "Speakers" +"") { use_markup=true, xalign=0, visible=true }); + speaker_box.add(new Label("" + _("Speakers") +"") { use_markup=true, xalign=0, visible=true }); if (devices.size == 0) { - speaker_box.add(new Label("No speakers found.")); + speaker_box.add(new Label(_("No speakers found."))); } else { ListBox speaker_list_box = new ListBox() { activate_on_single_click=true, selection_mode=SelectionMode.SINGLE, visible=true }; speaker_list_box.set_header_func(listbox_header_func); @@ -86,7 +93,11 @@ public class Dino.Ui.AudioSettingsPopover : Gtk.Popover { Frame speaker_frame = new Frame(null) { visible=true }; speaker_frame.add(speaker_list_box); foreach (Plugins.MediaDevice device in devices) { - Label label = new Label(device.display_name) { xalign=0, visible=true }; + 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; @@ -100,7 +111,10 @@ public class Dino.Ui.AudioSettingsPopover : Gtk.Popover { }); Box device_box = new Box(Orientation.HORIZONTAL, 0) { spacing=7, margin=7, visible=true }; device_box.add(image); - device_box.add(label); + Box label_box = new Box(Orientation.VERTICAL, 0) { visible = true }; + label_box.add(display_name_label); + 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); speaker_list_box.add(list_box_row); diff --git a/main/src/ui/call_window/call_window_controller.vala b/main/src/ui/call_window/call_window_controller.vala index 94d6e890..e482e3aa 100644 --- a/main/src/ui/call_window/call_window_controller.vala +++ b/main/src/ui/call_window/call_window_controller.vala @@ -271,12 +271,9 @@ public class Dino.Ui.CallWindowController : Object { private void update_audio_device_choices() { if (call_plugin.get_devices("audio", true).size == 0 || call_plugin.get_devices("audio", false).size == 0) { call_window.bottom_bar.show_audio_device_error(); - } /*else if (call_plugin.get_devices("audio", true).size == 1 && call_plugin.get_devices("audio", false).size == 1) { + } else if (call_plugin.get_devices("audio", true).size == 1 && call_plugin.get_devices("audio", false).size == 1) { call_window.bottom_bar.show_audio_device_choices(false); return; - }*/ else { - call_window.bottom_bar.show_video_device_choices(false); - return; } AudioSettingsPopover? audio_settings_popover = call_window.bottom_bar.show_audio_device_choices(true); @@ -290,11 +287,6 @@ public class Dino.Ui.CallWindowController : Object { call_state.set_audio_device(device); update_current_audio_device(audio_settings_popover); }); -// calls.stream_created.connect((call, media) => { -// if (media == "audio") { -// update_current_audio_device(audio_settings_popover); -// } -// }); } private void update_current_audio_device(AudioSettingsPopover audio_settings_popover) { @@ -307,10 +299,7 @@ public class Dino.Ui.CallWindowController : Object { if (device_count == 0) { call_window.bottom_bar.show_video_device_error(); - } /*else if (device_count == 1 || call_state.get_video_device() == null) { - call_window.bottom_bar.show_video_device_choices(false); - return; - }*/ else { + } else if (device_count == 1 || call_state.get_video_device() == null) { call_window.bottom_bar.show_video_device_choices(false); return; } @@ -323,11 +312,6 @@ public class Dino.Ui.CallWindowController : Object { update_current_video_device(video_settings_popover); own_video.display_device(device); }); -// call_state.stream_created.connect((call, media) => { -// if (media == "video") { -// update_current_video_device(video_settings_popover); -// } -// }); } private void update_current_video_device(VideoSettingsPopover video_settings_popover) { diff --git a/main/src/ui/call_window/video_settings_popover.vala b/main/src/ui/call_window/video_settings_popover.vala index 332bd917..553fc270 100644 --- a/main/src/ui/call_window/video_settings_popover.vala +++ b/main/src/ui/call_window/video_settings_popover.vala @@ -22,17 +22,21 @@ public class Dino.Ui.VideoSettingsPopover : Gtk.Popover { Gee.List devices = call_plugin.get_devices("video", false); Box camera_box = new Box(Orientation.VERTICAL, 10) { visible=true }; - camera_box.add(new Label("" + "Cameras" + "") { use_markup=true, xalign=0, visible=true, can_focus=true /* grab initial focus*/ }); + camera_box.add(new Label("" + _("Cameras") + "") { use_markup=true, xalign=0, visible=true, can_focus=true /* grab initial focus*/ }); if (devices.size == 0) { - camera_box.add(new Label("No cameras found.") { visible=true }); + camera_box.add(new Label(_("No cameras found.")) { visible=true }); } else { ListBox list_box = new ListBox() { activate_on_single_click=true, selection_mode=SelectionMode.SINGLE, visible=true }; list_box.set_header_func(listbox_header_func); Frame frame = new Frame(null) { visible=true }; frame.add(list_box); foreach (Plugins.MediaDevice device in devices) { - Label label = new Label(device.display_name) { xalign=0, visible=true }; + 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; @@ -46,7 +50,10 @@ public class Dino.Ui.VideoSettingsPopover : Gtk.Popover { }); Box device_box = new Box(Orientation.HORIZONTAL, 0) { spacing=7, margin=7, visible=true }; device_box.add(image); - device_box.add(label); + Box label_box = new Box(Orientation.VERTICAL, 0) { visible = true }; + label_box.add(display_name_label); + 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); list_box.add(list_box_row); -- cgit v1.2.3-70-g09d2