mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-03 22:56:49 +00:00
Order messages from receiving time.
Fix H264 download URL on Linux. Hide Admin status in One-to-one chats. Add Sanitizer build.
This commit is contained in:
parent
e86c6c8dea
commit
9341494850
8 changed files with 47 additions and 14 deletions
|
|
@ -107,6 +107,20 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG -DQT_NO_DEBUG")
|
|||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG" )
|
||||
|
||||
#############################
|
||||
#Sanitizer
|
||||
if(ENABLE_SANITIZER)
|
||||
set(sanitize_flags "-fsanitize=address,undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls")
|
||||
set(sanitize_linker_flags "-fsanitize=address,undefined")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${sanitize_flags}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${sanitize_flags}")
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${sanitize_linker_flags}")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${sanitize_linker_flags}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${sanitize_linker_flags}")
|
||||
endif()
|
||||
#############################
|
||||
|
||||
if( WIN32)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WINSOCKAPI_")#remove error from windows headers order
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public:
|
|||
ChatRoomModel::EntryType mType;
|
||||
|
||||
virtual QDateTime getTimestamp() const;
|
||||
virtual void setTimestamp(const QDateTime& timestamp);
|
||||
virtual void setTimestamp(const QDateTime& timestamp = QDateTime::currentDateTime());
|
||||
|
||||
virtual void deleteEvent();
|
||||
|
||||
|
|
|
|||
|
|
@ -107,10 +107,13 @@ ChatMessageModel::ChatMessageModel ( std::shared_ptr<linphone::ChatMessage> chat
|
|||
txt += content->getUtf8Text().c_str();
|
||||
}
|
||||
mContent = txt;
|
||||
auto appData = AppDataManager(QString::fromStdString(getChatMessage()->getAppdata()));
|
||||
if(appData.mData.contains("timestamp"))
|
||||
mTimestamp = QDateTime::fromMSecsSinceEpoch(appData.mData["timestamp"].toLongLong());
|
||||
else
|
||||
mTimestamp = QDateTime::fromMSecsSinceEpoch(chatMessage->getTime() * 1000);
|
||||
}
|
||||
mWasDownloaded = false;
|
||||
|
||||
mTimestamp = QDateTime::fromMSecsSinceEpoch(chatMessage->getTime() * 1000);
|
||||
|
||||
mContentListModel = QSharedPointer<ContentListModel>::create(this);
|
||||
}
|
||||
|
|
@ -231,6 +234,16 @@ void ChatMessageModel::setWasDownloaded(bool wasDownloaded){
|
|||
}
|
||||
}
|
||||
|
||||
void ChatMessageModel::setTimestamp(const QDateTime& timestamp) {
|
||||
mTimestamp = timestamp;
|
||||
auto timeT = timestamp.toMSecsSinceEpoch();
|
||||
auto appData = AppDataManager(QString::fromStdString(getChatMessage()->getAppdata()));
|
||||
if(appData.mData["timestamp"].toLongLong() != timeT) {
|
||||
appData.mData["timestamp"] = timeT;
|
||||
getChatMessage()->setAppdata(appData.toString().toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void ChatMessageModel::resendMessage (){
|
||||
|
|
|
|||
|
|
@ -124,12 +124,13 @@ public:
|
|||
//----------------------------------------------------------------------------
|
||||
|
||||
void setWasDownloaded(bool wasDownloaded);
|
||||
virtual void setTimestamp(const QDateTime& timestamp = QDateTime::currentDateTime()) override;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
Q_INVOKABLE void resendMessage ();
|
||||
|
||||
virtual void deleteEvent();
|
||||
virtual void deleteEvent() override;
|
||||
void updateFileTransferInformation();
|
||||
// Linphone callbacks
|
||||
void onFileTransferRecv(const std::shared_ptr<linphone::ChatMessage> & message, const std::shared_ptr<linphone::Content> & content, const std::shared_ptr<const linphone::Buffer> & buffer) ;
|
||||
|
|
|
|||
|
|
@ -1026,15 +1026,17 @@ void ChatRoomModel::insertCalls (const QList<std::shared_ptr<linphone::CallLog>
|
|||
}
|
||||
}
|
||||
|
||||
void ChatRoomModel::insertMessageAtEnd (const std::shared_ptr<linphone::ChatMessage> &message) {
|
||||
QSharedPointer<ChatMessageModel> ChatRoomModel::insertMessageAtEnd (const std::shared_ptr<linphone::ChatMessage> &message) {
|
||||
QSharedPointer<ChatMessageModel> model;
|
||||
if(mIsInitialized){
|
||||
QSharedPointer<ChatMessageModel> model = ChatMessageModel::create(message);
|
||||
model = ChatMessageModel::create(message);
|
||||
if(model){
|
||||
connect(model.get(), &ChatMessageModel::remove, this, &ChatRoomModel::removeEntry);
|
||||
setUnreadMessagesCount(mChatRoom->getUnreadMessagesCount());
|
||||
add(model);
|
||||
}
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
void ChatRoomModel::insertMessages (const QList<std::shared_ptr<linphone::ChatMessage> > &messages) {
|
||||
|
|
@ -1171,8 +1173,11 @@ void ChatRoomModel::onNewEvent(const std::shared_ptr<linphone::ChatRoom> & chatR
|
|||
void ChatRoomModel::onChatMessageReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) {
|
||||
auto message = eventLog->getChatMessage();
|
||||
if(message){
|
||||
insertMessageAtEnd(message);
|
||||
updateLastUpdateTime();
|
||||
auto messageModel = insertMessageAtEnd(message);
|
||||
if(messageModel){
|
||||
messageModel->setTimestamp();
|
||||
updateLastUpdateTime();
|
||||
}
|
||||
emit messageReceived(message);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ public:
|
|||
|
||||
void insertCall (const std::shared_ptr<linphone::CallLog> &callLog);
|
||||
void insertCalls (const QList<std::shared_ptr<linphone::CallLog> > &calls);
|
||||
void insertMessageAtEnd (const std::shared_ptr<linphone::ChatMessage> &message);
|
||||
QSharedPointer<ChatMessageModel> insertMessageAtEnd (const std::shared_ptr<linphone::ChatMessage> &message);
|
||||
void insertMessages (const QList<std::shared_ptr<linphone::ChatMessage> > &messages);
|
||||
void insertNotice (const std::shared_ptr<linphone::EventLog> &enventLog);
|
||||
void insertNotices (const QList<std::shared_ptr<linphone::EventLog>> &eventLogs);
|
||||
|
|
|
|||
|
|
@ -38,13 +38,13 @@
|
|||
|
||||
// =============================================================================
|
||||
|
||||
ContentModel::ContentModel(ChatMessageModel* chatModel) : mAppData(""){
|
||||
ContentModel::ContentModel(ChatMessageModel* chatModel) : mAppData(chatModel ? QString::fromStdString(chatModel->getChatMessage()->getAppdata()) : ""){
|
||||
App::getInstance()->getEngine()->setObjectOwnership(this, QQmlEngine::CppOwnership);// Avoid QML to destroy it when passing by Q_INVOKABLE
|
||||
mChatMessageModel = chatModel;
|
||||
mWasDownloaded = false;
|
||||
mFileOffset = 0;
|
||||
}
|
||||
ContentModel::ContentModel(std::shared_ptr<linphone::Content> content, ChatMessageModel* chatModel) : mAppData(""){
|
||||
ContentModel::ContentModel(std::shared_ptr<linphone::Content> content, ChatMessageModel* chatModel) : mAppData(chatModel ? QString::fromStdString(chatModel->getChatMessage()->getAppdata()) : ""){
|
||||
App::getInstance()->getEngine()->setObjectOwnership(this, QQmlEngine::CppOwnership);// Avoid QML to destroy it when passing by Q_INVOKABLE
|
||||
mChatMessageModel = chatModel;
|
||||
mWasDownloaded = false;
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ ColumnLayout {
|
|||
Layout.topMargin: 15
|
||||
Layout.preferredHeight: implicitHeight
|
||||
Layout.alignment: Qt.AlignBottom
|
||||
visible:chatRoomModel.isMeAdmin && !usernameEdit.visible
|
||||
visible:chatRoomModel.isMeAdmin && !usernameEdit.visible && !chatRoomModel.isOneToOne
|
||||
|
||||
Icon{
|
||||
id:adminIcon
|
||||
|
|
@ -154,7 +154,7 @@ ColumnLayout {
|
|||
visible: !usernameEdit.visible
|
||||
contactDescriptionStyle: ConversationStyle.bar.contactDescription
|
||||
username: avatar.username
|
||||
usernameClickable: chatRoomModel.isMeAdmin
|
||||
usernameClickable: chatRoomModel.isMeAdmin && !chatRoomModel.isOneToOne
|
||||
participants: if(chatRoomModel) {
|
||||
if(chatRoomModel.groupEnabled) {
|
||||
return chatRoomModel.participants.displayNamesToString;
|
||||
|
|
@ -188,7 +188,7 @@ ColumnLayout {
|
|||
Item{
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
visible: chatRoomModel.isMeAdmin
|
||||
visible: chatRoomModel.isMeAdmin && !chatRoomModel.isOneToOne
|
||||
}
|
||||
}
|
||||
Icon{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue