From 3dc4d7f1558bb574eb99dade9a05727604e2e2ca Mon Sep 17 00:00:00 2001 From: fiaxh Date: Thu, 4 Nov 2021 17:35:11 +0100 Subject: Add (disabled) multi-party call UI --- .../call_connection_details_window.vala | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 main/src/ui/call_window/call_connection_details_window.vala (limited to 'main/src/ui/call_window/call_connection_details_window.vala') diff --git a/main/src/ui/call_window/call_connection_details_window.vala b/main/src/ui/call_window/call_connection_details_window.vala new file mode 100644 index 00000000..b292b971 --- /dev/null +++ b/main/src/ui/call_window/call_connection_details_window.vala @@ -0,0 +1,84 @@ +using Gtk; + +namespace Dino.Ui { + + public class CallConnectionDetailsWindow : Gtk.Window { + + public Grid grid = new Grid() { column_spacing=5, margin=10, halign=Align.CENTER, valign=Align.CENTER, visible=true }; + + public Label audio_rtp_ready = new Label("?") { xalign=0, visible=true }; + public Label audio_rtcp_ready = new Label("?") { xalign=0, visible=true }; + public Label audio_sent_bps = new Label("?") { xalign=0, visible=true }; + public Label audio_recv_bps = new Label("?") { xalign=0, visible=true }; + public Label audio_codec = new Label("?") { xalign=0, visible=true }; + + public Label video_rtp_ready = new Label("") { xalign=0, visible=true }; + public Label video_rtcp_ready = new Label("") { xalign=0, visible=true }; + public Label video_sent_bps = new Label("") { xalign=0, visible=true }; + public Label video_recv_bps = new Label("") { xalign=0, visible=true }; + public Label video_codec = new Label("") { xalign=0, visible=true }; + + private int row_at = 0; + private bool video_added = false; + private PeerInfo? prev_peer_info = null; + + public CallConnectionDetailsWindow() { + grid.attach(new Label("Audio") { use_markup=true, xalign=0, visible=true }, 0, row_at++, 1, 1); + put_row("RTP"); + grid.attach(audio_rtp_ready, 1, row_at++, 1, 1); + put_row("RTCP"); + grid.attach(audio_rtcp_ready, 1, row_at++, 1, 1); + put_row("Sent bp/s"); + grid.attach(audio_sent_bps, 1, row_at++, 1, 1); + put_row("Received bp/s"); + grid.attach(audio_recv_bps, 1, row_at++, 1, 1); + put_row("Codec"); + grid.attach(audio_codec, 1, row_at++, 1, 1); + + this.child = grid; + } + + private void put_row(string label) { + grid.attach(new Label(label) { xalign=0, visible=true }, 0, row_at, 1, 1); + } + + public void update_content(PeerInfo peer_info) { + audio_rtp_ready.label = peer_info.audio_rtp_ready.to_string(); + audio_rtcp_ready.label = peer_info.audio_rtcp_ready.to_string(); + audio_codec.label = peer_info.audio_codec + " " + peer_info.audio_clockrate.to_string(); + + video_rtp_ready.label = peer_info.video_rtp_ready.to_string(); + video_rtcp_ready.label = peer_info.video_rtcp_ready.to_string(); + video_codec.label = peer_info.video_codec; + + if (peer_info.video_content_exists) add_video_widgets(); + + if (prev_peer_info != null) { + audio_sent_bps.label = (peer_info.audio_bytes_sent - prev_peer_info.audio_bytes_sent).to_string(); + audio_recv_bps.label = (peer_info.audio_bytes_received - prev_peer_info.audio_bytes_received).to_string(); + video_sent_bps.label = (peer_info.video_bytes_sent - prev_peer_info.video_bytes_sent).to_string(); + video_recv_bps.label = (peer_info.video_bytes_received - prev_peer_info.video_bytes_received).to_string(); + } + prev_peer_info = peer_info; + } + + private void add_video_widgets() { + if (video_added) return; + + grid.attach(new Label("Video") { use_markup=true, xalign=0, visible=true }, 0, row_at++, 1, 1); + put_row("RTP"); + grid.attach(video_rtp_ready, 1, row_at++, 1, 1); + put_row("RTCP"); + grid.attach(video_rtcp_ready, 1, row_at++, 1, 1); + put_row("Sent bp/s"); + grid.attach(video_sent_bps, 1, row_at++, 1, 1); + put_row("Received bp/s"); + grid.attach(video_recv_bps, 1, row_at++, 1, 1); + put_row("Codec"); + grid.attach(video_codec, 1, row_at++, 1, 1); + + video_added = true; + } + } +} + -- cgit v1.2.3-54-g00ecf