From a13c6ae0e74ca0e648b40cfe94e930e79e61139d Mon Sep 17 00:00:00 2001 From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> Date: Fri, 16 Feb 2024 17:40:32 -0500 Subject: [PATCH] ongoingcallpage: resize + change opacity of local preview This is an experimental feature and is unadvertised for now. Change-Id: I40aa84f54c135c2060552231d4ed7c2de4976ca3 --- .../mainview/components/OngoingCallPage.qml | 43 +++++++++++++++++-- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/src/app/mainview/components/OngoingCallPage.qml b/src/app/mainview/components/OngoingCallPage.qml index 39cebf278..429ca7d92 100644 --- a/src/app/mainview/components/OngoingCallPage.qml +++ b/src/app/mainview/components/OngoingCallPage.qml @@ -176,7 +176,12 @@ Rectangle { visibilityCondition: (CurrentCall.isSharing || !CurrentCall.isVideoMuted) && !CurrentCall.isConference height: width * invAspectRatio - width: Math.max(container.width / 5, JamiTheme.minimumPreviewWidth) + + // Keep the area of the preview a proportion of the screen size plus a + // modifier to allow the user to scale it. + readonly property real containerArea: container.width * container.height + property real scalingFactor: 1 + width: Math.sqrt(containerArea / 16) * scalingFactor flip: CurrentCall.flipSelf && !CurrentCall.isSharing blurRadius: hidden ? 25 : 0 onCallPreviewIdChanged: startWithId(callPreviewId) @@ -206,10 +211,23 @@ Rectangle { objectName: "hidePreviewButton" width: localPreview.hiddenHandleSize - state: localPreview.onLeft ? - (localPreview.hidden ? "right" : "left") : - (localPreview.hidden ? "left" : "right") + state: { + if (!localPreview.anchored) { + return "none"; + } + return localPreview.onLeft ? + (localPreview.hidden ? "right" : "left") : + (localPreview.hidden ? "left" : "right") + } states: [ + State { + name: "none" + // Override visible to false when the localPreview isn't anchored. + PropertyChanges { + target: hidePreviewButton + visible: false + } + }, State { name: "left" AnchorChanges { @@ -304,6 +322,23 @@ Rectangle { id: hoverHandler } + WheelHandler { + onWheel: function(event) { + const delta = event.angleDelta.y / 120 * 0.1; + parent.opacity = JamiQmlUtils.clamp(parent.opacity + delta, 0.25, 1); + } + acceptedModifiers: Qt.CTRL + } + + WheelHandler { + onWheel: function(event) { + const delta = event.angleDelta.y / 120 * 0.1; + localPreview.scalingFactor = JamiQmlUtils.clamp(localPreview.scalingFactor + delta, 0.5, 4); + } + acceptedModifiers: Qt.NoModifier + enabled: !localPreview.hidden + } + DragHandler { id: dragHandler readonly property var container: localPreview.container -- GitLab