fix buttons icons size + update preview position when right panel is open

This commit is contained in:
Gaelle Braud 2024-02-15 09:49:58 +01:00
parent c588688197
commit 84950e70b5
4 changed files with 36 additions and 20 deletions

View file

@ -276,8 +276,8 @@ QString Utils::generateLinphoneSipAddress(const QString &uri) {
if (!ret.startsWith("sip:")) { if (!ret.startsWith("sip:")) {
ret.prepend("sip:"); ret.prepend("sip:");
} }
if (!ret.endsWith("@sip.linhpone.org")) { if (!ret.endsWith("@sip.linphone.org")) {
ret.append("@sip.linhpone.org"); ret.append("@sip.linphone.org");
} }
return ret; return ret;
} }

View file

@ -130,8 +130,8 @@ Window {
radius: 71 * DefaultStyle.dp radius: 71 * DefaultStyle.dp
} }
icon.source: disabledIcon && bottomButton.checked ? disabledIcon : enabledIcon icon.source: disabledIcon && bottomButton.checked ? disabledIcon : enabledIcon
height: 32 * DefaultStyle.dp icon.width: 32 * DefaultStyle.dp
width: 32 * DefaultStyle.dp icon.height: 32 * DefaultStyle.dp
contentImageColor: DefaultStyle.grey_0 contentImageColor: DefaultStyle.grey_0
} }
ZrtpTokenAuthenticationDialog { ZrtpTokenAuthenticationDialog {
@ -424,24 +424,41 @@ Window {
account: accounts.defaultAccount account: accounts.defaultAccount
enablePersonalCamera: mainWindow.call.core.cameraEnabled enablePersonalCamera: mainWindow.call.core.cameraEnabled
MovableMouseArea{ MovableMouseArea {
id: previewMouseArea
anchors.fill: parent anchors.fill: parent
// visible: mainItem.participantCount <= 2 // visible: mainItem.participantCount <= 2
movableArea: centerItem
margin: 10 * DefaultStyle.dp
function resetPosition(){ function resetPosition(){
preview.anchors.right = centerItem.right preview.anchors.right = centerItem.right
preview.anchors.bottom = centerItem.bottom preview.anchors.bottom = centerItem.bottom
preview.anchors.rightMargin = previewMouseArea.margin
preview.anchors.bottomMargin = previewMouseArea.margin
} }
onVisibleChanged: if(!visible){ onVisibleChanged: if(!visible){
resetPosition() resetPosition()
} }
drag.target: preview drag.target: preview
onDraggingChanged: if(dragging){ onDraggingChanged: if(dragging) {
preview.anchors.right = undefined preview.anchors.right = undefined
preview.anchors.bottom = undefined preview.anchors.bottom = undefined
} }
onRequestResetPosition: resetPosition() 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 { OngoingCallRightPanel {
@ -845,7 +862,7 @@ Window {
onClicked: { onClicked: {
rightPanel.visible = true rightPanel.visible = true
rightPanel.replace(callsListPanel) rightPanel.replace(callsListPanel)
moreOptionsMenu.close() moreOptionsButton.close()
} }
} }
Button { Button {
@ -868,7 +885,7 @@ Window {
onClicked: { onClicked: {
rightPanel.visible = true rightPanel.visible = true
rightPanel.replace(dialerPanel) rightPanel.replace(dialerPanel)
moreOptionsMenu.close() moreOptionsButton.close()
} }
} }
Button { Button {

View file

@ -27,7 +27,6 @@ Control.Page {
y: pageHeader.height/2 y: pageHeader.height/2
height: pageHeader.height/2 height: pageHeader.height/2
width: pageHeader.width width: pageHeader.width
} }
} }
contentItem: RowLayout { contentItem: RowLayout {
@ -48,10 +47,10 @@ Control.Page {
visible: false visible: false
} }
icon.source: AppIcons.closeX icon.source: AppIcons.closeX
Layout.preferredWidth: 10 * DefaultStyle.dp Layout.preferredWidth: 24 * DefaultStyle.dp
Layout.preferredHeight: 10 * DefaultStyle.dp Layout.preferredHeight: 24 * DefaultStyle.dp
width: 10 * DefaultStyle.dp icon.width: 24 * DefaultStyle.dp
height: 10 * DefaultStyle.dp icon.height: 24 * DefaultStyle.dp
onClicked: mainItem.visible = false onClicked: mainItem.visible = false
} }
} }

View file

@ -12,8 +12,8 @@ MouseArea{
xClicked = mouseX xClicked = mouseX
yClicked = mouseY yClicked = mouseY
} }
} }
property int margin: 0
// Position buffer // Position buffer
property int xClicked : 0 property int xClicked : 0
property int yClicked : 0 property int yClicked : 0
@ -29,6 +29,7 @@ MouseArea{
preventStealing: true preventStealing: true
propagateComposedEvents: true propagateComposedEvents: true
hoverEnabled: true hoverEnabled: true
onMScaleChanged: updateScale()
function updateScale(){// Avoid scaling if leading outside movableArea. function updateScale(){// Avoid scaling if leading outside movableArea.
drag.target.height = Math.max(0, Math.min(movableArea.height, heightOrigin * mScale)) 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. function updatePosition(x, y){// Avoid moving outside movableArea.
var parentTLBounds = drag.target.parent.mapFromItem(movableArea, 0, 0); var parentTLBounds = drag.target.parent.mapFromItem(movableArea, 0, 0);
var parentBRBounds = drag.target.parent.mapFromItem(movableArea, movableArea.width, movableArea.height); 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.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, Math.min(parentBRBounds.y - drag.target.height, drag.target.y + y)) drag.target.y = Math.max(parentTLBounds.y + margin, Math.min(parentBRBounds.y - drag.target.height - margin, drag.target.y + y - margin))
} }
onMScaleChanged: updateScale() onPositionChanged: (mouse) => {
onPositionChanged: {
if(dragging){ if(dragging){
updatePosition(mouse.x - xClicked, mouse.y - yClicked) updatePosition(mouse.x - xClicked, mouse.y - yClicked)
} }
mouse.accepted = false mouse.accepted = false
} }
onWheel: { onWheel: (wheel) => {
if(!scaled){ if(!scaled){
scaled = true scaled = true
heightOrigin = drag.target.height heightOrigin = drag.target.height
@ -67,7 +67,7 @@ MouseArea{
mScale = Math.max(0.5 , mScale * ( 1 + acceleration*(wheel.angleDelta.y >0 ? 1 : -1) )); mScale = Math.max(0.5 , mScale * ( 1 + acceleration*(wheel.angleDelta.y >0 ? 1 : -1) ));
startTime = new Date().getTime(); startTime = new Date().getTime();
} }
onClicked: { onClicked: (mouse) => {
if(mouse.button == Qt.RightButton){ if(mouse.button == Qt.RightButton){
if(scaled) { if(scaled) {
scaled = false scaled = false