From 7d0f4e00ff95b5d722170ff107b3722a94fd2b17 Mon Sep 17 00:00:00 2001 From: agsantos <aline.gondimsantos@savoirfairelinux.com> Date: Wed, 12 May 2021 23:01:38 -0400 Subject: [PATCH] multistream: accept only audio in incoming call GitLab: #392 Change-Id: Ifcd29af849c11166158e7f8d39b65a33325b8d4a --- src/calladapter.cpp | 13 +++++++++ src/calladapter.h | 1 + src/constant/JamiStrings.qml | 2 ++ src/mainview/MainView.qml | 2 +- src/mainview/components/CallOverlay.qml | 2 ++ src/mainview/components/CallStackView.qml | 3 +- src/mainview/components/InitialCallPage.qml | 28 +++++++++++++------ src/mainview/components/ParticipantsLayer.qml | 2 ++ 8 files changed, 43 insertions(+), 10 deletions(-) diff --git a/src/calladapter.cpp b/src/calladapter.cpp index dcc88e23d..807bfb85b 100644 --- a/src/calladapter.cpp +++ b/src/calladapter.cpp @@ -295,6 +295,19 @@ CallAdapter::hangUpACall(const QString& accountId, const QString& convUid) } } +void +CallAdapter::setCallMedia(const QString& accountId, const QString& convUid, bool video) +{ + const auto& convInfo = lrcInstance_->getConversationFromConvUid(convUid, accountId); + if (convInfo.uid.isEmpty()) + return; + try { + lrcInstance_->getAccountInfo(accountId).callModel->updateCallMediaList(convInfo.callId, + video); + } catch (...) { + } +} + void CallAdapter::acceptACall(const QString& accountId, const QString& convUid) { diff --git a/src/calladapter.h b/src/calladapter.h index 4d76fab92..b880f60b5 100644 --- a/src/calladapter.h +++ b/src/calladapter.h @@ -51,6 +51,7 @@ public: Q_INVOKABLE void placeAudioOnlyCall(); Q_INVOKABLE void placeCall(); Q_INVOKABLE void hangUpACall(const QString& accountId, const QString& convUid); + Q_INVOKABLE void setCallMedia(const QString& accountId, const QString& convUid, bool video); Q_INVOKABLE void acceptACall(const QString& accountId, const QString& convUid); Q_INVOKABLE void connectCallModel(const QString& accountId); diff --git a/src/constant/JamiStrings.qml b/src/constant/JamiStrings.qml index da316f3b5..a41f74a14 100644 --- a/src/constant/JamiStrings.qml +++ b/src/constant/JamiStrings.qml @@ -28,6 +28,8 @@ Item { // Misc property string accept: qsTr("Accept") + property string acceptAudio: qsTr("Accept in audio") + property string acceptVideo: qsTr("Accept in video") property string refuse: qsTr("Refuse") property string endCall: qsTr("End call") property string incomingAudioCallFrom: qsTr("Incoming audio call from {}") diff --git a/src/mainview/MainView.qml b/src/mainview/MainView.qml index 344853d6c..263d41050 100644 --- a/src/mainview/MainView.qml +++ b/src/mainview/MainView.qml @@ -197,7 +197,7 @@ Rectangle { CallAdapter.updateCall(convId, LRCInstance.currentAccountId) callStackView.showOngoingCallPage() } else { - callStackView.showInitialCallPage(item.callState) + callStackView.showInitialCallPage(item.callState, item.isAudioOnly) } pushCallStackView() diff --git a/src/mainview/components/CallOverlay.qml b/src/mainview/components/CallOverlay.qml index 12243e3de..0ea72fd45 100644 --- a/src/mainview/components/CallOverlay.qml +++ b/src/mainview/components/CallOverlay.qml @@ -56,6 +56,8 @@ Item { ParticipantsLayer { id: __participantsLayer + isAudioOnly: root.isAudioOnly + isVideoMuted: root.isVideoMuted anchors.fill: parent } diff --git a/src/mainview/components/CallStackView.qml b/src/mainview/components/CallStackView.qml index f671b445f..5a03ffe0f 100644 --- a/src/mainview/components/CallStackView.qml +++ b/src/mainview/components/CallStackView.qml @@ -87,7 +87,7 @@ Rectangle { }) } - function showInitialCallPage(callState) { + function showInitialCallPage(callState, isAudioOnly) { var itemToFind = getItemFromStack(CallStackView.InitialPageStack) if (!itemToFind) { callStackMainView.push(initialCallPage, StackView.Immediate) @@ -96,6 +96,7 @@ Rectangle { } initialCallPage.accountConvPair = [responsibleAccountId, responsibleConvUid] initialCallPage.callStatus = callState + initialCallPage.isAudioOnly = isAudioOnly if (initialCallPage.callStatus === Call.Status.INCOMING_RINGING) initialCallPage.isIncoming = true else diff --git a/src/mainview/components/InitialCallPage.qml b/src/mainview/components/InitialCallPage.qml index e382c6b97..29a2d6a4a 100644 --- a/src/mainview/components/InitialCallPage.qml +++ b/src/mainview/components/InitialCallPage.qml @@ -46,7 +46,8 @@ Rectangle { ListModel { id: incomingControlsModel ListElement { type: "refuse"; image: "qrc:/images/icons/round-close-24px.svg"} - ListElement { type: "accept"; image: "qrc:/images/icons/check-24px.svg"} + ListElement { type: "cam"; image: "qrc:/images/icons/videocam-24px.svg"} + ListElement { type: "mic"; image: "qrc:/images/icons/place_audiocall-24px.svg"} } ListModel { id: outgoingControlsModel @@ -130,6 +131,8 @@ Rectangle { model: root.isIncoming ? incomingControlsModel : outgoingControlsModel delegate: ColumnLayout { + visible: (type === "cam" && root.isAudioOnly) ? false : true; + PushButton { id: actionButton Layout.leftMargin: 10 @@ -139,17 +142,17 @@ Rectangle { implicitHeight: JamiTheme.callButtonPreferredSize pressedColor: { - if (type === "accept" ) + if ( type === "cam" || type === "mic") return JamiTheme.acceptGreen return JamiTheme.refuseRed } hoveredColor: { - if (type === "accept" ) + if ( type === "cam" || type === "mic") return JamiTheme.acceptGreen return JamiTheme.refuseRed } normalColor: { - if (type === "accept" ) + if ( type === "cam" || type === "mic") return JamiTheme.acceptGreenTransparency return JamiTheme.refuseRedTransparent } @@ -158,10 +161,17 @@ Rectangle { imageColor: JamiTheme.whiteColor onClicked: { - if (type === "accept") + if ( type === "cam" || type === "mic") { + var acceptVideoMedia = true + if (type === "cam") + acceptVideoMedia = true + else if ( type === "mic" ) + acceptVideoMedia = false + CallAdapter.setCallMedia(responsibleAccountId, responsibleConvUid, acceptVideoMedia) callAccepted() - else + } else { callCanceled() + } } } @@ -178,8 +188,10 @@ Rectangle { text: { if (type === "refuse") return JamiStrings.refuse - else if (type === "accept") - return JamiStrings.accept + else if (type === "cam") + return JamiStrings.acceptVideo + else if (type === "mic") + return root.isAudioOnly ? JamiStrings.accept : JamiStrings.acceptAudio else if (type === "cancel") return JamiStrings.endCall return "" diff --git a/src/mainview/components/ParticipantsLayer.qml b/src/mainview/components/ParticipantsLayer.qml index 6b39c4093..56d1553ab 100644 --- a/src/mainview/components/ParticipantsLayer.qml +++ b/src/mainview/components/ParticipantsLayer.qml @@ -22,6 +22,8 @@ import QtQml 2.14 Item { id: root + property bool isAudioOnly + property bool isVideoMuted property var participantOverlays: [] property var participantComponent: Qt.createComponent("ParticipantOverlay.qml") -- GitLab