mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-21 05:38:12 +00:00
Incoming chat messages : Display avatar and author name if not grouped.
Fix author name on call events.
This commit is contained in:
parent
c7e1720871
commit
dcddaed4a7
4 changed files with 17 additions and 17 deletions
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "app/App.hpp"
|
||||
#include "components/core/CoreManager.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
#include "ChatCallModel.hpp"
|
||||
|
||||
|
|
@ -58,6 +59,16 @@ QSharedPointer<ChatCallModel> ChatCallModel::create(std::shared_ptr<linphone::Ca
|
|||
std::shared_ptr<linphone::CallLog> ChatCallModel::getCallLog(){
|
||||
return mCallLog;
|
||||
}
|
||||
|
||||
QString ChatCallModel::getFromDisplayName(){
|
||||
if(!mFromDisplayNameCache.isEmpty())
|
||||
return mFromDisplayNameCache;
|
||||
if(!mCallLog)
|
||||
return "";
|
||||
mFromDisplayNameCache = Utils::getDisplayName(mCallLog->getFromAddress());
|
||||
return mFromDisplayNameCache;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void ChatCallModel::setIsStart(const bool& data){
|
||||
if(data != mIsStart) {
|
||||
|
|
|
|||
|
|
@ -38,12 +38,14 @@ public:
|
|||
Q_PROPERTY(ChatRoomModel::EntryType type MEMBER mType CONSTANT)
|
||||
Q_PROPERTY(QDateTime timestamp MEMBER mTimestamp CONSTANT)
|
||||
Q_PROPERTY(QDateTime receivedTimestamp MEMBER mReceivedTimestamp CONSTANT)
|
||||
Q_PROPERTY(QString fromDisplayName READ getFromDisplayName CONSTANT)
|
||||
|
||||
Q_PROPERTY(bool isStart MEMBER mIsStart WRITE setIsStart NOTIFY isStartChanged)
|
||||
Q_PROPERTY(LinphoneEnums::CallStatus status MEMBER mStatus WRITE setStatus NOTIFY statusChanged)
|
||||
Q_PROPERTY(bool isOutgoing MEMBER mIsOutgoing WRITE setIsOutgoing NOTIFY isOutgoingChanged)
|
||||
|
||||
std::shared_ptr<linphone::CallLog> getCallLog();
|
||||
QString getFromDisplayName();
|
||||
|
||||
void setIsStart(const bool& isStart);
|
||||
void setStatus(const LinphoneEnums::CallStatus& status);
|
||||
|
|
@ -63,6 +65,7 @@ signals:
|
|||
|
||||
private:
|
||||
std::shared_ptr<linphone::CallLog> mCallLog;
|
||||
QString mFromDisplayNameCache;
|
||||
};
|
||||
Q_DECLARE_METATYPE(QSharedPointer<ChatCallModel>)
|
||||
Q_DECLARE_METATYPE(ChatCallModel*)
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ Rectangle {
|
|||
Layout.rightMargin: ChatStyle.entry.message.outgoing.areaSize
|
||||
spacing:0
|
||||
// Display time.
|
||||
visible: !entry.isTopGrouped
|
||||
visible: !entry.isTopGrouped// && !entry.isNotice
|
||||
|
||||
Text {
|
||||
id:timeDisplay
|
||||
|
|
@ -216,7 +216,6 @@ Rectangle {
|
|||
TooltipArea {
|
||||
text: entry.chatEntry ? UtilsCpp.toDateTimeString(entry.chatEntry.timestamp) : ''
|
||||
}
|
||||
visible:!entry.isNotice
|
||||
}
|
||||
Text{
|
||||
id:authorName
|
||||
|
|
@ -226,14 +225,7 @@ Rectangle {
|
|||
|
||||
color: ChatStyle.entry.event.text.colorModel.color
|
||||
font.pointSize: ChatStyle.entry.event.text.pointSize
|
||||
visible: entry.isMessage
|
||||
&& entry.chatEntry
|
||||
&& !entry.chatEntry.isOutgoing // Only outgoing
|
||||
&& (!entry.previousItem //No previous entry
|
||||
|| entry.previousItem.type != ChatRoomModel.MessageEntry // Previous entry is a message
|
||||
|| entry.previousItem.fromSipAddress != entry.chatEntry.fromSipAddress // Different user
|
||||
|| (new Date(entry.previousItem.timestamp)).setHours(0, 0, 0, 0) != (new Date(entry.chatEntry.timestamp)).setHours(0, 0, 0, 0) // Same day == section
|
||||
)
|
||||
visible: entry.chatEntry && !entry.chatEntry.isOutgoing && text != ''
|
||||
}
|
||||
}
|
||||
// Display content.
|
||||
|
|
|
|||
|
|
@ -47,13 +47,7 @@ RowLayout {
|
|||
if (index <= 0) {
|
||||
return true // 1. First message, so visible.
|
||||
}
|
||||
var previousEntry = proxyModel.getAt(index - 1)
|
||||
return !$chatEntry.isOutgoing && (// Only outgoing
|
||||
!previousEntry //No previous entry
|
||||
|| previousEntry.type != ChatRoomModel.MessageEntry // Previous entry is a message
|
||||
|| previousEntry.fromSipAddress != $chatEntry.fromSipAddress // Different user
|
||||
|| (new Date(previousEntry.timestamp)).setHours(0, 0, 0, 0) != (new Date($chatEntry.timestamp)).setHours(0, 0, 0, 0) // Same day == section
|
||||
)
|
||||
return !$chatEntry.isOutgoing && !mainRow.isTopGrouped
|
||||
}
|
||||
TooltipArea{
|
||||
delay:0
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue