diff --git a/Linphone/core/chat/ChatCore.cpp b/Linphone/core/chat/ChatCore.cpp index 5970a95c3..a5a838629 100644 --- a/Linphone/core/chat/ChatCore.cpp +++ b/Linphone/core/chat/ChatCore.cpp @@ -249,6 +249,25 @@ void ChatCore::setSelf(const QSharedPointer &me) { emit lUpdateLastUpdatedTime(); }); }); + mChatModelConnection->makeConnectToModel( + &ChatModel::chatMessageSent, [this](const std::shared_ptr &chatRoom, + const std::shared_ptr &eventLog) { + if (!mChatModel) { + lWarning() << log().arg("Chat model is null !"); + return; + } else if (!mChatModelConnection) { + lWarning() << log().arg("Connection between Core and Model is null !"); + return; + } + if (mChatModel->getMonitor() != chatRoom) return; + lInfo() << log().arg("Chat message sent in chatroom") << this << mChatModel->getTitle(); + QList> list; + if (eventLog) { + emit CoreModel::getInstance()->messageSent(CoreModel::getInstance()->getCore(), chatRoom, eventLog); + } else { + lWarning() << log().arg("message sent : event log is null"); + } + }); mChatModelConnection->makeConnectToCore(&ChatCore::lMarkAsRead, [this]() { auto lastActiveWindow = Utils::getLastActiveWindow(); diff --git a/Linphone/core/chat/ChatList.cpp b/Linphone/core/chat/ChatList.cpp index 136562fe9..455b724d9 100644 --- a/Linphone/core/chat/ChatList.cpp +++ b/Linphone/core/chat/ChatList.cpp @@ -154,10 +154,8 @@ void ChatList::setSelf(QSharedPointer me) { [this](std::shared_ptr core, std::shared_ptr account) { lUpdate(); }); auto addChatToList = [this](const std::shared_ptr &core, - const std::shared_ptr &room, - const std::shared_ptr &message, bool sendAddSignal = false) { + const std::shared_ptr &room, bool sendAddSignal = false) { mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); - // if (!message) return; if (room->getAccount() != core->getDefaultAccount()) { qInfo() << log().arg("Chat room to add does not refer to current account, return"); return; @@ -181,27 +179,28 @@ void ChatList::setSelf(QSharedPointer me) { auto chatCore = ChatCore::create(room); mModelConnection->invokeToCore([this, chatCore, sendAddSignal] { addChatInList(chatCore, sendAddSignal); }); }; - mModelConnection->makeConnectToModel(&CoreModel::messageReceived, - [this, addChatToList](const std::shared_ptr &core, - const std::shared_ptr &room, - const std::shared_ptr &message) { - addChatToList(core, room, message); - }); mModelConnection->makeConnectToModel( - &CoreModel::messagesReceived, + &CoreModel::messageReceived, [this, addChatToList](const std::shared_ptr &core, const std::shared_ptr &room, - const std::list> &messages) { - addChatToList(core, room, messages.front()); + const std::shared_ptr &message) { addChatToList(core, room); }); + mModelConnection->makeConnectToModel( + &CoreModel::messagesReceived, + [this, addChatToList]( + const std::shared_ptr &core, const std::shared_ptr &room, + const std::list> &messages) { addChatToList(core, room); }); + mModelConnection->makeConnectToModel( + &CoreModel::messageSent, [this, addChatToList](const std::shared_ptr &core, + const std::shared_ptr &room, + const std::shared_ptr &eventLog) { + addChatToList(core, room, true); }); mModelConnection->makeConnectToModel( &CoreModel::newMessageReaction, - [this, addChatToList](const std::shared_ptr &core, - const std::shared_ptr &room, - const std::shared_ptr &message, - const std::shared_ptr &reaction) { - addChatToList(core, room, message); - }); + [this, addChatToList]( + const std::shared_ptr &core, const std::shared_ptr &room, + const std::shared_ptr &message, + const std::shared_ptr &reaction) { addChatToList(core, room); }); mModelConnection->makeConnectToModel(&CoreModel::chatRoomStateChanged, [this, addChatToList](const std::shared_ptr &core, const std::shared_ptr &chatRoom, @@ -211,8 +210,7 @@ void ChatList::setSelf(QSharedPointer me) { if (chatRoom == CoreModel::getInstance()->mChatRoomBeingCreated) { sendAddSignal = true; } - CoreModel::getInstance()->mChatRoomBeingCreated = nullptr; - addChatToList(core, chatRoom, nullptr, sendAddSignal); + addChatToList(core, chatRoom, sendAddSignal); } }); @@ -247,7 +245,10 @@ bool ChatList::addChatInList(QSharedPointer chatCore, bool emitAddSign connectItem(chatCore); lInfo() << "Add ChatRoom" << chatCore->getTitle(); add(chatCore); - if (emitAddSignal) emit chatAdded(chatCore); + if (emitAddSignal) { + CoreModel::getInstance()->mChatRoomBeingCreated = nullptr; + emit chatAdded(chatCore); + } return true; } return false; diff --git a/Linphone/core/notifier/Notifier.cpp b/Linphone/core/notifier/Notifier.cpp index bcf2c278f..64499459a 100644 --- a/Linphone/core/notifier/Notifier.cpp +++ b/Linphone/core/notifier/Notifier.cpp @@ -175,7 +175,7 @@ bool Notifier::createNotification(Notifier::NotificationType type, QVariantMap d // to have the Window on Top and fullscreen independant window->setFlags((showAsTool ? Qt::Tool : Qt::WindowStaysOnTopHint) | Qt::FramelessWindowHint); -#ifdef Q_OS_LINUX || Q_OS_WIN +#if defined(Q_OS_LINUX) || defined(Q_OS_WIN) window->setFlag(Qt::WindowDoesNotAcceptFocus); #endif // for (auto it = data.begin(); it != data.end(); ++it) diff --git a/Linphone/data/languages/de.ts b/Linphone/data/languages/de.ts index 610067b47..18e86111f 100644 --- a/Linphone/data/languages/de.ts +++ b/Linphone/data/languages/de.ts @@ -2131,65 +2131,65 @@ ChatListView - + chat_message_is_writing_info %1 is writing… %1 schreibt… - + chat_message_draft_sending_text Entwurf: %1 - + chat_room_delete "Delete" Löschen - + chat_room_mute Stummschalten - + chat_room_unmute "Mute" Stummschaltung aufheben - + chat_room_mark_as_read "Mark as read" Als gelesen markieren - + chat_room_leave "leave" Verlassen - + chat_list_leave_chat_popup_title leave the conversation ? Chat verlassen? - + chat_list_leave_chat_popup_message You will not be able to send or receive messages in this conversation anymore. Do You want to continue ? „Sie können in diesem Chat keine Nachrichten mehr senden oder empfangen. Möchten Sie fortfahren? - + chat_list_delete_chat_popup_title Delete the conversation ? Chat löschen? - + chat_list_delete_chat_popup_message This conversation and all its messages will be deleted. Do You want to continue ? Dieser Chat und alle seine Nachrichten werden gelöscht. Möchten Sie fortfahren? @@ -2571,74 +2571,74 @@ Stellen Sie sicher, dass Sie keine sensiblen Informationen teilen! Chat wird erstellt... - + chat_dialog_delete_chat_title Supprimer la conversation ? Chat löschen? - + chat_dialog_delete_chat_message "La conversation et tous ses messages seront supprimés." Dieser Chat und alle seine Nachrichten werden gelöscht. - + chat_list_title "Conversations" Chats - + menu_mark_all_as_read "mark all as read" Alle als gelesen markieren - + chat_search_in_history "Rechercher une conversation" Chat suchen - + list_filter_no_result_found "Aucun résultat…" Kein Ergebnis… - + chat_list_empty_history "Aucune conversation dans votre historique" Keine Chats in der Historie - + chat_action_start_new_chat "New chat" Neuer Chat - + chat_start_group_chat_title "Nouveau groupe" Neuer Gruppenchat - + chat_action_start_group_chat "Créer" Erstellen - - - + + + information_popup_error_title Fehler - + information_popup_chat_creation_failed_message "La création a échoué" Erstellen fehlgeschlagen @@ -2649,25 +2649,25 @@ Stellen Sie sicher, dass Sie keine sensiblen Informationen teilen! Der Codec konnte nicht installiert werden. - + group_chat_error_must_have_name "Un nom doit être donné au groupe Für den Gruppenchat muss ein Name festgelegt werden - + group_chat_error_no_participant "Please select at least one participant Bitte wählen Sie mindestens einen Teilnehmer aus - + group_call_error_not_connected "Vous n'etes pas connecté" Sie sind nicht verbunden - + chat_creation_in_progress Creation de la conversation en cours … Chat-Erstellung ausstehend… diff --git a/Linphone/data/languages/en.ts b/Linphone/data/languages/en.ts index 59f7d52d5..75037bb8e 100644 --- a/Linphone/data/languages/en.ts +++ b/Linphone/data/languages/en.ts @@ -2069,65 +2069,65 @@ ChatListView - + chat_message_is_writing_info %1 is writing… %1 is writing… - + chat_message_draft_sending_text Draft : %1 - + chat_room_delete "Delete" Delete - + chat_room_mute Mute - + chat_room_unmute "Mute" Unmute - + chat_room_mark_as_read "Mark as read" Mark as read - + chat_room_leave "leave" Leave - + chat_list_leave_chat_popup_title leave the conversation ? Leave the conversation ? - + chat_list_leave_chat_popup_message You will not be able to send or receive messages in this conversation anymore. Do You want to continue ? You will not be able to send or receive messages in this conversation anymore. Do You want to continue ? - + chat_list_delete_chat_popup_title Delete the conversation ? Delete the conversation ? - + chat_list_delete_chat_popup_message This conversation and all its messages will be deleted. Do You want to continue ? This conversation and all its messages will be deleted. Do You want to continue ? @@ -2504,98 +2504,98 @@ Only your correspondent can decrypt them. Chat room is being created... - + chat_dialog_delete_chat_title Supprimer la conversation ? Delete conversation ? - + chat_dialog_delete_chat_message "La conversation et tous ses messages seront supprimés." This conversation and all its messages will be deleted. - + chat_list_title "Conversations" Conversations - + menu_mark_all_as_read "mark all as read" Mark all as read - + chat_search_in_history "Rechercher une conversation" Search for a chat - + list_filter_no_result_found "Aucun résultat…" No result… - + chat_list_empty_history "Aucune conversation dans votre historique" No conversation in history - + chat_action_start_new_chat "New chat" New conversation - + chat_start_group_chat_title "Nouveau groupe" New group - + chat_action_start_group_chat "Créer" Create - - - + + + information_popup_error_title Error - + information_popup_chat_creation_failed_message "La création a échoué" Creation failed - + group_chat_error_must_have_name "Un nom doit être donné au groupe A name must be set for the group - + group_chat_error_no_participant "Please select at least one participant Please select at least one participant - + group_call_error_not_connected "Vous n'etes pas connecté" You are not connected - + chat_creation_in_progress Creation de la conversation en cours … Chat creation pending… diff --git a/Linphone/data/languages/fr.ts b/Linphone/data/languages/fr.ts index d2d324f47..7150635c6 100644 --- a/Linphone/data/languages/fr.ts +++ b/Linphone/data/languages/fr.ts @@ -2069,65 +2069,65 @@ ChatListView - + chat_message_is_writing_info %1 is writing… %1 est en train d'écrire… - + chat_message_draft_sending_text Brouillon : %1 - + chat_room_delete "Delete" Supprimer - + chat_room_mute Mettre en sourdine - + chat_room_unmute "Mute" Enlever la sourdine - + chat_room_mark_as_read "Mark as read" Marquer comme lu - + chat_room_leave "leave" Quitter la conversation - + chat_list_leave_chat_popup_title leave the conversation ? Quitter la conversation ? - + chat_list_leave_chat_popup_message You will not be able to send or receive messages in this conversation anymore. Do You want to continue ? Vous ne pourrez plus envoyer ou recevoir de messages dans cette conversation. Souhaitez-vous continuer ? - + chat_list_delete_chat_popup_title Delete the conversation ? Supprimer la conversation ? - + chat_list_delete_chat_popup_message This conversation and all its messages will be deleted. Do You want to continue ? La conversation et tous ses messages seront supprimés. Souhaitez-vous continuer ? @@ -2504,98 +2504,98 @@ en bout. Seul votre correspondant peut les déchiffrer. Création de la conversation en cours... - + chat_dialog_delete_chat_title Supprimer la conversation ? Supprimer la conversation ? - + chat_dialog_delete_chat_message "La conversation et tous ses messages seront supprimés." La conversation et tous ses messages seront supprimés. - + chat_list_title "Conversations" Conversations - + menu_mark_all_as_read "mark all as read" Tout marquer comme lu - + chat_search_in_history "Rechercher une conversation" Rechercher une conversation - + list_filter_no_result_found "Aucun résultat…" Aucun résultat… - + chat_list_empty_history "Aucune conversation dans votre historique" Aucune conversation dans votre historique - + chat_action_start_new_chat "New chat" Nouvelle conversation - + chat_start_group_chat_title "Nouveau groupe" Nouveau groupe - + chat_action_start_group_chat "Créer" Créer - - - + + + information_popup_error_title Erreur - + information_popup_chat_creation_failed_message "La création a échoué" La création a échoué - + group_chat_error_must_have_name "Un nom doit être donné au groupe Un nom doit être donné au groupe - + group_chat_error_no_participant "Please select at least one participant Veuillez sélectionner au moins un participant - + group_call_error_not_connected "Vous n'etes pas connecté" Vous n'êtes pas connecté - + chat_creation_in_progress Creation de la conversation en cours … Création de la conversation en cours… diff --git a/Linphone/model/core/CoreModel.hpp b/Linphone/model/core/CoreModel.hpp index 08cfe3cf0..c46c94105 100644 --- a/Linphone/model/core/CoreModel.hpp +++ b/Linphone/model/core/CoreModel.hpp @@ -275,6 +275,9 @@ signals: void messageReceived(const std::shared_ptr &core, const std::shared_ptr &room, const std::shared_ptr &message); + void messageSent(const std::shared_ptr &core, + const std::shared_ptr &room, + const std::shared_ptr &message); void messagesReceived(const std::shared_ptr &core, const std::shared_ptr &room, const std::list> &messages); diff --git a/Linphone/view/Control/Display/Chat/ChatListView.qml b/Linphone/view/Control/Display/Chat/ChatListView.qml index 9dded30a7..2ed45e2c5 100644 --- a/Linphone/view/Control/Display/Chat/ChatListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatListView.qml @@ -99,6 +99,8 @@ ListView { if (index === -1 && force === true && chatGui) { if (chatProxy.addChatInList(chatGui)) { var index = chatProxy.findChatIndex(chatGui) + } else { + console.log("could not add chat in list !") } } mainItem.currentIndex = index diff --git a/Linphone/view/Page/Main/Chat/ChatPage.qml b/Linphone/view/Page/Main/Chat/ChatPage.qml index 192473b4d..3de8b3997 100644 --- a/Linphone/view/Page/Main/Chat/ChatPage.qml +++ b/Linphone/view/Page/Main/Chat/ChatPage.qml @@ -44,6 +44,9 @@ AbstractMainPage { UtilsCpp.showInformationPopup(qsTr("info_popup_error_title"), //: Chat room creation failed ! qsTr("info_popup_chatroom_creation_failed"), false) + } else if (remoteChat.core.state === LinphoneEnums.ChatRoomState.Created) { + console.log("chat room state Created, open chat in right panel") + mainItem.selectedChatGui = remoteChat } } }