From d74d57fb798f7f63f96589e8e582207ad5742bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Tue, 12 Jul 2022 10:57:20 -0400 Subject: [PATCH] calladapter: be able to maximize a specific screen instead uri https://git.jami.net/savoirfairelinux/jami-project/-/issues/1429 Change-Id: I341ae5dcce9c69eaec636271315b5403426e44bc --- src/app/calladapter.cpp | 16 +++++++++------- src/app/calladapter.h | 9 +++++++-- .../components/ParticipantControlLayout.qml | 2 +- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/app/calladapter.cpp b/src/app/calladapter.cpp index 43fbe7609..08d8ce0dc 100644 --- a/src/app/calladapter.cpp +++ b/src/app/calladapter.cpp @@ -739,7 +739,7 @@ CallAdapter::hangUpCall(const QString& callId) } void -CallAdapter::maximizeParticipant(const QString& uri) +CallAdapter::setActiveStream(const QString& uri, const QString& deviceId, const QString& streamId) { auto* callModel = lrcInstance_->getAccountInfo(accountId_).callModel.get(); const auto& convInfo @@ -755,15 +755,17 @@ CallAdapter::maximizeParticipant(const QString& uri) bool removeActive = false; for (auto part : participants) { auto participant = part.toJsonObject(); - auto isParticipant = participant[lrc::api::ParticipantsInfosStrings::URI].toString() - == uri; + + auto puri = participant[lrc::api::ParticipantsInfosStrings::URI].toString(); + auto pdeviceId = participant[lrc::api::ParticipantsInfosStrings::DEVICE].toString(); + auto pstreamId = participant[lrc::api::ParticipantsInfosStrings::STREAMID].toString(); + + auto isParticipant = puri == uri && pdeviceId == deviceId && pstreamId == streamId; auto active = participant[lrc::api::ParticipantsInfosStrings::ACTIVE].toBool(); - if (active && !isParticipant) { + if (active && !isParticipant) activeParticipants.push_back(participant); - } + if (isParticipant) { - auto deviceId = participant[lrc::api::ParticipantsInfosStrings::DEVICE].toString(); - auto streamId = participant[lrc::api::ParticipantsInfosStrings::STREAMID].toString(); // Else, continue. if (!active) { callModel->setActiveStream(confId, uri, deviceId, streamId, true); diff --git a/src/app/calladapter.h b/src/app/calladapter.h index c3f970067..6770411f9 100644 --- a/src/app/calladapter.h +++ b/src/app/calladapter.h @@ -60,7 +60,9 @@ public: // For Call Overlay Q_INVOKABLE void hangUpCall(const QString& callId); - Q_INVOKABLE void maximizeParticipant(const QString& uri); + Q_INVOKABLE void setActiveStream(const QString& uri, + const QString& deviceId, + const QString& streamId); Q_INVOKABLE void minimizeParticipant(const QString& uri); Q_INVOKABLE void showGridConferenceLayout(); Q_INVOKABLE void hangUpThisCall(); @@ -76,7 +78,10 @@ public: Q_INVOKABLE void muteCameraToggle(); Q_INVOKABLE bool isRecordingThisCall(); Q_INVOKABLE QVariantList getConferencesInfos() const; - Q_INVOKABLE void muteParticipant(const QString& accountUri, const QString& deviceId, const QString& sinkId, const bool state); + Q_INVOKABLE void muteParticipant(const QString& accountUri, + const QString& deviceId, + const QString& sinkId, + const bool state); Q_INVOKABLE MuteStates getMuteState(const QString& uri) const; Q_INVOKABLE void hangupParticipant(const QString& uri, const QString& deviceId); Q_INVOKABLE void updateCall(const QString& convUid = {}, diff --git a/src/app/mainview/components/ParticipantControlLayout.qml b/src/app/mainview/components/ParticipantControlLayout.qml index 057207e7e..c6846fb3a 100644 --- a/src/app/mainview/components/ParticipantControlLayout.qml +++ b/src/app/mainview/components/ParticipantControlLayout.qml @@ -89,7 +89,7 @@ RowLayout { Layout.preferredWidth: buttonPreferredSize Layout.alignment: Qt.AlignVCenter source: JamiResources.open_in_full_24dp_svg - onClicked: CallAdapter.maximizeParticipant(uri) + onClicked: CallAdapter.setActiveStream(uri, deviceId, sinkId) toolTipText: JamiStrings.maximizeParticipant } -- GitLab