1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-07 00:05:54 +02:00

multistream: accept only audio in incoming call

GitLab: #392
Change-Id: Ifcd29af849c11166158e7f8d39b65a33325b8d4a
This commit is contained in:
agsantos 2021-05-12 23:01:38 -04:00
parent a2858a883b
commit 7d0f4e00ff
8 changed files with 43 additions and 10 deletions

View file

@ -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 void
CallAdapter::acceptACall(const QString& accountId, const QString& convUid) CallAdapter::acceptACall(const QString& accountId, const QString& convUid)
{ {

View file

@ -51,6 +51,7 @@ public:
Q_INVOKABLE void placeAudioOnlyCall(); Q_INVOKABLE void placeAudioOnlyCall();
Q_INVOKABLE void placeCall(); Q_INVOKABLE void placeCall();
Q_INVOKABLE void hangUpACall(const QString& accountId, const QString& convUid); 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 acceptACall(const QString& accountId, const QString& convUid);
Q_INVOKABLE void connectCallModel(const QString& accountId); Q_INVOKABLE void connectCallModel(const QString& accountId);

View file

@ -28,6 +28,8 @@ Item {
// Misc // Misc
property string accept: qsTr("Accept") 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 refuse: qsTr("Refuse")
property string endCall: qsTr("End call") property string endCall: qsTr("End call")
property string incomingAudioCallFrom: qsTr("Incoming audio call from {}") property string incomingAudioCallFrom: qsTr("Incoming audio call from {}")

View file

@ -197,7 +197,7 @@ Rectangle {
CallAdapter.updateCall(convId, LRCInstance.currentAccountId) CallAdapter.updateCall(convId, LRCInstance.currentAccountId)
callStackView.showOngoingCallPage() callStackView.showOngoingCallPage()
} else { } else {
callStackView.showInitialCallPage(item.callState) callStackView.showInitialCallPage(item.callState, item.isAudioOnly)
} }
pushCallStackView() pushCallStackView()

View file

@ -56,6 +56,8 @@ Item {
ParticipantsLayer { ParticipantsLayer {
id: __participantsLayer id: __participantsLayer
isAudioOnly: root.isAudioOnly
isVideoMuted: root.isVideoMuted
anchors.fill: parent anchors.fill: parent
} }

View file

@ -87,7 +87,7 @@ Rectangle {
}) })
} }
function showInitialCallPage(callState) { function showInitialCallPage(callState, isAudioOnly) {
var itemToFind = getItemFromStack(CallStackView.InitialPageStack) var itemToFind = getItemFromStack(CallStackView.InitialPageStack)
if (!itemToFind) { if (!itemToFind) {
callStackMainView.push(initialCallPage, StackView.Immediate) callStackMainView.push(initialCallPage, StackView.Immediate)
@ -96,6 +96,7 @@ Rectangle {
} }
initialCallPage.accountConvPair = [responsibleAccountId, responsibleConvUid] initialCallPage.accountConvPair = [responsibleAccountId, responsibleConvUid]
initialCallPage.callStatus = callState initialCallPage.callStatus = callState
initialCallPage.isAudioOnly = isAudioOnly
if (initialCallPage.callStatus === Call.Status.INCOMING_RINGING) if (initialCallPage.callStatus === Call.Status.INCOMING_RINGING)
initialCallPage.isIncoming = true initialCallPage.isIncoming = true
else else

View file

@ -46,7 +46,8 @@ Rectangle {
ListModel { ListModel {
id: incomingControlsModel id: incomingControlsModel
ListElement { type: "refuse"; image: "qrc:/images/icons/round-close-24px.svg"} 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 { ListModel {
id: outgoingControlsModel id: outgoingControlsModel
@ -130,6 +131,8 @@ Rectangle {
model: root.isIncoming ? incomingControlsModel : outgoingControlsModel model: root.isIncoming ? incomingControlsModel : outgoingControlsModel
delegate: ColumnLayout { delegate: ColumnLayout {
visible: (type === "cam" && root.isAudioOnly) ? false : true;
PushButton { PushButton {
id: actionButton id: actionButton
Layout.leftMargin: 10 Layout.leftMargin: 10
@ -139,17 +142,17 @@ Rectangle {
implicitHeight: JamiTheme.callButtonPreferredSize implicitHeight: JamiTheme.callButtonPreferredSize
pressedColor: { pressedColor: {
if (type === "accept" ) if ( type === "cam" || type === "mic")
return JamiTheme.acceptGreen return JamiTheme.acceptGreen
return JamiTheme.refuseRed return JamiTheme.refuseRed
} }
hoveredColor: { hoveredColor: {
if (type === "accept" ) if ( type === "cam" || type === "mic")
return JamiTheme.acceptGreen return JamiTheme.acceptGreen
return JamiTheme.refuseRed return JamiTheme.refuseRed
} }
normalColor: { normalColor: {
if (type === "accept" ) if ( type === "cam" || type === "mic")
return JamiTheme.acceptGreenTransparency return JamiTheme.acceptGreenTransparency
return JamiTheme.refuseRedTransparent return JamiTheme.refuseRedTransparent
} }
@ -158,12 +161,19 @@ Rectangle {
imageColor: JamiTheme.whiteColor imageColor: JamiTheme.whiteColor
onClicked: { 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() callAccepted()
else } else {
callCanceled() callCanceled()
} }
} }
}
Label { Label {
id: buttonLabel id: buttonLabel
@ -178,8 +188,10 @@ Rectangle {
text: { text: {
if (type === "refuse") if (type === "refuse")
return JamiStrings.refuse return JamiStrings.refuse
else if (type === "accept") else if (type === "cam")
return JamiStrings.accept return JamiStrings.acceptVideo
else if (type === "mic")
return root.isAudioOnly ? JamiStrings.accept : JamiStrings.acceptAudio
else if (type === "cancel") else if (type === "cancel")
return JamiStrings.endCall return JamiStrings.endCall
return "" return ""

View file

@ -22,6 +22,8 @@ import QtQml 2.14
Item { Item {
id: root id: root
property bool isAudioOnly
property bool isVideoMuted
property var participantOverlays: [] property var participantOverlays: []
property var participantComponent: Qt.createComponent("ParticipantOverlay.qml") property var participantComponent: Qt.createComponent("ParticipantOverlay.qml")