diff --git a/Linphone/core/chat/ChatList.cpp b/Linphone/core/chat/ChatList.cpp index 7d0a662c2..94e1f7fc2 100644 --- a/Linphone/core/chat/ChatList.cpp +++ b/Linphone/core/chat/ChatList.cpp @@ -218,8 +218,8 @@ bool ChatList::addChatInList(QSharedPointer chatCore) { if (it == chatList.end()) { connectItem(chatCore); add(chatCore); - return true; emit chatAdded(); + return true; } return false; } diff --git a/Linphone/core/chat/ChatProxy.cpp b/Linphone/core/chat/ChatProxy.cpp index c021e1b93..84198c24c 100644 --- a/Linphone/core/chat/ChatProxy.cpp +++ b/Linphone/core/chat/ChatProxy.cpp @@ -68,11 +68,12 @@ int ChatProxy::findChatIndex(ChatGui *chatGui) { return -1; } -void ChatProxy::addChatInList(ChatGui *chatGui) { +bool ChatProxy::addChatInList(ChatGui *chatGui) { auto chatList = dynamic_cast(sourceModel()); if (chatList && chatGui) { - chatList->addChatInList(chatGui->mCore); + return chatList->addChatInList(chatGui->mCore); } + return false; } bool ChatProxy::lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const { diff --git a/Linphone/core/chat/ChatProxy.hpp b/Linphone/core/chat/ChatProxy.hpp index 3f25ef2b5..1a40e1fb4 100644 --- a/Linphone/core/chat/ChatProxy.hpp +++ b/Linphone/core/chat/ChatProxy.hpp @@ -40,7 +40,7 @@ public: bool lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const override; Q_INVOKABLE int findChatIndex(ChatGui *chatGui); - Q_INVOKABLE void addChatInList(ChatGui *chatGui); + Q_INVOKABLE bool addChatInList(ChatGui *chatGui); signals: void chatCreated(ChatGui *chatGui); diff --git a/Linphone/data/languages/de.ts b/Linphone/data/languages/de.ts index 86ad2d4ed..80560c786 100644 --- a/Linphone/data/languages/de.ts +++ b/Linphone/data/languages/de.ts @@ -2099,65 +2099,65 @@ ChatListView - + chat_message_is_writing_info %1 is writing… - + chat_message_draft_sending_text - + chat_room_delete "Delete" Löschen - + chat_room_mute - + chat_room_unmute "Mute" - + chat_room_mark_as_read "Mark as read" - + chat_room_leave "leave" - + chat_list_leave_chat_popup_title 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 ? - + chat_list_delete_chat_popup_title Delete the conversation ? - + chat_list_delete_chat_popup_message This conversation and all its messages will be deleted. Do You want to continue ? @@ -2512,74 +2512,91 @@ Error - + + info_popup_error_title + Fehler + + + + info_popup_chatroom_creation_failed + Chat room creation failed ! + + + + + loading_popup_chatroom_creation_pending_message + Chat room is being created... + + + + chat_dialog_delete_chat_title Supprimer la conversation ? - + chat_dialog_delete_chat_message "La conversation et tous ses messages seront supprimés." - + chat_list_title "Conversations" Konversationen - + menu_mark_all_as_read "mark all as read" - + chat_search_in_history "Rechercher une conversation" - + list_filter_no_result_found "Aucun résultat…" Kein Ergebnis… - + chat_list_empty_history "Aucune conversation dans votre historique" - + chat_action_start_new_chat "New chat" - + chat_start_group_chat_title "Nouveau groupe" - + chat_action_start_group_chat "Créer" Erstellen - - - + + + information_popup_error_title Fehler - + information_popup_chat_creation_failed_message "La création a échoué" @@ -2590,25 +2607,25 @@ Error Der Codec konnte nicht installiert werden. - + group_chat_error_must_have_name "Un nom doit être donné au groupe - + group_chat_error_no_participant "Please select at least one participant - + group_call_error_not_connected "Vous n'etes pas connecté" Sie sind nicht verbunden - + chat_creation_in_progress Creation de la conversation en cours … @@ -4134,7 +4151,7 @@ Error LoadingPopup - + cancel Abbrechen diff --git a/Linphone/data/languages/en.ts b/Linphone/data/languages/en.ts index 50c23c89d..3b5f7b2d2 100644 --- a/Linphone/data/languages/en.ts +++ b/Linphone/data/languages/en.ts @@ -2086,65 +2086,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 ? @@ -2496,98 +2496,115 @@ Only your correspondent can decrypt them. No conversation - + + info_popup_error_title + Error + + + + info_popup_chatroom_creation_failed + Chat room creation failed ! + Chat room creation failed ! + + + + loading_popup_chatroom_creation_pending_message + Chat room is being created... + 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… @@ -4060,7 +4077,7 @@ Expiration : %1 LoadingPopup - + cancel Cancel diff --git a/Linphone/data/languages/fr.ts b/Linphone/data/languages/fr.ts index 315557aae..fd97c5d6d 100644 --- a/Linphone/data/languages/fr.ts +++ b/Linphone/data/languages/fr.ts @@ -2086,65 +2086,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 ? @@ -2496,98 +2496,115 @@ en bout. Seul votre correspondant peut les déchiffrer. Aucune conversation - + + info_popup_error_title + Erreur + + + + info_popup_chatroom_creation_failed + Chat room creation failed ! + La création de la conversation a échoué ! + + + + loading_popup_chatroom_creation_pending_message + Chat room is being created... + 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… @@ -4060,7 +4077,7 @@ Expiration : %1 LoadingPopup - + cancel Annuler diff --git a/Linphone/view/Control/Button/IconButton.qml b/Linphone/view/Control/Button/IconButton.qml index 040e20c80..fce059491 100644 --- a/Linphone/view/Control/Button/IconButton.qml +++ b/Linphone/view/Control/Button/IconButton.qml @@ -23,7 +23,7 @@ Button { : mainItem.hovered || mainItem.hasNavigationFocus ? mainItem.hoveredColor : mainItem.color - border.color: mainItem.hovered ? mainItem.focusedBorderColor : mainItem.borderColor + border.color: mainItem.borderColor } contentItem: EffectImage { diff --git a/Linphone/view/Control/Display/Chat/ChatListView.qml b/Linphone/view/Control/Display/Chat/ChatListView.qml index 49d905162..7037c1987 100644 --- a/Linphone/view/Control/Display/Chat/ChatListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatListView.qml @@ -18,12 +18,19 @@ ListView { property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60) property ChatGui currentChatGui: model.getAt(currentIndex) || null + onCurrentIndexChanged: console.log("current index changed", currentIndex) onCurrentChatGuiChanged: positionViewAtIndex(currentIndex, ListView.Center) property ChatGui chatToSelect: null property ChatGui chatToSelectLater: null onChatToSelectChanged: { - selectChat(chatToSelect, true) - chatToSelect = null + if (chatToSelect) { + console.log("chat to select changed, select", (chatToSelect ? chatToSelect.core.title : "NULL")) + // first clear the chatToSelect property in case we need to + // force adding the chat to the list and the layout changes + var toselect = chatToSelect + chatToSelect = null + selectChat(toselect, true) + } } onChatClicked: (chat) => {selectChat(chat)} @@ -76,11 +83,11 @@ ListView { var index = chatProxy.findChatIndex(chatGui) // force adding chat to list if not in list for now if (index === -1 && force === true && chatGui) { - chatProxy.addChatInList(chatGui) - var index = chatProxy.findChatIndex(chatGui) + if (chatProxy.addChatInList(chatGui)) { + var index = chatProxy.findChatIndex(chatGui) + } } mainItem.currentIndex = index - } Component.onCompleted: cacheBuffer = Math.max(contentHeight, 0) //contentHeight>0 ? contentHeight : 0// cache all items diff --git a/Linphone/view/Control/Popup/Loading/LoadingPopup.qml b/Linphone/view/Control/Popup/Loading/LoadingPopup.qml index ded7f22e1..560310aa8 100644 --- a/Linphone/view/Control/Popup/Loading/LoadingPopup.qml +++ b/Linphone/view/Control/Popup/Loading/LoadingPopup.qml @@ -23,8 +23,10 @@ Popup { // height: childrenRect.height BusyIndicator{ Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: Utils.getSizeWithScreenRatio(33) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(33) + width: Utils.getSizeWithScreenRatio(33) + height: width + Layout.preferredWidth: width + Layout.preferredHeight: width } Text { id: contentText diff --git a/Linphone/view/Page/Main/Chat/ChatPage.qml b/Linphone/view/Page/Main/Chat/ChatPage.qml index 5d714d41d..638efce5e 100644 --- a/Linphone/view/Page/Main/Chat/ChatPage.qml +++ b/Linphone/view/Page/Main/Chat/ChatPage.qml @@ -30,8 +30,32 @@ AbstractMainPage { onRemoteAddressChanged: console.log("ChatPage : remote address changed :", remoteAddress) property var remoteChatObj: UtilsCpp.getChatForAddress(remoteAddress) property var remoteChat: remoteChatObj ? remoteChatObj.value : null + + signal openChatRequested(ChatGui chat) + + Connections { + enabled: remoteChat !== null + target: remoteChat ? remoteChat.core : null + function onChatRoomStateChanged() { + if (remoteChat.core.state === LinphoneEnums.ChatRoomState.CreationPending) { + //: Chat room is being created... + mainWindow.showLoadingPopup(qsTr("loading_popup_chatroom_creation_pending_message")) + } else { + mainWindow.closeLoadingPopup() + if (remoteChat.core.state === LinphoneEnums.ChatRoomState.CreationFailed) { + 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) { + openChatRequested(remoteChat) + } + } + } + } onRemoteChatChanged: { - if (remoteChat) selectedChatGui = remoteChat + if (remoteChat && remoteChat.core.state === LinphoneEnums.ChatRoomState.Created) { + openChatRequested(remoteChat) + } } onSelectedChatGuiChanged: { @@ -64,7 +88,6 @@ AbstractMainPage { && listStackView.currentItem.objectName != "newChatItem") listStackView.push(newChatItem) } - signal openChatRequested(ChatGui chat) Dialog { id: deleteChatPopup @@ -198,9 +221,6 @@ AbstractMainPage { Connections { target: mainItem - function onRemoteChatChanged() { - if (mainItem.remoteChat) chatListView.chatToSelect = mainItem.remoteChat - } function onOpenChatRequested(chat) { chatListView.chatToSelect = chat }