aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/call_window
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2022-02-02 21:37:05 +0100
committerfiaxh <git@lightrise.org>2022-02-07 01:21:11 +0100
commit4ef50db3e581016365087759d5af8649e37ab8a7 (patch)
treeec7d47401f8424b5b9999941e05f61409594c539 /main/src/ui/call_window
parent5ed8d28a27948ed949eb80b0da06d2c4ec9571ff (diff)
downloaddino-4ef50db3e581016365087759d5af8649e37ab8a7.tar.gz
dino-4ef50db3e581016365087759d5af8649e37ab8a7.zip
Various call UI/UX improvements
Diffstat (limited to 'main/src/ui/call_window')
-rw-r--r--main/src/ui/call_window/call_window.vala8
-rw-r--r--main/src/ui/call_window/call_window_controller.vala69
2 files changed, 41 insertions, 36 deletions
diff --git a/main/src/ui/call_window/call_window.vala b/main/src/ui/call_window/call_window.vala
index c610444f..cd490bf9 100644
--- a/main/src/ui/call_window/call_window.vala
+++ b/main/src/ui/call_window/call_window.vala
@@ -20,7 +20,7 @@ namespace Dino.Ui {
public Revealer header_bar_revealer = new Revealer() { halign=Align.END, valign=Align.START, transition_type=RevealerTransitionType.CROSSFADE, transition_duration=200, visible=true };
public Box own_video_box = new Box(Orientation.HORIZONTAL, 0) { halign=Align.END, valign=Align.END, visible=true };
public Revealer invite_button_revealer = new Revealer() { margin_top=50, margin_right=30, halign=Align.END, valign=Align.START, transition_type=RevealerTransitionType.CROSSFADE, transition_duration=200 };
- public Button invite_button = new Button.from_icon_name("dino-account-plus") { relief=ReliefStyle.NONE, visible=false };
+ public Button invite_button = new Button.from_icon_name("dino-account-plus") { relief=ReliefStyle.NONE, visible=true };
private Widget? own_video = null;
private HashMap<string, ParticipantWidget> participant_widgets = new HashMap<string, ParticipantWidget>();
private ArrayList<string> participants = new ArrayList<string>();
@@ -191,7 +191,11 @@ namespace Dino.Ui {
} else if (reason_name == Xmpp.Xep.Jingle.ReasonElement.DECLINE || reason_name == Xmpp.Xep.Jingle.ReasonElement.BUSY) {
text = _("%s declined the call").printf(who_terminated);
} else {
- text = "The call has been terminated: " + (reason_name ?? "") + " " + (reason_text ?? "");
+ if (reason_text == null) {
+ text = "The call has been terminated" + " " + (reason_name ?? "");
+ } else {
+ text = reason_text + " " + (reason_name ?? "");
+ }
}
bottom_bar.show_counterpart_ended(text);
diff --git a/main/src/ui/call_window/call_window_controller.vala b/main/src/ui/call_window/call_window_controller.vala
index 34f3a910..ebf8774a 100644
--- a/main/src/ui/call_window/call_window_controller.vala
+++ b/main/src/ui/call_window/call_window_controller.vala
@@ -134,16 +134,23 @@ 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) {
// This is the first peer.
// If it can do MUJI, show invite button.
- call_window.invite_button_revealer.visible = true;
-// stream_interactor.get_module(EntityInfo.IDENTITY).has_feature.begin(call.account, peer_state.jid, Xep.Muji.NS_URI, (_, res) => {
-// bool has_feature = stream_interactor.get_module(EntityInfo.IDENTITY).has_feature.end(res);
-// call_window.invite_button_revealer.visible = has_feature;
-// });
+
+ call_state.can_convert_into_groupcall.begin((_, res) => {
+ bool can_convert = call_state.can_convert_into_groupcall.end(res);
+ call_window.invite_button_revealer.visible = can_convert;
+ });
call_plugin.devices_changed.connect((media, incoming) => {
if (media == "audio") update_audio_device_choices();
@@ -165,7 +172,7 @@ public class Dino.Ui.CallWindowController : Object {
if (!(participant_videos[peer_id] is Widget)) return;
Widget widget = (Widget) participant_videos[peer_id];
call_window.set_video(peer_id, widget);
- participant_videos[peer_id].display_stream(peer_state.get_video_stream(call), peer_jid);
+ participant_videos[peer_id].display_stream(peer_state.get_video_stream(), peer_jid);
}
});
peer_state.info_received.connect((session_info) => {
@@ -264,7 +271,7 @@ 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;
}
@@ -273,34 +280,31 @@ public class Dino.Ui.CallWindowController : Object {
update_current_audio_device(audio_settings_popover);
audio_settings_popover.microphone_selected.connect((device) => {
- call_plugin.set_device(calls.get_audio_stream(call), device);
+ call_state.set_audio_device(device);
update_current_audio_device(audio_settings_popover);
});
audio_settings_popover.speaker_selected.connect((device) => {
- call_plugin.set_device(calls.get_audio_stream(call), device);
+ 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);
- }
- });*/
+// 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) {
- Xmpp.Xep.JingleRtp.Stream stream = calls.get_audio_stream(call);
- if (stream != null) {
- audio_settings_popover.current_microphone_device = call_plugin.get_device(stream, false);
- audio_settings_popover.current_speaker_device = call_plugin.get_device(stream, true);
- }
- }*/
+ private void update_current_audio_device(AudioSettingsPopover audio_settings_popover) {
+ audio_settings_popover.current_microphone_device = call_state.get_microphone_device();
+ audio_settings_popover.current_speaker_device = call_state.get_speaker_device();
+ }
private void update_video_device_choices() {
int device_count = call_plugin.get_devices("video", false).size;
if (device_count == 0) {
call_window.bottom_bar.show_video_device_error();
- } /*else if (device_count == 1 || calls.get_video_stream(call) == null) {
+ } else if (device_count == 1 || call_state.get_video_device() == null) {
call_window.bottom_bar.show_video_device_choices(false);
return;
}
@@ -309,23 +313,20 @@ public class Dino.Ui.CallWindowController : Object {
update_current_video_device(video_settings_popover);
video_settings_popover.camera_selected.connect((device) => {
- call_plugin.set_device(calls.get_video_stream(call), device);
+ call_state.set_video_device(device);
update_current_video_device(video_settings_popover);
own_video.display_device(device);
});
- calls.stream_created.connect((call, media) => {
- if (media == "video") {
- update_current_video_device(video_settings_popover);
- }
- });*/
+// 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) {
- Xmpp.Xep.JingleRtp.Stream stream = calls.get_video_stream(call);
- if (stream != null) {
- video_settings_popover.current_device = call_plugin.get_device(stream, false);
- }
- }*/
+ private void update_current_video_device(VideoSettingsPopover video_settings_popover) {
+ video_settings_popover.current_device = call_state.get_video_device();
+ }
private void update_own_video() {
if (this.call_window.bottom_bar.video_enabled) {