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:")) {
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;
}

View file

@ -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 {

View file

@ -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
}
}

View file

@ -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