From 84950e70b5c47a71c4a6d15571eaad8036009d7d Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Thu, 15 Feb 2024 09:49:58 +0100 Subject: [PATCH] fix buttons icons size + update preview position when right panel is open --- Linphone/tool/Utils.cpp | 4 +-- Linphone/view/App/CallsWindow.qml | 29 +++++++++++++++---- .../view/Item/Call/OngoingCallRightPanel.qml | 9 +++--- Linphone/view/Item/MovableMouseArea.qml | 14 ++++----- 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/Linphone/tool/Utils.cpp b/Linphone/tool/Utils.cpp index 92a9ee37..03a17543 100644 --- a/Linphone/tool/Utils.cpp +++ b/Linphone/tool/Utils.cpp @@ -276,8 +276,8 @@ QString Utils::generateLinphoneSipAddress(const QString &uri) { if (!ret.startsWith("sip:")) { ret.prepend("sip:"); } - if (!ret.endsWith("@sip.linhpone.org")) { - ret.append("@sip.linhpone.org"); + if (!ret.endsWith("@sip.linphone.org")) { + ret.append("@sip.linphone.org"); } return ret; } diff --git a/Linphone/view/App/CallsWindow.qml b/Linphone/view/App/CallsWindow.qml index 2be73d53..567dbd32 100644 --- a/Linphone/view/App/CallsWindow.qml +++ b/Linphone/view/App/CallsWindow.qml @@ -130,8 +130,8 @@ Window { radius: 71 * DefaultStyle.dp } icon.source: disabledIcon && bottomButton.checked ? disabledIcon : enabledIcon - height: 32 * DefaultStyle.dp - width: 32 * DefaultStyle.dp + icon.width: 32 * DefaultStyle.dp + icon.height: 32 * DefaultStyle.dp contentImageColor: DefaultStyle.grey_0 } ZrtpTokenAuthenticationDialog { @@ -424,24 +424,41 @@ Window { account: accounts.defaultAccount enablePersonalCamera: mainWindow.call.core.cameraEnabled - MovableMouseArea{ + MovableMouseArea { + id: previewMouseArea anchors.fill: parent // visible: mainItem.participantCount <= 2 + movableArea: centerItem + margin: 10 * DefaultStyle.dp function resetPosition(){ preview.anchors.right = centerItem.right preview.anchors.bottom = centerItem.bottom + preview.anchors.rightMargin = previewMouseArea.margin + preview.anchors.bottomMargin = previewMouseArea.margin } onVisibleChanged: if(!visible){ resetPosition() } drag.target: preview - onDraggingChanged: if(dragging){ + onDraggingChanged: if(dragging) { preview.anchors.right = undefined preview.anchors.bottom = undefined } onRequestResetPosition: resetPosition() } } + property int previousWidth + Component.onCompleted: { + previousWidth = width + } + onWidthChanged: { + if (width < previousWidth) { + previewMouseArea.updatePosition(0, 0) + } else { + previewMouseArea.updatePosition(width - previousWidth, 0) + } + previousWidth = width + } } } OngoingCallRightPanel { @@ -845,7 +862,7 @@ Window { onClicked: { rightPanel.visible = true rightPanel.replace(callsListPanel) - moreOptionsMenu.close() + moreOptionsButton.close() } } Button { @@ -868,7 +885,7 @@ Window { onClicked: { rightPanel.visible = true rightPanel.replace(dialerPanel) - moreOptionsMenu.close() + moreOptionsButton.close() } } Button { diff --git a/Linphone/view/Item/Call/OngoingCallRightPanel.qml b/Linphone/view/Item/Call/OngoingCallRightPanel.qml index 9bd6037e..19ae99b9 100644 --- a/Linphone/view/Item/Call/OngoingCallRightPanel.qml +++ b/Linphone/view/Item/Call/OngoingCallRightPanel.qml @@ -27,7 +27,6 @@ Control.Page { y: pageHeader.height/2 height: pageHeader.height/2 width: pageHeader.width - } } contentItem: RowLayout { @@ -48,10 +47,10 @@ Control.Page { visible: false } icon.source: AppIcons.closeX - Layout.preferredWidth: 10 * DefaultStyle.dp - Layout.preferredHeight: 10 * DefaultStyle.dp - width: 10 * DefaultStyle.dp - height: 10 * DefaultStyle.dp + Layout.preferredWidth: 24 * DefaultStyle.dp + Layout.preferredHeight: 24 * DefaultStyle.dp + icon.width: 24 * DefaultStyle.dp + icon.height: 24 * DefaultStyle.dp onClicked: mainItem.visible = false } } diff --git a/Linphone/view/Item/MovableMouseArea.qml b/Linphone/view/Item/MovableMouseArea.qml index d1821d1a..a2fcee57 100644 --- a/Linphone/view/Item/MovableMouseArea.qml +++ b/Linphone/view/Item/MovableMouseArea.qml @@ -12,8 +12,8 @@ MouseArea{ xClicked = mouseX yClicked = mouseY } - } + property int margin: 0 // Position buffer property int xClicked : 0 property int yClicked : 0 @@ -29,6 +29,7 @@ MouseArea{ preventStealing: true propagateComposedEvents: true hoverEnabled: true + onMScaleChanged: updateScale() function updateScale(){// Avoid scaling if leading outside movableArea. drag.target.height = Math.max(0, Math.min(movableArea.height, heightOrigin * mScale)) @@ -38,17 +39,16 @@ MouseArea{ function updatePosition(x, y){// Avoid moving outside movableArea. var parentTLBounds = drag.target.parent.mapFromItem(movableArea, 0, 0); var parentBRBounds = drag.target.parent.mapFromItem(movableArea, movableArea.width, movableArea.height); - drag.target.x = Math.max(parentTLBounds.x, Math.min(parentBRBounds.x - drag.target.width, drag.target.x + x)) - drag.target.y = Math.max(parentTLBounds.y, Math.min(parentBRBounds.y - drag.target.height, drag.target.y + y)) + drag.target.x = Math.max(parentTLBounds.x + margin, Math.min(parentBRBounds.x - drag.target.width - margin, drag.target.x + x - margin)) + drag.target.y = Math.max(parentTLBounds.y + margin, Math.min(parentBRBounds.y - drag.target.height - margin, drag.target.y + y - margin)) } - onMScaleChanged: updateScale() - onPositionChanged: { + onPositionChanged: (mouse) => { if(dragging){ updatePosition(mouse.x - xClicked, mouse.y - yClicked) } mouse.accepted = false } - onWheel: { + onWheel: (wheel) => { if(!scaled){ scaled = true heightOrigin = drag.target.height @@ -67,7 +67,7 @@ MouseArea{ mScale = Math.max(0.5 , mScale * ( 1 + acceleration*(wheel.angleDelta.y >0 ? 1 : -1) )); startTime = new Date().getTime(); } - onClicked: { + onClicked: (mouse) => { if(mouse.button == Qt.RightButton){ if(scaled) { scaled = false