diff --git a/linphone-desktop/resources.qrc b/linphone-desktop/resources.qrc index f05a313ad..70d76d021 100644 --- a/linphone-desktop/resources.qrc +++ b/linphone-desktop/resources.qrc @@ -370,6 +370,7 @@ ui/views/App/Calls/Dialogs/CallTransfer.qml ui/views/App/Calls/Dialogs/ConferenceManager.qml ui/views/App/Calls/EndedCall.qml + ui/views/App/Calls/IncallAvatar.qml ui/views/App/Calls/IncallFullscreenWindow.qml ui/views/App/Calls/Incall.js ui/views/App/Calls/Incall.qml diff --git a/linphone-desktop/ui/views/App/Calls/Conference.qml b/linphone-desktop/ui/views/App/Calls/Conference.qml index 5aab9a103..bb95defeb 100644 --- a/linphone-desktop/ui/views/App/Calls/Conference.qml +++ b/linphone-desktop/ui/views/App/Calls/Conference.qml @@ -135,7 +135,7 @@ Rectangle { username: LinphoneUtils.getContactUsername(parent.sipAddressObserver.contact || parent.sipAddress) } - Avatar { + IncallAvatar { readonly property int size: Math.min( parent.width, parent.height - contactDescription.height - parent.spacing @@ -143,29 +143,20 @@ Rectangle { anchors.horizontalCenter: parent.horizontalCenter + call: $call + height: size width: size - backgroundColor: CallStyle.container.avatar.backgroundColor - foregroundColor: $call && $call.status === CallModel.CallStatusPaused - ? CallStyle.container.pause.color - : 'transparent' - - image: { - var contact = parent.sipAddressObserver.contact - if (contact) { - return contact.vcard.avatar - } - } - - username: contactDescription.username - BusyIndicator { + anchors { + horizontalCenter: parent.horizontalCenter + verticalCenter: parent.verticalCenter + } + color: CallStyle.header.busyIndicator.color height: CallStyle.header.busyIndicator.height width: CallStyle.header.busyIndicator.width - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter visible: $call && $call.status === CallModel.CallStatusOutgoing } diff --git a/linphone-desktop/ui/views/App/Calls/Incall.qml b/linphone-desktop/ui/views/App/Calls/Incall.qml index d4c0bdc4f..1554b0677 100644 --- a/linphone-desktop/ui/views/App/Calls/Incall.qml +++ b/linphone-desktop/ui/views/App/Calls/Incall.qml @@ -200,31 +200,11 @@ Rectangle { Component { id: avatar - Avatar { - backgroundColor: CallStyle.container.avatar.backgroundColor - foregroundColor: incall.call.status === CallModel.CallStatusPaused - ? CallStyle.container.pause.color - : 'transparent' - image: _sipAddressObserver.contact && _sipAddressObserver.contact.vcard.avatar - username: contactDescription.username + IncallAvatar { + call: incall.call height: Logic.computeAvatarSize(CallStyle.container.avatar.maxSize) width: height - - Text { - anchors.fill: parent - color: CallStyle.container.pause.text.color - - // `|| 1` => `pointSize` must be greater than 0. - font.pointSize: (width / CallStyle.container.pause.text.pointSizeFactor) || 1 - - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - - text: '▐ ▌' - textFormat: Text.RichText - visible: incall.call.status === CallModel.CallStatusPaused - } } } diff --git a/linphone-desktop/ui/views/App/Calls/IncallAvatar.qml b/linphone-desktop/ui/views/App/Calls/IncallAvatar.qml new file mode 100644 index 000000000..49bd5cd3d --- /dev/null +++ b/linphone-desktop/ui/views/App/Calls/IncallAvatar.qml @@ -0,0 +1,42 @@ +import QtQuick 2.7 + +import Linphone 1.0 +import LinphoneUtils 1.0 + +import App.Styles 1.0 + +// ============================================================================= + +Avatar { + property var call + + readonly property var _sipAddressObserver: SipAddressesModel.getSipAddressObserver(call.sipAddress) + readonly property var _username: LinphoneUtils.getContactUsername(_sipAddressObserver.contact || call.sipAddress) + + backgroundColor: CallStyle.container.avatar.backgroundColor + foregroundColor: call.status === CallModel.CallStatusPaused + ? CallStyle.container.pause.color + : 'transparent' + + image: { + var contact = _sipAddressObserver.contact + return contact && contact.vcard.avatar + } + + username: call.status === CallModel.CallStatusPaused ? '' : _username + + Text { + anchors.fill: parent + color: CallStyle.container.pause.text.color + + // `|| 1` => `pointSize` must be greater than 0. + font.pointSize: (width / CallStyle.container.pause.text.pointSizeFactor) || 1 + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + + text: '▐ ▌' + textFormat: Text.RichText + visible: call.status === CallModel.CallStatusPaused + } +}