aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/call_window
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/ui/call_window')
-rw-r--r--main/src/ui/call_window/call_connection_details_window.vala175
1 files changed, 91 insertions, 84 deletions
diff --git a/main/src/ui/call_window/call_connection_details_window.vala b/main/src/ui/call_window/call_connection_details_window.vala
index 95e00296..1d5265c9 100644
--- a/main/src/ui/call_window/call_connection_details_window.vala
+++ b/main/src/ui/call_window/call_connection_details_window.vala
@@ -4,100 +4,107 @@ 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("?") { use_markup=true, xalign=0, visible=true };
- public Label audio_recv_bps = new Label("?") { use_markup=true, xalign=0, visible=true };
- public Label audio_codec = new Label("?") { xalign=0, visible=true };
- public Label audio_target_receive_bitrate = new Label("n/a") { xalign=0, visible=true };
- public Label audio_target_send_bitrate = new Label("n/a") { 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("") { use_markup=true, xalign=0, visible=true };
- public Label video_recv_bps = new Label("") { use_markup=true, xalign=0, visible=true };
- public Label video_codec = new Label("") { xalign=0, visible=true };
- public Label video_target_receive_bitrate = new Label("n/a") { xalign=0, visible=true };
- public Label video_target_send_bitrate = new Label("n/a") { xalign=0, visible=true };
+ public Box box = new Box(Orientation.VERTICAL, 15) { margin=10, halign=Align.CENTER, valign=Align.CENTER, visible=true };
- private int row_at = 0;
private bool video_added = false;
- private PeerInfo? prev_peer_info = null;
+ private CallContentDetails audio_details = new CallContentDetails("Audio") { visible=true };
+ private CallContentDetails video_details = new CallContentDetails("Video");
public CallConnectionDetailsWindow() {
- grid.attach(new Label("<b>Audio</b>") { 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);
- put_row("Target receive bitrate");
- grid.attach(audio_target_receive_bitrate, 1, row_at++, 1, 1);
- put_row("Target send bitrate");
- grid.attach(audio_target_send_bitrate, 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);
+ box.add(audio_details);
+ box.add(video_details);
+ add(box);
}
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();
- audio_target_receive_bitrate.label = peer_info.audio_target_receive_bitrate.to_string();
- audio_target_send_bitrate.label = peer_info.audio_target_send_bitrate.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;
- video_target_receive_bitrate.label = peer_info.video_target_receive_bitrate.to_string();
- video_target_send_bitrate.label = peer_info.video_target_send_bitrate.to_string();
-
- if (peer_info.video_content_exists) add_video_widgets();
-
- if (prev_peer_info != null) {
- ulong audio_sent_kbps = (peer_info.audio_bytes_sent - prev_peer_info.audio_bytes_sent) * 8 / 1000;
- audio_sent_bps.label = "<span font_family='monospace'>%lu</span> kbps".printf(audio_sent_kbps);
- ulong audio_recv_kbps = (peer_info.audio_bytes_received - prev_peer_info.audio_bytes_received) * 8 / 1000;
- audio_recv_bps.label = "<span font_family='monospace'>%lu</span> kbps".printf(audio_recv_kbps);
- ulong video_sent_kbps = (peer_info.video_bytes_sent - prev_peer_info.video_bytes_sent) * 8 / 1000;
- video_sent_bps.label = "<span font_family='monospace'>%lu</span> kbps".printf(video_sent_kbps);
- ulong video_recv_kbps = (peer_info.video_bytes_received - prev_peer_info.video_bytes_received) * 8 / 1000;
- video_recv_bps.label = "<span font_family='monospace'>%lu</span> kbps".printf(video_recv_kbps);
- }
- prev_peer_info = peer_info;
+ if (peer_info.audio != null) {
+ audio_details.update_content(peer_info.audio);
+ }
+ if (peer_info.video != null) {
+ add_video_widgets();
+ video_details.update_content(peer_info.video);
+ }
}
private void add_video_widgets() {
- if (video_added) return;
-
- grid.attach(new Label("<b>Video</b>") { 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);
- put_row("Target receive bitrate");
- grid.attach(video_target_receive_bitrate, 1, row_at++, 1, 1);
- put_row("Target send bitrate");
- grid.attach(video_target_send_bitrate, 1, row_at++, 1, 1);
-
- video_added = true;
+ if (video_added) return;
+
+ video_details.visible = true;
+ video_added = true;
+ }
+ }
+
+ public class CallContentDetails : Gtk.Grid {
+
+ public Label rtp_title = new Label("RTP") { xalign=0, visible=true };
+ public Label rtcp_title = new Label("RTCP") { xalign=0, visible=true };
+ public Label target_recv_title = new Label("Target receive bitrate") { xalign=0, visible=true };
+ public Label target_send_title = new Label("Target send bitrate") { xalign=0, visible=true };
+
+ public Label rtp_ready = new Label("?") { xalign=0, visible=true };
+ public Label rtcp_ready = new Label("?") { xalign=0, visible=true };
+ public Label sent_bps = new Label("?") { use_markup=true, xalign=0, visible=true };
+ public Label recv_bps = new Label("?") { use_markup=true, xalign=0, visible=true };
+ public Label codec = new Label("?") { xalign=0, visible=true };
+ public Label target_receive_bitrate = new Label("n/a") { use_markup=true, xalign=0, visible=true };
+ public Label target_send_bitrate = new Label("n/a") { use_markup=true, xalign=0, visible=true };
+
+ private PeerContentInfo? prev_info = null;
+ private int row_at = 0;
+
+ public CallContentDetails(string headline) {
+ attach(new Label("<b>%s</b>".printf(headline)) { use_markup=true, xalign=0, visible=true }, 0, row_at++, 1, 1);
+ attach(rtp_title, 0, row_at, 1, 1);
+ attach(rtp_ready, 1, row_at++, 1, 1);
+ attach(rtcp_title, 0, row_at, 1, 1);
+ attach(rtcp_ready, 1, row_at++, 1, 1);
+ put_row("Sent");
+ attach(sent_bps, 1, row_at++, 1, 1);
+ put_row("Received");
+ attach(recv_bps, 1, row_at++, 1, 1);
+ put_row("Codec");
+ attach(codec, 1, row_at++, 1, 1);
+ attach(target_recv_title, 0, row_at, 1, 1);
+ attach(target_receive_bitrate, 1, row_at++, 1, 1);
+ attach(target_send_title, 0, row_at, 1, 1);
+ attach(target_send_bitrate, 1, row_at++, 1, 1);
+
+ this.column_spacing = 5;
+ }
+
+ public void update_content(PeerContentInfo info) {
+ if (!info.rtp_ready) {
+ rtp_ready.visible = rtcp_ready.visible = true;
+ rtp_title.visible = rtcp_title.visible = true;
+ rtp_ready.label = info.rtp_ready.to_string();
+ rtcp_ready.label = info.rtcp_ready.to_string();
+ } else {
+ rtp_ready.visible = rtcp_ready.visible = false;
+ rtp_title.visible = rtcp_title.visible = false;
+ }
+ if (info.target_send_bytes != -1) {
+ target_receive_bitrate.visible = target_send_bitrate.visible = true;
+ target_recv_title.visible = target_send_title.visible = true;
+ target_receive_bitrate.label = "<span font_family='monospace'>%u</span> kbps".printf(info.target_receive_bytes);
+ target_send_bitrate.label = "<span font_family='monospace'>%u</span> kbps".printf(info.target_send_bytes);
+ } else {
+ target_receive_bitrate.visible = target_send_bitrate.visible = false;
+ target_recv_title.visible = target_send_title.visible = false;
+ }
+
+ codec.label = info.codec + " " + info.clockrate.to_string();
+
+ if (prev_info != null) {
+ ulong audio_sent_kbps = (info.bytes_sent - prev_info.bytes_sent) * 8 / 1000;
+ sent_bps.label = "<span font_family='monospace'>%lu</span> kbps".printf(audio_sent_kbps);
+ ulong audio_recv_kbps = (info.bytes_received - prev_info.bytes_received) * 8 / 1000;
+ recv_bps.label = "<span font_family='monospace'>%lu</span> kbps".printf(audio_recv_kbps);
+ }
+ prev_info = info;
+ }
+
+ private void put_row(string label) {
+ attach(new Label(label) { xalign=0, visible=true }, 0, row_at, 1, 1);
}
}
}