Update and clean contact design.

Display sender on incoming message.
This commit is contained in:
Julien Wadel 2022-09-01 14:46:25 +02:00
parent e0ae878eb9
commit 35c6f8f205
22 changed files with 144 additions and 131 deletions

View file

@ -15,8 +15,8 @@ Rectangle {
default property alias _content: content.data
property alias signIcon: signIcon.icon
property alias sipAddressColor: contact.sipAddressColor
property alias usernameColor: contact.usernameColor
property alias subtitleColor: contact.subtitleColor
property alias titleColor: contact.titleColor
property string peerAddress
property string localAddress

View file

@ -124,8 +124,8 @@ ListView {
: CallsStyle.entry.color.normal
textColor: isSelected
? CallsStyle.entry.usernameColor.selected
: CallsStyle.entry.usernameColor.normal
? CallsStyle.entry.titleColor.selected
: CallsStyle.entry.titleColor.normal
onClicked: Logic.resetSelectedCall()
onVisibleChanged: !visible && Logic.handleCountChanged(calls.count)
@ -149,12 +149,12 @@ ListView {
color: useColorStatus()
? CallsStyle.entry.color.selected
: CallsStyle.entry.color.normal
sipAddressColor: useColorStatus()
? CallsStyle.entry.sipAddressColor.selected
: CallsStyle.entry.sipAddressColor.normal
usernameColor: useColorStatus()
? CallsStyle.entry.usernameColor.selected
: CallsStyle.entry.usernameColor.normal
subtitleColor: useColorStatus()
? CallsStyle.entry.subtitleColor.selected
: CallsStyle.entry.subtitleColor.normal
titleColor: useColorStatus()
? CallsStyle.entry.titleColor.selected
: CallsStyle.entry.titleColor.normal
signIcon: {
var params = loader.params

View file

@ -18,23 +18,24 @@ Rectangle {
property var entry
// entry should have these functions : presenceStatus, sipAddress, username, avatar (image)
property alias sipAddressColor: description.sipAddressColor
property alias usernameColor: description.usernameColor
property alias subtitleColor: description.subtitleColor
property alias titleColor: description.titleColor
property alias statusText : description.statusText
property bool displayUnreadMessageCount: false
property bool showContactAddress : true
property bool showAuxData : false
property bool showSubtitle : true
property string subtitle: ''
property string username: (entry != undefined
? entry.conferenceInfoModel && entry.conferenceInfoModel.subject
property string subject: (entry != undefined && entry.conferenceInfoModel && entry.conferenceInfoModel.subject
? entry.conferenceInfoModel.subject
: entry.username != undefined
: '')
property string username: (entry != undefined && entry.username != undefined
? entry.username
: entry.contactModel != undefined
? entry.contactModel.vcard.username
: UtilsCpp.getDisplayName(entry.sipAddress || entry.fullPeerAddress || entry.peerAddress || '')
: '')
: UtilsCpp.getDisplayName(entry.sipAddress || entry.fullPeerAddress || entry.peerAddress || ''))
property string organizer: entry.conferenceInfoModel ? UtilsCpp.getDisplayName(entry.conferenceInfoModel.organizer) : ''
signal avatarClicked(var mouse)
// ---------------------------------------------------------------------------
@ -65,16 +66,13 @@ Rectangle {
)
:-1
//username: UtilsCpp.getDisplayName(entry.sipAddress || entry.peerAddress )
username : entry!=undefined
username: entry!=undefined
? entry.conferenceInfoModel
? UtilsCpp.getDisplayName(entry.conferenceInfoModel.organizer)
? item.organizer
: entry.isOneToOne!=undefined && !entry.isOneToOne
? ''
: item.username
: item.username
visible:!groupChat.visible
Icon {
@ -126,19 +124,18 @@ Rectangle {
Layout.fillWidth: true
Layout.leftMargin: ContactStyle.spacing
sipAddress: (entry && item.showContactAddress
&& (item.showAuxData
? item.subject
? '- ' +item.subject +' -'
: ''
: (entry.isOneToOne == undefined || entry.isOneToOne) && (entry.haveEncryption == undefined || !entry.haveEncryption)
? entry.conferenceInfoModel
? entry.conferenceInfoModel.organizer
: entry.sipAddress || entry.fullPeerAddress || entry.peerAddress || ''
: '')
) || ''
participants: entry && item.showContactAddress && sipAddress == '' && entry.isOneToOne && entry.participants ? entry.participants.addressesToString : ''
username: item.username
titleText: item.subject
? item.subject
: item.username
subtitleText: entry && item.showSubtitle
? item.subtitle
? item.subtitle
: (entry.isOneToOne == undefined || entry.isOneToOne) && (entry.haveEncryption == undefined || !entry.haveEncryption)
? item.organizer
? item.organizer
: entry.sipAddress || entry.fullPeerAddress || entry.peerAddress || ''
: entry.participants.addressesToString
: ''
}
ContactMessageCounter {

View file

@ -8,40 +8,40 @@ import Common 1.0
Column {
id:mainItem
property alias username: username.fullText
property alias titleText: title.fullText
property alias subtitleText: subtitle.fullText
property string sipAddress
property string participants
property alias statusText : status.text
property var contactDescriptionStyle : ContactDescriptionStyle
property color sipAddressColor: contactDescriptionStyle.sipAddress.color
property color usernameColor: contactDescriptionStyle.username.color
property color subtitleColor: contactDescriptionStyle.subtitle.color
property color titleColor: contactDescriptionStyle.title.color
property int horizontalTextAlignment
property int contentWidth : Math.max(usernameImplicitWidthWorkaround.implicitWidth, addressImplicitWidthWorkaround.implicitWidth)
property int contentWidth : Math.max(titleImplicitWidthWorkaround.implicitWidth, subtitleImplicitWidthWorkaround.implicitWidth)
+10
+statusWidth
property int contentHeight : Math.max(username.implicitHeight, address.implicitHeight)+10
property int contentHeight : Math.max(title.implicitHeight, subtitle.implicitHeight)+10
readonly property int statusWidth : (status.visible ? status.width + 5 : 0)
property bool usernameClickable: false
property bool titleClickable: false
signal usernameClicked()
signal titleClicked()
// ---------------------------------------------------------------------------
TextEdit {
id: username
id: title
property string fullText
anchors.horizontalCenter: (horizontalTextAlignment == Text.AlignHCenter ? parent.horizontalCenter : undefined)
color: usernameColor
font.weight: contactDescriptionStyle.username.weight
font.pointSize: contactDescriptionStyle.username.pointSize
color: titleColor
font.weight: contactDescriptionStyle.title.weight
font.pointSize: contactDescriptionStyle.title.pointSize
horizontalAlignment: horizontalTextAlignment
verticalAlignment: (address.visible?Text.AlignBottom:Text.AlignVCenter)
width: Math.min(parent.width-statusWidth, usernameImplicitWidthWorkaround.implicitWidth)
verticalAlignment: (subtitle.visible?Text.AlignBottom:Text.AlignVCenter)
width: Math.min(parent.width-statusWidth, titleImplicitWidthWorkaround.implicitWidth)
height: (parent.height-parent.topPadding-parent.bottomPadding)/parent.visibleChildren.length
text: metrics.elidedText
@ -50,18 +50,18 @@ Column {
selectByMouse: true
Text{// Workaround to get implicitWidth from text without eliding
id: usernameImplicitWidthWorkaround
text: username.fullText
font.weight: username.font.weight
font.pointSize: username.font.pointSize
id: titleImplicitWidthWorkaround
text: title.fullText
font.weight: title.font.weight
font.pointSize: title.font.pointSize
visible: false
}
TextMetrics {
id: metrics
font: username.font
text: username.fullText
elideWidth: username.width
font: title.font
text: title.fullText
elideWidth: title.width
elide: Qt.ElideRight
}
Text{
@ -73,47 +73,47 @@ Column {
verticalAlignment: Text.AlignVCenter
visible: text != ''
text : ''
color: contactDescriptionStyle.username.status.color
font.pointSize: contactDescriptionStyle.username.status.pointSize
color: contactDescriptionStyle.title.status.color
font.pointSize: contactDescriptionStyle.title.status.pointSize
font.italic : true
}
MouseArea{
anchors.fill:parent
visible: usernameClickable
onClicked: usernameClicked()
visible: titleClickable
onClicked: titleClicked()
}
}
TextEdit {
id:address
property string fullText: sipAddress?SipAddressesModel.cleanSipAddress(sipAddress):participants
id:subtitle
property string fullText
anchors.horizontalCenter: (horizontalTextAlignment == Text.AlignHCenter ? parent.horizontalCenter : undefined)
color: sipAddressColor
font.weight: contactDescriptionStyle.sipAddress.weight
font.pointSize: contactDescriptionStyle.sipAddress.pointSize
color: subtitleColor
font.weight: contactDescriptionStyle.subtitle.weight
font.pointSize: contactDescriptionStyle.subtitle.pointSize
horizontalAlignment: horizontalTextAlignment
verticalAlignment: (username.visible?Text.AlignTop:Text.AlignVCenter)
width: Math.min(parent.width-statusWidth, addressImplicitWidthWorkaround.implicitWidth)
verticalAlignment: (title.visible?Text.AlignTop:Text.AlignVCenter)
width: Math.min(parent.width-statusWidth, subtitleImplicitWidthWorkaround.implicitWidth)
height: (parent.height-parent.topPadding-parent.bottomPadding)/parent.visibleChildren.length
visible: text != ''
text: addressMetrics.elidedText
text: subtitleMetrics.elidedText
onActiveFocusChanged: deselect();
readOnly: true
selectByMouse: true
Text{// Workaround to get implicitWidth from text without eliding
id: addressImplicitWidthWorkaround
text: address.fullText
font.weight: address.font.weight
font.pointSize: address.font.pointSize
id: subtitleImplicitWidthWorkaround
text: subtitle.fullText
font.weight: subtitle.font.weight
font.pointSize: subtitle.font.pointSize
visible: false
}
TextMetrics {
id: addressMetrics
font: address.font
text: address.fullText
elideWidth: address.width
id: subtitleMetrics
font: subtitle.font
text: subtitle.fullText
elideWidth: subtitle.width
elide: Qt.ElideRight
}
}

View file

@ -4,6 +4,7 @@ import QtQuick.Layouts 1.3
import Common 1.0
import Linphone 1.0
import Linphone.Styles 1.0
import UtilsCpp 1.0
import 'qrc:/ui/scripts/Utils/utils.js' as Utils
@ -40,8 +41,10 @@ Notification {
Contact {
Layout.fillWidth: true
property ChatRoomModel chatRoomModel : notification.timelineModel.getChatRoomModel()
property var sipObserver: SipAddressesModel.getSipAddressObserver(notification.fullPeerAddress, notification.fullLocalAddress)
showAuxData: !chatRoomModel.isOneToOne
property var sipObserver: SipAddressesModel.getSipAddressObserver(notification.fullPeerAddress, notification.fullLocalAddress)
subtitle: chatRoomModel.isOneToOne
? SipAddressesModel.cleanSipAddress(notification.fullPeerAddress)
: UtilsCpp.getDisplayName(notification.fullPeerAddress)
entry: chatRoomModel ? chatRoomModel : sipObserver
Component.onDestruction: sipObserver=null// Need to set it to null because of not calling destructor if not.
}

View file

@ -56,14 +56,14 @@ QtObject {
property int loops: 3
}
property QtObject sipAddressColor: QtObject {
property color normal: ColorsList.add('Calls_entry_sipAddress_n', 'n').color
property color selected: ColorsList.add('Calls_entry_sipAddress_selected', 'q').color
property QtObject subtitleColor: QtObject {
property color normal: ColorsList.add('Calls_entry_subtitle_n', 'n').color
property color selected: ColorsList.add('Calls_entry_subtitle_selected', 'q').color
}
property QtObject usernameColor: QtObject {
property color normal: ColorsList.add('Calls_entry_username_n', 'j').color
property color selected: ColorsList.add('Calls_entry_username_selected', 'q').color
property QtObject titleColor: QtObject {
property color normal: ColorsList.add('Calls_entry_title_n', 'j').color
property color selected: ColorsList.add('Calls_entry_title_selected', 'q').color
}
}

View file

@ -9,14 +9,14 @@ import ColorsList 1.0
QtObject {
property string sectionName: 'ContactDescription'
property QtObject sipAddress: QtObject {
property color color: ColorsList.add(sectionName+'_sipAddress', 'n').color
property QtObject subtitle: QtObject {
property color color: ColorsList.add(sectionName+'_subtitle', 'n').color
property int pointSize: Units.dp * 10
property int weight: Font.Normal
}
property QtObject username: QtObject {
property color color: ColorsList.add(sectionName+'_username', 'j').color
property QtObject title: QtObject {
property color color: ColorsList.add(sectionName+'_title', 'j').color
property int pointSize: Units.dp * 11
property int weight: Font.Bold
property QtObject status : QtObject{

View file

@ -26,17 +26,17 @@ QtObject {
property color selected: ColorsList.add(sectionName+'_contact_bg_c', 'i').color
}
property QtObject sipAddress: QtObject {
property QtObject subtitle: QtObject {
property QtObject color: QtObject {
property color normal: ColorsList.add(sectionName+'_contact_sipAddress_n', 'n').color
property color selected: ColorsList.add(sectionName+'_contact_sipAddress_c', 'q').color
property color normal: ColorsList.add(sectionName+'_contact_subtitle_n', 'n').color
property color selected: ColorsList.add(sectionName+'_contact_subtitle_c', 'q').color
}
}
property QtObject username: QtObject {
property QtObject title: QtObject {
property QtObject color: QtObject {
property color normal: ColorsList.add(sectionName+'_contact_username_n', 'j').color
property color selected: ColorsList.add(sectionName+'_contact_username_c', 'q').color
property color normal: ColorsList.add(sectionName+'_contact_title_n', 'j').color
property color selected: ColorsList.add(sectionName+'_contact_title_c', 'q').color
}
}
}

View file

@ -61,12 +61,13 @@ Item {
)
displayUnreadMessageCount: SettingsModel.standardChatEnabled || SettingsModel.secureChatEnabled
entry: mainItem.timelineModel && mainItem.timelineModel.chatRoomModel
sipAddressColor: isSelected
? TimelineStyle.contact.sipAddress.color.selected
: TimelineStyle.contact.sipAddress.color.normal
usernameColor: isSelected
? TimelineStyle.contact.username.color.selected
: TimelineStyle.contact.username.color.normal
subtitleColor: isSelected
? TimelineStyle.contact.subtitle.color.selected
: TimelineStyle.contact.subtitle.color.normal
titleColor: isSelected
? TimelineStyle.contact.title.color.selected
: TimelineStyle.contact.title.color.normal
showSubtitle: mainItem.timelineModel.chatRoomModel.isOneToOne || !mainItem.timelineModel.chatRoomModel.isConference
TooltipArea {
id: contactTooltip
text: mainItem.timelineModel && UtilsCpp.toDateTimeString(mainItem.timelineModel.chatRoomModel.lastUpdateTime)

View file

@ -102,7 +102,7 @@ ColumnLayout {
Layout.fillHeight: true
Layout.fillWidth: true
showContactAddress:false
showSubtitle:false
showSwitch : mainLayout.isAdmin
showSeparator: false
showAdminStatus:!mainLayout.isAdmin
@ -134,7 +134,7 @@ ColumnLayout {
}
onEntryClicked: {
contactItem.showContactAddress = !contactItem.showContactAddress
contactItem.showSubtitle = !contactItem.showSubtitle
}
}
}

View file

@ -25,7 +25,7 @@ ScrollableListView {
property string headerButtonIcon
property var headerButtonAction
property bool showHeader : true
property bool showContactAddress : true
property bool showSubtitle : true
property bool showSwitch : false
property bool showSeparator : true
property bool showAdminStatus : false
@ -235,7 +235,7 @@ ScrollableListView {
id:contactView
Layout.fillHeight: true
Layout.fillWidth: true
showContactAddress: sipAddressesView.showContactAddress
showSubtitle: sipAddressesView.showSubtitle
function getStatus(){
var count = 0;
var txt = ''

View file

@ -31,7 +31,7 @@ ScrollableListView {
property color headerButtonOverwriteColor
property var headerButtonAction
property bool showHeader : true
property bool showContactAddress : true
property bool showSubtitle : true
property bool showSwitch : false
property bool showSeparator : true
property bool isSelectable : true
@ -244,7 +244,7 @@ ScrollableListView {
Contact {
Layout.fillHeight: true
Layout.fillWidth: true
showContactAddress: sipAddressesView.showContactAddress
showSubtitle: sipAddressesView.showSubtitle
entry: $modelData

View file

@ -43,8 +43,8 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
height: CallStyle.header.contactDescription.height
horizontalTextAlignment: Text.AlignHCenter
sipAddress: call.peerAddress
username: _sipAddressObserver ? UtilsCpp.getDisplayName(_sipAddressObserver.peerAddress) : ''
subtitleText: SipAddressesModel.cleanSipAddress(call.peerAddress)
titleText: _sipAddressObserver ? UtilsCpp.getDisplayName(_sipAddressObserver.peerAddress) : ''
width: contentWidth
}

View file

@ -137,8 +137,8 @@ Rectangle {
width: parent.width
horizontalTextAlignment: Text.AlignHCenter
sipAddress: parent.sipAddress
username: parent._sipAddressObserver ? UtilsCpp.getDisplayName(parent._sipAddressObserver.peerAddress) : ''
subtitleText: SipAddressesModel.cleanSipAddress(parent.sipAddress)
titleText: parent._sipAddressObserver ? UtilsCpp.getDisplayName(parent._sipAddressObserver.peerAddress) : ''
}
IncallAvatar {

View file

@ -539,7 +539,7 @@ DialogPlus {
id: participantView
anchors.fill: parent
showContactAddress:false
showSubtitle:false
showSwitch : conferenceManager.isNew
showSeparator: false
isSelectable: false

View file

@ -166,8 +166,19 @@ ColumnLayout {
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
visible: !usernameEdit.visible
contactDescriptionStyle: ConversationStyle.bar.contactDescription
username: avatar.username
usernameClickable: chatRoomModel.isMeAdmin && !chatRoomModel.isOneToOne
titleText: avatar.username
titleClickable: chatRoomModel.isMeAdmin && !chatRoomModel.isOneToOne
subtitleText: if(chatRoomModel) {
if(chatRoomModel.groupEnabled) {
return chatRoomModel.participants.displayNamesToString;
}else if(chatRoomModel.isSecure()) {
return chatRoomModel.participants.addressesToString;
}else
return SipAddressesModel.cleanSipAddress(chatRoomModel.sipAddress)
}else
return ''
/*
participants: if(chatRoomModel) {
if(chatRoomModel.groupEnabled) {
return chatRoomModel.participants.displayNamesToString;
@ -191,7 +202,8 @@ ColumnLayout {
}
}
onUsernameClicked: {
*/
onTitleClicked: {
if(!conversation.isReadOnly) {
usernameEdit.visible = !usernameEdit.visible
usernameEdit.forceActiveFocus()

View file

@ -141,7 +141,7 @@ DialogPlus {
Layout.fillHeight: true
Layout.fillWidth: true
showContactAddress:false
showSubtitle:false
showSwitch : dialog.adminMode
showSeparator: false
showAdminStatus:!dialog.adminMode
@ -173,7 +173,7 @@ DialogPlus {
}
onEntryClicked: {
contactItem.showContactAddress = !contactItem.showContactAddress
contactItem.showSubtitle = !contactItem.showSubtitle
}
}
}

View file

@ -360,7 +360,7 @@ DialogPlus {
id: participantView
anchors.fill: parent
showContactAddress:false
showSubtitle:false
showSwitch : true
showSeparator: false
isSelectable: false

View file

@ -90,7 +90,7 @@ DialogPlus {
ContactDescription{
id:contactDescription
anchors.fill:parent
username: avatar.username
titleText: avatar.username
}
MouseArea{
anchors.fill:contactDescription

View file

@ -64,10 +64,10 @@ ColumnLayout {
Layout.fillHeight: true
Layout.fillWidth: true
sipAddress: historyView.peerAddress
sipAddressColor: HistoryViewStyle.bar.description.sipAddressColor
username: avatar.username
usernameColor: HistoryViewStyle.bar.description.usernameColor
subtitleText: SipAddressesModel.cleanSipAddress(sipAddress)(historyView.peerAddress)
subtitleColor: HistoryViewStyle.bar.description.subtitleColor
titleText: avatar.username
titleColor: HistoryViewStyle.bar.description.titleColor
visible:peerAddress
}

View file

@ -138,18 +138,18 @@ QtObject {
}
property QtObject contactDescription : QtObject {
property QtObject sipAddress: QtObject {
property color color: ColorsList.add(sectionName+'_description_sipAddress', 'n').color
property QtObject subtitle: QtObject {
property color color: ColorsList.add(sectionName+'_description_subtitle', 'n').color
property int pointSize: Units.dp * 10
property int weight: Font.Light
}
property QtObject username: QtObject {
property color color: ColorsList.add(sectionName+'_description_username', 'j').color
property QtObject title: QtObject {
property color color: ColorsList.add(sectionName+'_description_title', 'j').color
property int pointSize: Units.dp * 11
property int weight: Font.Normal
property QtObject status : QtObject{
property color color : ColorsList.add(sectionName+'_description_username_status', 'g').color
property color color : ColorsList.add(sectionName+'_description_title_status', 'g').color
property int pointSize : Units.dp * 9
}
}

View file

@ -31,8 +31,8 @@ QtObject {
}
property QtObject description: QtObject {
property color sipAddressColor: ColorsList.add(sectionName+'_bar_description_sipAddress', 'g').color
property color usernameColor: ColorsList.add(sectionName+'_bar_description_username', 'j').color
property color subtitleColor: ColorsList.add(sectionName+'_bar_description_subtitle', 'g').color
property color titleColor: ColorsList.add(sectionName+'_bar_description_title', 'j').color
}
}