linphone-desktop/Linphone/view/Item/Contact/Sticker.qml
Gaelle Braud c588688197 FIXES:
correctly initialize remote params + create video call
paused call ui
calls window
simplify carousel
effect image : don't show effect if no colorization
use our custom button instead of qtquick one
image buttons size
security page ui
update right panel on call history deleted
2024-02-14 16:02:43 +01:00

127 lines
3.5 KiB
QML

import QtQuick
import QtQuick.Effects
import QtQuick.Layouts
import QtQuick.Controls as Control
import Linphone
import UtilsCpp 1.0
// Display a sticker from a call or from an account.
// The Avatar is shown while the camera become available.
// The loader restart in case of resetting the renderer. This allow to display the avatar while loading.
// TODO: sizes, colors, decorations
Item {
id: mainItem
height: 300
width: 200
property CallGui call: null
property AccountGui account: null
property bool enablePersonalCamera: false
onEnablePersonalCameraChanged: console.log ("enable camera", enablePersonalCamera)
property color color: DefaultStyle.grey_600
property int radius: 15 * DefaultStyle.dp
property var peerAddressObj: call ? UtilsCpp.getDisplayName(call.core.peerAddress) : null
property string peerAddress: peerAddressObj ? peerAddressObj.value : ""
property var identityAddress: account ? UtilsCpp.getDisplayName(account.core.identityAddress) : null
Rectangle {
id: background
color: mainItem.color
radius: mainItem.radius
anchors.fill: parent
ColumnLayout {
anchors.centerIn: parent
visible: !cameraLoader.active || cameraLoader.status != Loader.Ready || !cameraLoader.item.isReady
Avatar{
Layout.alignment: Qt.AlignHCenter
height: 100
width: height
account: mainItem.account
call: mainItem.call
}
Text {
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 15 * DefaultStyle.dp
visible: mainItem.call && mainItem.call != undefined
text: mainItem.peerAddress
color: DefaultStyle.grey_0
font {
pixelSize: 22 * DefaultStyle.dp
weight: 300 * DefaultStyle.dp
capitalization: Font.Capitalize
}
}
Text {
Layout.alignment: Qt.AlignHCenter
visible: mainItem.call && mainItem.call != undefined
text: mainItem.call && mainItem.call.core.peerAddress
color: DefaultStyle.grey_0
font {
pixelSize: 14 * DefaultStyle.dp
weight: 300 * DefaultStyle.dp
}
}
}
Loader{
id: cameraLoader
anchors.fill: parent
Timer{
id: resetTimer
interval: 1
onTriggered: {cameraLoader.active=false; cameraLoader.active=true;}
}
active: mainItem.visible && call
? call.core.remoteVideoEnabled && (mainItem.call.core.state != LinphoneEnums.CallState.End
&& mainItem.call.core.state != LinphoneEnums.CallState.Released)
: mainItem.enablePersonalCamera
onActiveChanged: console.log("camera active", active)
sourceComponent: cameraComponent
}
Component{
id: cameraComponent
Item {
height: cameraLoader.height
width: cameraLoader.width
property bool isReady: cameraItem.visible
CameraGui{
id: cameraItem
anchors.fill: parent
visible: isReady
call: mainItem.call
onRequestNewRenderer: {
console.log("Request new renderer")
resetTimer.restart()
}
}
}
}
Text {
id: bottomAddress
anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.leftMargin: 10 * DefaultStyle.dp
anchors.bottomMargin: 10 * DefaultStyle.dp
width: implicitWidth
text: mainItem.peerAddress.length != 0
? mainItem.peerAddress
: mainItem.account && mainItem.identityAddress
? mainItem.identityAddress.value
: ""
color: DefaultStyle.grey_0
font {
pixelSize: 14 * DefaultStyle.dp
weight: 500 * DefaultStyle.dp
}
}
}
MultiEffect {
id: shadow
source: background
anchors.fill: background
shadowEnabled: true
shadowColor: DefaultStyle.grey_1000
shadowBlur: 1
shadowOpacity: 0.4
}
}