diff options
author | Rohit Sutradhar <rohitsutradhar311@gmail.com> | 2022-10-14 19:19:05 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-14 13:49:05 +0000 |
commit | ac48c332867e773e0e0eb9ad0139b7b625e26851 (patch) | |
tree | 9f4799c650889bb770f72e127441426c9ae42a07 /resources | |
parent | 8a4bb32b4a53399d20495bb987ea8bda29427d2a (diff) |
VoIP v1 implementation (#1161)
* Initial commit for VoIP v1 implementation
* Added draft of event handlers for voip methods
* Added event handlers for VoIP events, added rejectCall, added version tracking for call version for V0 and V1 compatibility
* Added call events to the general message pipeline. Modified Call Reject mechanism
* Added message delegates for new events. Modified hidden events. Updated handle events.
* Updated implementation to keep track of calls on other devices
* Fixed linting
* Fixed code warnings
* Fixed minor bugs
* fixed ci
* Added acceptNegotiation method definition when missing gstreamer
* Fixed warnings
* Fixed linting
Diffstat (limited to 'resources')
-rw-r--r-- | resources/qml/MessageInput.qml | 10 | ||||
-rw-r--r-- | resources/qml/delegates/MessageDelegate.qml | 42 | ||||
-rw-r--r-- | resources/qml/dialogs/LeaveRoomDialog.qml | 12 | ||||
-rw-r--r-- | resources/qml/voip/CallInvite.qml | 2 | ||||
-rw-r--r-- | resources/qml/voip/CallInviteBar.qml | 2 |
5 files changed, 62 insertions, 6 deletions
diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml index 6174a6c0..37d9614a 100644 --- a/resources/qml/MessageInput.qml +++ b/resources/qml/MessageInput.qml @@ -46,14 +46,14 @@ Rectangle { ImageButton { visible: CallManager.callsSupported && showAllButtons - opacity: CallManager.haveCallInvite ? 0.3 : 1 + opacity: (CallManager.haveCallInvite || CallManager.isOnCallOnOtherDevice) ? 0.3 : 1 Layout.alignment: Qt.AlignBottom hoverEnabled: true width: 22 height: 22 image: CallManager.isOnCall ? ":/icons/icons/ui/end-call.svg" : ":/icons/icons/ui/place-call.svg" ToolTip.visible: hovered - ToolTip.text: CallManager.isOnCall ? qsTr("Hang up") : qsTr("Place a call") + ToolTip.text: CallManager.isOnCall ? qsTr("Hang up") : (CallManager.isOnCallOnOtherDevice ? qsTr("Already on a call") : qsTr("Place a call")) Layout.margins: 8 onClicked: { if (room) { @@ -61,7 +61,11 @@ Rectangle { return ; } else if (CallManager.isOnCall) { CallManager.hangUp(); - } else { + } + else if(CallManager.isOnCallOnOtherDevice) { + return; + } + else { var dialog = placeCallDialog.createObject(timelineRoot); dialog.open(); timelineRoot.destroyOnClose(dialog); diff --git a/resources/qml/delegates/MessageDelegate.qml b/resources/qml/delegates/MessageDelegate.qml index 200c34d4..a2a44cb2 100644 --- a/resources/qml/delegates/MessageDelegate.qml +++ b/resources/qml/delegates/MessageDelegate.qml @@ -379,6 +379,34 @@ Item { } DelegateChoice { + roleValue: MtxEvent.CallReject + + NoticeMessage { + body: formatted + isOnlyEmoji: false + isReply: d.isReply + keepFullText: d.keepFullText + isStateEvent: d.isStateEvent + formatted: qsTr("%1 rejected the call.").arg(d.userName) + } + + } + + DelegateChoice { + roleValue: MtxEvent.CallSelectAnswer + + NoticeMessage { + body: formatted + isOnlyEmoji: false + isReply: d.isReply + keepFullText: d.keepFullText + isStateEvent: d.isStateEvent + formatted: qsTr("%1 select answer").arg(d.userName) + // formatted: qsTr("Call answered elsewhere") + } + } + + DelegateChoice { roleValue: MtxEvent.CallHangUp NoticeMessage { @@ -407,6 +435,20 @@ Item { } DelegateChoice { + roleValue: MtxEvent.CallNegotiate + + NoticeMessage { + body: formatted + isOnlyEmoji: false + isReply: d.isReply + keepFullText: d.keepFullText + isStateEvent: d.isStateEvent + formatted: qsTr("%1 is negotiating the call...").arg(d.userName) + } + + } + + DelegateChoice { roleValue: MtxEvent.PowerLevels NoticeMessage { diff --git a/resources/qml/dialogs/LeaveRoomDialog.qml b/resources/qml/dialogs/LeaveRoomDialog.qml index d64b2d31..cb15a74d 100644 --- a/resources/qml/dialogs/LeaveRoomDialog.qml +++ b/resources/qml/dialogs/LeaveRoomDialog.qml @@ -7,6 +7,7 @@ import Qt.labs.platform 1.1 as P import QtQuick 2.15 import QtQuick.Controls 2.15 import im.nheko 1.0 +import "../voip" P.MessageDialog { id: leaveRoomRoot @@ -18,5 +19,14 @@ P.MessageDialog { text: qsTr("Are you sure you want to leave?") modality: Qt.ApplicationModal buttons: P.MessageDialog.Ok | P.MessageDialog.Cancel - onAccepted: Rooms.leave(roomId, reason) + onAccepted: { + + if (CallManager.haveCallInvite) { + callManager.rejectInvite(); + } else if (CallManager.isOnCall) { + CallManager.hangUp(); + } + Rooms.leave(roomId, reason) + } + } diff --git a/resources/qml/voip/CallInvite.qml b/resources/qml/voip/CallInvite.qml index 7bab3616..beed2e51 100644 --- a/resources/qml/voip/CallInvite.qml +++ b/resources/qml/voip/CallInvite.qml @@ -153,7 +153,7 @@ Popup { implicitWidth: buttonLayout.buttonSize implicitHeight: buttonLayout.buttonSize onClicked: { - CallManager.hangUp(); + CallManager.rejectInvite(); close(); } diff --git a/resources/qml/voip/CallInviteBar.qml b/resources/qml/voip/CallInviteBar.qml index ab377ca8..a622ca27 100644 --- a/resources/qml/voip/CallInviteBar.qml +++ b/resources/qml/voip/CallInviteBar.qml @@ -129,7 +129,7 @@ Rectangle { text: qsTr("Decline") palette: Nheko.colors onClicked: { - CallManager.hangUp(); + CallManager.rejectInvite(); } } |