From d11553ff05aa8927feafd9ae8e6769e4e27c8682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Tue, 29 Mar 2022 16:44:13 -0400 Subject: [PATCH] callview: fix fullscreen after video-split + Fix some errors + Replace the MouseArea in OngoingCallPage with a TapHandler + Accept buttons in both SplitView panes GitLab: #476 Change-Id: I39b6b26add0b5221337ce656f31a1f1900b2aa8b --- src/mainview/components/CallStackView.qml | 11 +- src/mainview/components/OngoingCallPage.qml | 328 +++++++++--------- src/mainview/components/ParticipantsLayer.qml | 6 +- 3 files changed, 170 insertions(+), 175 deletions(-) diff --git a/src/mainview/components/CallStackView.qml b/src/mainview/components/CallStackView.qml index 55d6fa8d3..98d58627d 100644 --- a/src/mainview/components/CallStackView.qml +++ b/src/mainview/components/CallStackView.qml @@ -108,19 +108,12 @@ Rectangle { } function toggleFullScreen() { - const transitionCb = function() { - if (!root.isAudioOnly) { - ongoingCallPage.handleParticipantsInfo( - CallAdapter.getConferencesInfos()) - } - } - if (!layoutManager.isCallFullscreen) { layoutManager.pushFullScreenItem( callStackMainView.currentItem, callStackMainView, - transitionCb, - transitionCb) + null, + null) } else { layoutManager.removeFullScreenItem( callStackMainView.currentItem) diff --git a/src/mainview/components/OngoingCallPage.qml b/src/mainview/components/OngoingCallPage.qml index c4515b6b6..2999976d1 100644 --- a/src/mainview/components/OngoingCallPage.qml +++ b/src/mainview/components/OngoingCallPage.qml @@ -33,6 +33,8 @@ import "../../commoncomponents" Rectangle { id: root + anchors.fill: parent + property var accountPeerPair: ["", ""] property variant clickPos: "1,1" property int previewMargin: 15 @@ -149,228 +151,226 @@ Rectangle { SplitView.minimumWidth: root.width / 2 + 20 SplitView.fillWidth: !mainColumnLayout.isHorizontal - MouseArea { - anchors.fill: parent - - hoverEnabled: true - propagateComposedEvents: true - + TapHandler { acceptedButtons: Qt.LeftButton | Qt.RightButton - onDoubleClicked: function (mouse) { - if (mouse.button === Qt.LeftButton) + onDoubleTapped: function (eventPoint, button) { + if (button === Qt.LeftButton) { callStackView.toggleFullScreen() + } } - onClicked: function (mouse) { - if (mouse.button === Qt.RightButton) - callOverlay.openCallViewContextMenuInPos(mouse.x, mouse.y) + onTapped: function (eventPoint, button) { + if (button === Qt.RightButton) { + callOverlay.openCallViewContextMenuInPos(eventPoint.position.x, + eventPoint.position.y) + } } + } - VideoView { - id: distantRenderer + VideoView { + id: distantRenderer - anchors.centerIn: parent - anchors.fill: parent - z: -1 + anchors.centerIn: parent + anchors.fill: parent + z: -1 - visible: participantsLayer.count === 0 && !root.isAudioOnly - } + visible: participantsLayer.count === 0 && !root.isAudioOnly + } - ParticipantsLayer { - id: participantsLayer - anchors.fill: parent - anchors.centerIn: parent - anchors.margins: 3 - visible: participantsLayer.count !== 0 + ParticipantsLayer { + id: participantsLayer + anchors.fill: parent + anchors.centerIn: parent + anchors.margins: 3 + visible: participantsLayer.count !== 0 - onCountChanged: { - callOverlay.isConference = participantsLayer.count > 0 - } + onCountChanged: { + callOverlay.isConference = participantsLayer.count > 0 } + } - LocalVideo { - id: previewRenderer + LocalVideo { + id: previewRenderer - visible: !callOverlay.isAudioOnly && participantsLayer.count == 0 && !callOverlay.isVideoMuted && !callOverlay.isPaused && - ((VideoDevices.listSize !== 0 && AvAdapter.currentRenderingDeviceType === Video.DeviceType.CAMERA) || AvAdapter.currentRenderingDeviceType !== Video.DeviceType.CAMERA ) + visible: !callOverlay.isAudioOnly && participantsLayer.count == 0 && !callOverlay.isVideoMuted && !callOverlay.isPaused && + ((VideoDevices.listSize !== 0 && AvAdapter.currentRenderingDeviceType === Video.DeviceType.CAMERA) || AvAdapter.currentRenderingDeviceType !== Video.DeviceType.CAMERA ) - rendererId: root.callPreviewId + rendererId: root.callPreviewId - height: width * invAspectRatio - width: Math.max(callPageMainRect.width / 5, JamiTheme.minimumPreviewWidth) - x: callPageMainRect.width - previewRenderer.width - previewMargin - y: previewMarginYTop + height: width * invAspectRatio + width: Math.max(callPageMainRect.width / 5, JamiTheme.minimumPreviewWidth) + x: callPageMainRect.width - previewRenderer.width - previewMargin + y: previewMarginYTop - states: [ - State { - name: "geoChanging" - PropertyChanges { - target: previewRenderer - x: previewToX - y: previewToY - } + states: [ + State { + name: "geoChanging" + PropertyChanges { + target: previewRenderer + x: previewToX + y: previewToY } - ] + } + ] - transitions: Transition { - PropertyAnimation { - properties: "x,y" - easing.type: Easing.OutExpo - duration: 250 + transitions: Transition { + PropertyAnimation { + properties: "x,y" + easing.type: Easing.OutExpo + duration: 250 - onStopped: { - previewRenderer.state = "" - } + onStopped: { + previewRenderer.state = "" } } + } - MouseArea { - id: dragMouseArea + MouseArea { + id: dragMouseArea - anchors.fill: previewRenderer + anchors.fill: previewRenderer - onPressed: function (mouse) { - clickPos = Qt.point(mouse.x, mouse.y) - } + onPressed: function (mouse) { + clickPos = Qt.point(mouse.x, mouse.y) + } - onReleased: { - previewRenderer.state = "" - previewMagneticSnap() - } + onReleased: { + previewRenderer.state = "" + previewMagneticSnap() + } - onPositionChanged: function (mouse) { - // Calculate mouse position relative change. - var delta = Qt.point(mouse.x - clickPos.x, - mouse.y - clickPos.y) - var deltaW = previewRenderer.x + delta.x + previewRenderer.width - var deltaH = previewRenderer.y + delta.y + previewRenderer.height - - // Check if the previewRenderer exceeds the border of callPageMainRect. - if (deltaW < callPageMainRect.width - && previewRenderer.x + delta.x > 1) - previewRenderer.x += delta.x - if (deltaH < callPageMainRect.height - && previewRenderer.y + delta.y > 1) - previewRenderer.y += delta.y - } + onPositionChanged: function (mouse) { + // Calculate mouse position relative change. + var delta = Qt.point(mouse.x - clickPos.x, + mouse.y - clickPos.y) + var deltaW = previewRenderer.x + delta.x + previewRenderer.width + var deltaH = previewRenderer.y + delta.y + previewRenderer.height + + // Check if the previewRenderer exceeds the border of callPageMainRect. + if (deltaW < callPageMainRect.width + && previewRenderer.x + delta.x > 1) + previewRenderer.x += delta.x + if (deltaH < callPageMainRect.height + && previewRenderer.y + delta.y > 1) + previewRenderer.y += delta.y } + } - layer.enabled: true - layer.effect: OpacityMask { - maskSource: Rectangle { - width: previewRenderer.width - height: previewRenderer.height - radius: JamiTheme.primaryRadius - } + layer.enabled: true + layer.effect: OpacityMask { + maskSource: Rectangle { + width: previewRenderer.width + height: previewRenderer.height + radius: JamiTheme.primaryRadius } } + } - CallOverlay { - id: callOverlay + CallOverlay { + id: callOverlay - anchors.fill: parent - isConference: participantsLayer.count > 0 + anchors.fill: parent + isConference: participantsLayer.count > 0 - function toggleConversation() { - if (inCallMessageWebViewStack.visible) - closeInCallConversation() - else - openInCallConversation() - } + function toggleConversation() { + if (inCallMessageWebViewStack.visible) + closeInCallConversation() + else + openInCallConversation() + } - Connections { - target: CallAdapter + Connections { + target: CallAdapter - function onUpdateOverlay(isPaused, isAudioOnly, isAudioMuted, isVideoMuted, - isSIP, isGrid, previewId) { - if (previewId != "") { - if (root.callPreviewId != previewId) - VideoDevices.stopDevice(root.callPreviewId, true) - VideoDevices.startDevice(previewId) - } else { + function onUpdateOverlay(isPaused, isAudioOnly, isAudioMuted, isVideoMuted, + isSIP, isGrid, previewId) { + if (previewId != "") { + if (root.callPreviewId != previewId) VideoDevices.stopDevice(root.callPreviewId, true) - } - root.callPreviewId = previewId - callOverlay.showOnHoldImage(isPaused) - root.isAudioOnly = isAudioOnly - callOverlay.showOnHoldImage(isPaused) - audioCallPageRectCentralRect.visible = !isPaused && root.isAudioOnly && participantsLayer.count === 0 - callOverlay.updateUI(isPaused, isAudioOnly, - isAudioMuted, isVideoMuted, - isSIP, - isGrid) + VideoDevices.startDevice(previewId) + } else { + VideoDevices.stopDevice(root.callPreviewId, true) } + root.callPreviewId = previewId + callOverlay.showOnHoldImage(isPaused) + root.isAudioOnly = isAudioOnly + callOverlay.showOnHoldImage(isPaused) + audioCallPageRectCentralRect.visible = !isPaused && root.isAudioOnly && participantsLayer.count === 0 + callOverlay.updateUI(isPaused, isAudioOnly, + isAudioMuted, isVideoMuted, + isSIP, + isGrid) + } - function onShowOnHoldLabel(isPaused) { - callOverlay.showOnHoldImage(isPaused) - audioCallPageRectCentralRect.visible = !isPaused && root.isAudioOnly && participantsLayer.count === 0 - } + function onShowOnHoldLabel(isPaused) { + callOverlay.showOnHoldImage(isPaused) + audioCallPageRectCentralRect.visible = !isPaused && root.isAudioOnly && participantsLayer.count === 0 + } - function onRemoteRecordingChanged(label, state) { - callOverlay.showRemoteRecording(label, state) - } + function onRemoteRecordingChanged(label, state) { + callOverlay.showRemoteRecording(label, state) + } - function onEraseRemoteRecording() { - callOverlay.resetRemoteRecording() - } + function onEraseRemoteRecording() { + callOverlay.resetRemoteRecording() } + } - Connections { - target: MessagesAdapter - enabled: root.visible + Connections { + target: MessagesAdapter + enabled: root.visible - function onNewInteraction(interactionType) { - // Ignore call notifications, as we are in the call. - if (interactionType !== Interaction.Type.CALL && !inCallMessageWebViewStack.visible) - openInCallConversation() - } + function onNewInteraction(interactionType) { + // Ignore call notifications, as we are in the call. + if (interactionType !== Interaction.Type.CALL && !inCallMessageWebViewStack.visible) + openInCallConversation() } + } - onChatButtonClicked: { - inCallMessageWebViewStack.visible ? - closeInCallConversation() : - openInCallConversation() - } + onChatButtonClicked: { + inCallMessageWebViewStack.visible ? + closeInCallConversation() : + openInCallConversation() + } - onFullScreenClicked: { - callStackView.toggleFullScreen() - } + onFullScreenClicked: { + callStackView.toggleFullScreen() } + } - ColumnLayout { - id: audioCallPageRectCentralRect - anchors.centerIn: parent - anchors.left: parent.left - anchors.right: parent.right + ColumnLayout { + id: audioCallPageRectCentralRect + anchors.centerIn: parent + anchors.left: parent.left + anchors.right: parent.right - visible: root.isAudioOnly + visible: root.isAudioOnly - ConversationAvatar { - id: contactImage + ConversationAvatar { + id: contactImage - Layout.alignment: Qt.AlignCenter - Layout.preferredWidth: JamiTheme.avatarSizeInCall - Layout.preferredHeight: JamiTheme.avatarSizeInCall + Layout.alignment: Qt.AlignCenter + Layout.preferredWidth: JamiTheme.avatarSizeInCall + Layout.preferredHeight: JamiTheme.avatarSizeInCall - showPresenceIndicator: false - } + showPresenceIndicator: false + } - Text { - Layout.alignment: Qt.AlignCenter - Layout.topMargin: JamiTheme.preferredMarginSize + Text { + Layout.alignment: Qt.AlignCenter + Layout.topMargin: JamiTheme.preferredMarginSize - Layout.preferredWidth: root.width + Layout.preferredWidth: root.width - font.pointSize: JamiTheme.titleFontSize + font.pointSize: JamiTheme.titleFontSize - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter - text: CurrentConversation.title - elide: Text.ElideMiddle - color: "white" - } + text: CurrentConversation.title + elide: Text.ElideMiddle + color: "white" } } diff --git a/src/mainview/components/ParticipantsLayer.qml b/src/mainview/components/ParticipantsLayer.qml index 31e45d862..9d8d44175 100644 --- a/src/mainview/components/ParticipantsLayer.qml +++ b/src/mainview/components/ParticipantsLayer.qml @@ -98,6 +98,8 @@ Item { Rectangle { id: genericParticipantsRect + TapHandler { acceptedButtons: Qt.LeftButton | Qt.RightButton } + SplitView.preferredHeight: (parent.height / 4) SplitView.minimumHeight: parent.height / 6 SplitView.maximumHeight: inLine? parent.height / 2 : parent.height @@ -121,8 +123,6 @@ Item { RowLayout { anchors.fill: parent - anchors.centerIn: parent - z: 1 RoundButton { Layout.alignment: Qt.AlignVCenter @@ -256,6 +256,8 @@ Item { Flow { id: activeParticipantsFlow + TapHandler { acceptedButtons: Qt.LeftButton | Qt.RightButton } + SplitView.minimumHeight: parent.height / 4 SplitView.maximumHeight: parent.height SplitView.fillHeight: true -- GitLab