aboutsummaryrefslogtreecommitdiff
path: root/main
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
parent5ed8d28a27948ed949eb80b0da06d2c4ec9571ff (diff)
downloaddino-4ef50db3e581016365087759d5af8649e37ab8a7.tar.gz
dino-4ef50db3e581016365087759d5af8649e37ab8a7.zip
Various call UI/UX improvements
Diffstat (limited to 'main')
-rw-r--r--main/src/ui/call_window/call_window.vala8
-rw-r--r--main/src/ui/call_window/call_window_controller.vala69
-rw-r--r--main/src/ui/conversation_content_view/call_widget.vala25
-rw-r--r--main/src/ui/conversation_titlebar/call_entry.vala16
4 files changed, 65 insertions, 53 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) {
diff --git a/main/src/ui/conversation_content_view/call_widget.vala b/main/src/ui/conversation_content_view/call_widget.vala
index a2c8c0c2..d9060872 100644
--- a/main/src/ui/conversation_content_view/call_widget.vala
+++ b/main/src/ui/conversation_content_view/call_widget.vala
@@ -111,17 +111,30 @@ namespace Dino.Ui {
incoming_call_revealer.get_style_context().remove_class("incoming");
outer_additional_box.get_style_context().remove_class("incoming-call-box");
- switch (call.state) {
+ // It doesn't make sense to display MUC calls as missed or declined by the whole MUC. Just display as ended.
+ // TODO: maybe not let them be missed/declined in first place.
+ Call.State relevant_state = call.state;
+ if (conversation.type_ == Conversation.Type.GROUPCHAT && call.direction == Call.DIRECTION_OUTGOING &&
+ (relevant_state == Call.State.MISSED || relevant_state == Call.State.DECLINED)) {
+ relevant_state = Call.State.ENDED;
+ }
+
+ switch (relevant_state) {
case Call.State.RINGING:
image.set_from_icon_name("dino-phone-ring-symbolic", IconSize.LARGE_TOOLBAR);
if (call.direction == Call.DIRECTION_INCOMING) {
bool video = call_manager.should_we_send_video();
title_label.label = video ? _("Incoming video call") : _("Incoming call");
- subtitle_label.label = "Ring ring…!";
- incoming_call_box.visible = true;
- incoming_call_revealer.reveal_child = true;
- incoming_call_revealer.get_style_context().add_class("incoming");
- outer_additional_box.get_style_context().add_class("incoming-call-box");
+
+ if (stream_interactor.get_module(Calls.IDENTITY).can_we_do_calls(call.account)) {
+ subtitle_label.label = "Ring ring…!";
+ incoming_call_box.visible = true;
+ incoming_call_revealer.reveal_child = true;
+ incoming_call_revealer.get_style_context().add_class("incoming");
+ outer_additional_box.get_style_context().add_class("incoming-call-box");
+ } else {
+ subtitle_label.label = "Dependencies for call support not met";
+ }
} else {
title_label.label = _("Calling…");
subtitle_label.label = "Ring ring…?";
diff --git a/main/src/ui/conversation_titlebar/call_entry.vala b/main/src/ui/conversation_titlebar/call_entry.vala
index 3b3a5b39..e5b7281c 100644
--- a/main/src/ui/conversation_titlebar/call_entry.vala
+++ b/main/src/ui/conversation_titlebar/call_entry.vala
@@ -115,17 +115,11 @@ namespace Dino.Ui {
return;
}
- if (conversation.type_ == Conversation.Type.CHAT) {
- Conversation conv_bak = conversation;
- bool audio_works = yield stream_interactor.get_module(Calls.IDENTITY).can_do_audio_calls_async(conversation);
- bool video_works = yield stream_interactor.get_module(Calls.IDENTITY).can_do_video_calls_async(conversation);
- if (conv_bak != conversation) return;
-
- visible = audio_works;
- video_button.visible = video_works;
- } else {
- visible = false;
- }
+ Conversation conv_bak = conversation;
+ bool can_do_calls = yield stream_interactor.get_module(Calls.IDENTITY).can_conversation_do_calls(conversation);
+ if (conv_bak != conversation) return;
+
+ visible = video_button.visible = can_do_calls;
}
public new void unset_conversation() { }