diff --git a/src/app/avadapter.cpp b/src/app/avadapter.cpp index 6689e96daffcc4eaf562b5b3143d773b3b4b3925..412ab61f21deaed3f7366aa6b4c9964f4fb4115c 100644 --- a/src/app/avadapter.cpp +++ b/src/app/avadapter.cpp @@ -290,14 +290,23 @@ AvAdapter::getListWindows() } void -AvAdapter::stopSharing() +AvAdapter::stopSharing(const QString& source) { auto callId = lrcInstance_->getCurrentCallId(); - if (!callId.isEmpty()) { - lrcInstance_->getCurrentCallModel()->removeMedia(callId, - libjami::Media::Details::MEDIA_TYPE_VIDEO, - libjami::Media::VideoProtocolPrefix::DISPLAY, - muteCamera_); + if (!source.isEmpty() && !callId.isEmpty()) { + if (source.startsWith(libjami::Media::VideoProtocolPrefix::DISPLAY)) { + qDebug() << "Stopping display: " << source; + lrcInstance_->getCurrentCallModel()->removeMedia(callId, + libjami::Media::Details::MEDIA_TYPE_VIDEO, + libjami::Media::VideoProtocolPrefix::DISPLAY, + muteCamera_); + } else { + qDebug() << "Stopping file: " << source; + lrcInstance_->getCurrentCallModel()->removeMedia(callId, + libjami::Media::Details::MEDIA_TYPE_VIDEO, + libjami::Media::VideoProtocolPrefix::FILE, + muteCamera_); + } } } diff --git a/src/app/avadapter.h b/src/app/avadapter.h index 0ce2ee22bb3769518d289ca374401b9164a77d2e..23fdd18a57b0d66c234afc715f33b67f20fb03c6 100644 --- a/src/app/avadapter.h +++ b/src/app/avadapter.h @@ -94,7 +94,7 @@ protected: Q_INVOKABLE void getListWindows(); // Stop sharing the screen or file - Q_INVOKABLE void stopSharing(); + Q_INVOKABLE void stopSharing(const QString& source = {}); Q_INVOKABLE void startAudioMeter(); Q_INVOKABLE void stopAudioMeter(); diff --git a/src/app/currentcall.cpp b/src/app/currentcall.cpp index 3dcd17663fde4f0785864a8986aed92c67939ca7..6eb4fbd50920d7c890f5ed452f897b471551cbe0 100644 --- a/src/app/currentcall.cpp +++ b/src/app/currentcall.cpp @@ -108,6 +108,7 @@ CurrentCall::updateCallInfo() bool isAudioMuted {}; bool isVideoMuted {}; bool isSharing {}; + QString sharingSource {}; bool isCapturing {}; QString previewId {}; using namespace libjami::Media; @@ -117,6 +118,7 @@ CurrentCall::updateCallInfo() if (media[MediaAttributeKey::SOURCE].startsWith(VideoProtocolPrefix::DISPLAY) || media[MediaAttributeKey::SOURCE].startsWith(VideoProtocolPrefix::FILE)) { isSharing = true; + sharingSource = media[MediaAttributeKey::SOURCE]; } if (media[MediaAttributeKey::ENABLED] == TRUE_STR && media[MediaAttributeKey::MUTED] == FALSE_STR && previewId.isEmpty()) { @@ -138,6 +140,7 @@ CurrentCall::updateCallInfo() set_isAudioMuted(isAudioMuted); set_isVideoMuted(isVideoMuted); set_isSharing(isSharing); + set_sharingSource(sharingSource); set_isCapturing(isCapturing); set_isHandRaised(callModel->isHandRaised(id_)); set_isModerator(callModel->isModerator(id_)); diff --git a/src/app/currentcall.h b/src/app/currentcall.h index 5ad19071f593083f66348377ace9a7f62d2a1ad7..4b128b9b1443e9945e17a0555df98960222f03e7 100644 --- a/src/app/currentcall.h +++ b/src/app/currentcall.h @@ -43,6 +43,7 @@ class CurrentCall final : public QObject QML_RO_PROPERTY(bool, isRecordingRemotely) QML_RO_PROPERTY(QStringList, remoteRecorderNameList) QML_RO_PROPERTY(bool, isSharing) + QML_RO_PROPERTY(QString, sharingSource) QML_RO_PROPERTY(bool, isHandRaised) QML_RO_PROPERTY(bool, isConference) QML_RO_PROPERTY(bool, isModerator) diff --git a/src/app/mainview/components/CallOverlay.qml b/src/app/mainview/components/CallOverlay.qml index 66e5822ec09553f2595a7cf19ffc27a1158ca937..3e51c48cf407c049ed5f2f59f98be3e0777558b1 100644 --- a/src/app/mainview/components/CallOverlay.qml +++ b/src/app/mainview/components/CallOverlay.qml @@ -165,7 +165,7 @@ Item { function onShowInputPanelClicked() { sipInputPanel.open() } function onShareScreenClicked() { openShareScreen() } function onShareWindowClicked() { openShareWindow() } - function onStopSharingClicked() { AvAdapter.stopSharing() } + function onStopSharingClicked() { AvAdapter.stopSharing(CurrentCall.sharingSource) } function onShareScreenAreaClicked() { openShareScreenArea() } function onRecordCallClicked() { CallAdapter.recordThisCallToggle() } function onShareFileClicked() { jamiFileDialog.open() } diff --git a/src/app/mainview/components/CallViewContextMenu.qml b/src/app/mainview/components/CallViewContextMenu.qml index ca5d5097731985e98bc1075e2360b10c49ec7433..4a7aa35d3d6a1b79c89c4112a0b68ca1a0100fb1 100644 --- a/src/app/mainview/components/CallViewContextMenu.qml +++ b/src/app/mainview/components/CallViewContextMenu.qml @@ -114,7 +114,7 @@ ContextMenuAutoLoader { itemName: JamiStrings.stopSharing iconSource: JamiResources.share_stop_black_24dp_svg iconColor: JamiTheme.redColor - onClicked: AvAdapter.stopSharing() + onClicked: AvAdapter.stopSharing(CurrentCall.sharingSource) }, GeneralMenuItem { id: shareScreen