Tooltip on avatar (message and file message)

This commit is contained in:
Julien Wadel 2021-08-11 20:27:39 +02:00
parent 075aa6f948
commit e4952ab5c0
6 changed files with 20 additions and 7 deletions

View file

@ -397,6 +397,10 @@ QString ChatMessageModel::getToDisplayName() const{
return Utils::getDisplayName(mChatMessage->getToAddress());
}
QString ChatMessageModel::getToSipAddress() const{
return Utils::cleanSipAddress(Utils::coreStringToAppString(mChatMessage->getToAddress()->asStringUriOnly()));
}
ContactModel * ChatMessageModel::getContactModel() const{
return CoreManager::getInstance()->getContactsListModel()->findContactModelFromSipAddress(Utils::coreStringToAppString(mChatMessage->getFromAddress()->asString()));
}

View file

@ -137,6 +137,7 @@ public:
Q_PROPERTY(QString fromDisplayName READ getFromDisplayName CONSTANT)
Q_PROPERTY(QString fromSipAddress READ getFromSipAddress CONSTANT)
Q_PROPERTY(QString toDisplayName READ getToDisplayName CONSTANT)
Q_PROPERTY(QString toSipAddress READ getToSipAddress CONSTANT)
Q_PROPERTY(ContactModel * contactModel READ getContactModel CONSTANT)
Q_PROPERTY(bool isEphemeral READ isEphemeral NOTIFY isEphemeralChanged)
@ -162,6 +163,7 @@ public:
QString getFromDisplayName() const;
QString getFromSipAddress() const;
QString getToDisplayName() const;
QString getToSipAddress() const;
ContactModel * getContactModel() const;
bool isEphemeral() const;
Q_INVOKABLE qint64 getEphemeralExpireTime() const;

View file

@ -12,6 +12,7 @@ import Utils 1.0
// =============================================================================
Row {
id:mainRow
// ---------------------------------------------------------------------------
// Avatar if it's an incoming message.
// ---------------------------------------------------------------------------
@ -30,7 +31,13 @@ Row {
width: ChatStyle.entry.message.incoming.avatarSize
image: $chatEntry.contactModel? $chatEntry.contactModel.vcard.avatar : '' //chat.sipAddressObserver.contact ? chat.sipAddressObserver.contact.vcard.avatar : ''
username: isOutgoing? $chatEntry.fromDisplayName : $chatEntry.toDisplayName
username: isOutgoing? $chatEntry.toDisplayName : $chatEntry.fromDisplayName
TooltipArea{
delay:0
text:parent.username+'\n'+ (isOutgoing ? $chatEntry.toSipAddress : $chatEntry.fromSipAddress)
tooltipParent:mainRow
}
}
}

View file

@ -217,10 +217,10 @@ Item {
else return ''
}
delegate:Text{
height:ChatStyle.composingText.height-5
width:parent.width
text:deliveryLayout.getText(modelData.state, modelData.displayName, UtilsCpp.toDateTimeString(modelData.stateChangeTime))
color:"#B1B1B1"
height: ChatStyle.composingText.height-5
width: GridView.width
text: deliveryLayout.getText(modelData.state, modelData.displayName, UtilsCpp.toDateTimeString(modelData.stateChangeTime))
color: "#B1B1B1"
font.pointSize: Units.dp * 8
elide: Text.ElideMiddle
}

View file

@ -45,7 +45,7 @@ Item {
icon: isError
? 'chat_error'
: (isRead ? 'chat_read' : isDelivered ? 'chat_delivered' : '')
: (isRead ? 'chat_read' : (isDelivered ? 'chat_delivered' : '' ) )
iconSize: ChatStyle.entry.message.outgoing.sendIconSize
MouseArea {

@ -1 +1 @@
Subproject commit c62b1fdc3c5e68ebd77794d6991ab7e68519c0cd
Subproject commit 70c8ce09ec0171ed4c877b0770f306bb86072df2