Skip to content
Snippets Groups Projects
Commit 010930fe authored by Aline Gondim Santos's avatar Aline Gondim Santos
Browse files

misc: fix close file sharing

Change-Id: I9450db0658741059620c052e8ddf602976fc2983
GitLab: #968
parent 48695d46
No related branches found
No related tags found
No related merge requests found
......@@ -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_);
}
}
}
......
......@@ -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();
......
......@@ -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_));
......
......@@ -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)
......
......@@ -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() }
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment