From afb9211e7a0d410b8b77f28c4c17cc6cc834e7e5 Mon Sep 17 00:00:00 2001 From: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com> Date: Thu, 25 May 2023 14:39:37 -0300 Subject: [PATCH] conference: use CurrentCall.isModerator instead of meModerator GitLab: #1079 Change-Id: I0ad09d2a8f47de17103500ebb7eb212bda96e37d --- src/app/calladapter.cpp | 17 -------------- src/app/calladapter.h | 1 - .../components/ParticipantControlLayout.qml | 2 +- .../components/ParticipantOverlay.qml | 23 +++++++++---------- 4 files changed, 12 insertions(+), 31 deletions(-) diff --git a/src/app/calladapter.cpp b/src/app/calladapter.cpp index c4acf3c7c..8ed634504 100644 --- a/src/app/calladapter.cpp +++ b/src/app/calladapter.cpp @@ -689,23 +689,6 @@ CallAdapter::participantIsHost(const QString& uri) const return true; } -bool -CallAdapter::isModerator(const QString& uri) const -{ - auto* callModel = lrcInstance_->getAccountInfo(accountId_).callModel.get(); - const auto& convInfo = lrcInstance_->getConversationFromConvUid( - lrcInstance_->get_selectedConvUid()); - auto confId = convInfo.confId; - - if (confId.isEmpty()) - confId = convInfo.callId; - try { - return callModel->isModerator(confId, uri); - } catch (...) { - } - return false; -} - bool CallAdapter::isHandRaised(const QString& uri) const { diff --git a/src/app/calladapter.h b/src/app/calladapter.h index a2d554ce0..1b16186d2 100644 --- a/src/app/calladapter.h +++ b/src/app/calladapter.h @@ -71,7 +71,6 @@ public: Q_INVOKABLE bool isCurrentHost() const; Q_INVOKABLE bool participantIsHost(const QString& uri) const; Q_INVOKABLE void setModerator(const QString& uri, const bool state); - Q_INVOKABLE bool isModerator(const QString& uri = {}) const; Q_INVOKABLE bool isHandRaised(const QString& uri = {}) const; Q_INVOKABLE void raiseHand(const QString& uri, const QString& deviceId, bool state); Q_INVOKABLE void holdThisCallToggle(); diff --git a/src/app/mainview/components/ParticipantControlLayout.qml b/src/app/mainview/components/ParticipantControlLayout.qml index ff22f184f..57ee8f792 100644 --- a/src/app/mainview/components/ParticipantControlLayout.qml +++ b/src/app/mainview/components/ParticipantControlLayout.qml @@ -49,7 +49,7 @@ RowLayout { Layout.preferredWidth: buttonPreferredSize Layout.alignment: Qt.AlignVCenter source: showModeratorMute ? JamiResources.micro_black_24dp_svg : JamiResources.micro_off_black_24dp_svg - checkable: meModerator + checkable: CurrentCall.isModerator onClicked: { if (participantIsModeratorMuted && isLocalMuted) { if (isMe) diff --git a/src/app/mainview/components/ParticipantOverlay.qml b/src/app/mainview/components/ParticipantOverlay.qml index e81ef4c87..f739562f7 100644 --- a/src/app/mainview/components/ParticipantOverlay.qml +++ b/src/app/mainview/components/ParticipantOverlay.qml @@ -40,7 +40,7 @@ Item { property string bestName: "" property string sinkId: "" property bool participantIsActive: false - property bool canMaximize: root.meModerator && (!root.participantIsActive || CallParticipantsModel.conferenceLayout === CallParticipantsModel.ONE_WITH_SMALL) + property bool canMaximize: CurrentCall.isModerator && (!root.participantIsActive || CallParticipantsModel.conferenceLayout === CallParticipantsModel.ONE_WITH_SMALL) property bool participantIsHost: CallAdapter.participantIsHost(uri) property bool participantIsModerator: false property bool participantIsMuted: isLocalMuted || participantIsModeratorMuted @@ -53,7 +53,6 @@ Item { property bool isSharing: false property bool meHost: CallAdapter.isCurrentHost() - property bool meModerator: CallAdapter.isModerator() property bool isMe: false property string muteAlertMessage: "" @@ -181,7 +180,7 @@ Item { ParticipantOverlayMenu { id: overlayMenu - visible: isMe || meModerator + visible: isMe || CurrentCall.isModerator anchors.fill: parent onHoveredChanged: { @@ -195,11 +194,11 @@ Item { showSetModerator: root.meHost && !root.isMe && !root.participantIsModerator showUnsetModerator: root.meHost && !root.isMe && root.participantIsModerator - showModeratorMute: root.meModerator && !root.participantIsModeratorMuted - showModeratorUnmute: (root.meModerator || root.isMe) && root.participantIsModeratorMuted + showModeratorMute: CurrentCall.isModerator && !root.participantIsModeratorMuted + showModeratorUnmute: (CurrentCall.isModerator || root.isMe) && root.participantIsModeratorMuted showMaximize: root.canMaximize - showMinimize: root.meModerator && root.participantIsActive - showHangup: root.meModerator && !root.isMe && !root.participantIsHost + showMinimize: CurrentCall.isModerator && root.participantIsActive + showHangup: CurrentCall.isModerator && !root.isMe && !root.participantIsHost } // Participant footer with host, moderator and mute indicators @@ -313,7 +312,7 @@ Item { containerHeight: 12 containerWidth: 12 - visible: (!root.isMe && !root.meModerator) ? root.participantIsMuted : root.isLocalMuted + visible: (!root.isMe && !CurrentCall.isModerator) ? root.participantIsMuted : root.isLocalMuted source: JamiResources.micro_off_black_24dp_svg color: JamiTheme.redColor @@ -324,11 +323,11 @@ Item { MaterialToolTip { visible: hoverMicrophone.hovered text: { - if (!root.isMe && !root.meModerator && root.participantIsModeratorMuted && root.isLocalMuted) + if (!root.isMe && !CurrentCall.isModerator && root.participantIsModeratorMuted && root.isLocalMuted) return JamiStrings.bothMuted; if (root.isLocalMuted) return JamiStrings.localMuted; - if (!root.isMe && !root.meModerator && root.participantIsModeratorMuted) + if (!root.isMe && !CurrentCall.isModerator && root.participantIsModeratorMuted) return JamiStrings.moderatorMuted; return JamiStrings.notMuted; } @@ -353,12 +352,12 @@ Item { visible: root.participantHandIsRaised anchors.right: participantRect.right anchors.top: participantRect.top - checkable: root.meModerator + checkable: CurrentCall.isModerator pressedColor: JamiTheme.raiseHandColor hoveredColor: JamiTheme.raiseHandColor normalColor: JamiTheme.raiseHandColor z: participantRect.z + 1 - toolTipText: root.meModerator ? JamiStrings.lowerHand : "" + toolTipText: CurrentCall.isModerator ? JamiStrings.lowerHand : "" onClicked: CallAdapter.raiseHand(uri, deviceId, false) radius: 5 } -- GitLab