1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-21 15:24:01 +02:00

call: show context menu when right clicking the call page

Gitlab: #80
Change-Id: Ic2c2563e05a11f33230518ee93ef4a1d9dd80d50
This commit is contained in:
Ming Rui Zhang 2020-09-23 10:40:52 -04:00 committed by Andreas Traczyk
parent 7ea5a5deee
commit d057fa1ba8
4 changed files with 31 additions and 18 deletions

View file

@ -231,5 +231,15 @@ Rectangle {
} }
} }
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
onClicked: {
audioCallOverlay.openCallViewContextMenuInPos(mouse.x, mouse.y)
}
}
color: "black" color: "black"
} }

View file

@ -114,6 +114,14 @@ Rectangle {
} }
} }
// x, y position does not need to be translated
// since they all fill the call page
function openCallViewContextMenuInPos(x, y) {
callViewContextMenu.x = x
callViewContextMenu.y = y
callViewContextMenu.openMenu()
}
anchors.fill: parent anchors.fill: parent
SipInputPanel { SipInputPanel {
@ -344,7 +352,6 @@ Rectangle {
} }
} }
// MouseAreas to make sure that overlay states are correctly set. // MouseAreas to make sure that overlay states are correctly set.
MouseArea { MouseArea {
id: callOverlayButtonGroupLeftSideMouseArea id: callOverlayButtonGroupLeftSideMouseArea

View file

@ -228,9 +228,10 @@ Rectangle {
onClicked: { onClicked: {
var rectPos = mapToItem(callStackViewWindow, optionsButton.x, optionsButton.y) var rectPos = mapToItem(callStackViewWindow, optionsButton.x, optionsButton.y)
callViewContextMenu.openMenu() callViewContextMenu.x = rectPos.x + optionsButton.width / 2
callViewContextMenu.x = rectPos.x + optionsButton.width/2 - callViewContextMenu.width/2 - callViewContextMenu.width / 2
callViewContextMenu.y = rectPos.y - 12 - callViewContextMenu.height callViewContextMenu.y = rectPos.y - 12 - callViewContextMenu.height
callViewContextMenu.openMenu()
} }
} }

View file

@ -87,8 +87,6 @@ Rectangle {
} }
function previewMagneticSnap() { function previewMagneticSnap() {
// Calculate the position where the previewRenderer should attach to. // Calculate the position where the previewRenderer should attach to.
var previewRendererCenter = Qt.point( var previewRendererCenter = Qt.point(
previewRenderer.x + previewRenderer.width / 2, previewRenderer.x + previewRenderer.width / 2,
@ -99,8 +97,6 @@ Rectangle {
if (previewRendererCenter.x >= distantRendererCenter.x) { if (previewRendererCenter.x >= distantRendererCenter.x) {
if (previewRendererCenter.y >= distantRendererCenter.y) { if (previewRendererCenter.y >= distantRendererCenter.y) {
// Bottom right. // Bottom right.
previewToX = Qt.binding(function () { previewToX = Qt.binding(function () {
return videoCallPageMainRect.width - previewRenderer.width - previewMargin return videoCallPageMainRect.width - previewRenderer.width - previewMargin
@ -109,8 +105,6 @@ Rectangle {
return videoCallPageMainRect.height - previewRenderer.height - previewMarginY return videoCallPageMainRect.height - previewRenderer.height - previewMarginY
}) })
} else { } else {
// Top right. // Top right.
previewToX = Qt.binding(function () { previewToX = Qt.binding(function () {
return videoCallPageMainRect.width - previewRenderer.width - previewMargin return videoCallPageMainRect.width - previewRenderer.width - previewMargin
@ -119,16 +113,12 @@ Rectangle {
} }
} else { } else {
if (previewRendererCenter.y >= distantRendererCenter.y) { if (previewRendererCenter.y >= distantRendererCenter.y) {
// Bottom left. // Bottom left.
previewToX = previewMargin previewToX = previewMargin
previewToY = Qt.binding(function () { previewToY = Qt.binding(function () {
return videoCallPageMainRect.height - previewRenderer.height - previewMarginY return videoCallPageMainRect.height - previewRenderer.height - previewMarginY
}) })
} else { } else {
// Top left. // Top left.
previewToX = previewMargin previewToX = previewMargin
previewToY = previewMarginY previewToY = previewMarginY
@ -152,7 +142,6 @@ Rectangle {
color: SplitHandle.pressed ? JamiTheme.pressColor : (SplitHandle.hovered ? JamiTheme.hoverColor : JamiTheme.tabbarBorderColor) color: SplitHandle.pressed ? JamiTheme.pressColor : (SplitHandle.hovered ? JamiTheme.hoverColor : JamiTheme.tabbarBorderColor)
} }
Rectangle { Rectangle {
id: videoCallPageMainRect id: videoCallPageMainRect
SplitView.preferredHeight: (videoCallPageRect.height / 3) * 2 SplitView.preferredHeight: (videoCallPageRect.height / 3) * 2
@ -236,7 +225,6 @@ Rectangle {
VideoCallPreviewRenderer { VideoCallPreviewRenderer {
id: previewRenderer id: previewRenderer
// Property is used in the {} expression for height (extra dependency), // Property is used in the {} expression for height (extra dependency),
// it will not affect the true height expression, since expression // it will not affect the true height expression, since expression
// at last will be taken only, but it will force the height to update // at last will be taken only, but it will force the height to update
@ -298,8 +286,6 @@ Rectangle {
} }
onPositionChanged: { onPositionChanged: {
// Calculate mouse position relative change. // Calculate mouse position relative change.
var delta = Qt.point(mouse.x - clickPos.x, var delta = Qt.point(mouse.x - clickPos.x,
mouse.y - clickPos.y) mouse.y - clickPos.y)
@ -327,7 +313,6 @@ Rectangle {
color: "transparent" color: "transparent"
} }
StackView { StackView {
id: inVideoCallMessageWebViewStack id: inVideoCallMessageWebViewStack
@ -340,6 +325,16 @@ Rectangle {
} }
} }
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
onClicked: {
videoCallOverlay.openCallViewContextMenuInPos(mouse.x, mouse.y)
}
}
onBestNameChanged: { onBestNameChanged: {
ContactAdapter.setCalleeDisplayName(bestName) ContactAdapter.setCalleeDisplayName(bestName)
} }