diff --git a/Linphone/core/chat/ChatCore.cpp b/Linphone/core/chat/ChatCore.cpp index 921576c8f..03abe3593 100644 --- a/Linphone/core/chat/ChatCore.cpp +++ b/Linphone/core/chat/ChatCore.cpp @@ -54,10 +54,11 @@ ChatCore::ChatCore(const std::shared_ptr &chatRoom) : QObjec mPeerAddress = Utils::coreStringToAppString(chatRoomAddress->asStringUriOnly()); mIsGroupChat = false; mIsBasic = true; + mConferenceJoined = true; } else { mIsBasic = false; + auto participants = chatRoom->getParticipants(); if (chatRoom->hasCapability((int)linphone::ChatRoom::Capabilities::OneToOne)) { - auto participants = chatRoom->getParticipants(); if (participants.size() > 0) { auto peer = participants.front(); if (peer) mTitle = ToolModel::getDisplayName(peer->getAddress()->clone()); @@ -74,6 +75,7 @@ ChatCore::ChatCore(const std::shared_ptr &chatRoom) : QObjec mIsGroupChat = true; mMeAdmin = chatRoom->getMe() && chatRoom->getMe()->isAdmin(); } + mConferenceJoined = participants.size() != 0; } mUnreadMessagesCount = chatRoom->getUnreadMessagesCount(); connect(this, &ChatCore::unreadMessagesCountChanged, this, [this] { @@ -210,6 +212,25 @@ void ChatCore::setSelf(QSharedPointer me) { &ChatModel::conferenceJoined, [this](const std::shared_ptr &chatRoom, const std::shared_ptr &eventLog) { auto participants = buildParticipants(chatRoom); + if (chatRoom->hasCapability((int)linphone::ChatRoom::Capabilities::OneToOne)) { + QString title, avatarUri; + auto linParticipants = chatRoom->getParticipants(); + if (linParticipants.size() > 0) { + auto peer = linParticipants.front(); + if (peer) title = ToolModel::getDisplayName(peer->getAddress()->clone()); + avatarUri = ToolModel::getDisplayName(peer->getAddress()->clone()); + if (linParticipants.size() == 1) { + auto peerAddress = peer->getAddress(); + if (peerAddress) mPeerAddress = Utils::coreStringToAppString(peerAddress->asStringUriOnly()); + } + } + mChatModelConnection->invokeToCore([this, title, avatarUri]() { + setTitle(title); + setAvatarUri(avatarUri); + mConferenceJoined = true; + emit conferenceJoined(); + }); + } mChatModelConnection->invokeToCore([this, participants]() { setParticipants(participants); }); }); diff --git a/Linphone/core/chat/ChatCore.hpp b/Linphone/core/chat/ChatCore.hpp index cfb696571..2c69b6e96 100644 --- a/Linphone/core/chat/ChatCore.hpp +++ b/Linphone/core/chat/ChatCore.hpp @@ -64,6 +64,7 @@ public: Q_PROPERTY( int ephemeralLifetime READ getEphemeralLifetime WRITE lSetEphemeralLifetime NOTIFY ephemeralLifetimeChanged) Q_PROPERTY(bool muted READ isMuted WRITE lSetMuted NOTIFY mutedChanged) + Q_PROPERTY(bool conferenceJoined MEMBER mConferenceJoined NOTIFY conferenceJoined) Q_PROPERTY(bool meAdmin READ getMeAdmin WRITE setMeAdmin NOTIFY meAdminChanged) Q_PROPERTY(QVariantList participants READ getParticipantsGui NOTIFY participantsChanged) Q_PROPERTY(QStringList participantsAddresses READ getParticipantsAddresses WRITE lSetParticipantsAddresses NOTIFY @@ -177,6 +178,7 @@ signals: void participantsChanged(); void fileListChanged(); void isSecuredChanged(); + void conferenceJoined(); void lDeleteMessage(ChatMessageGui *message); void lDelete(); @@ -222,6 +224,7 @@ private: QList> mFileList; bool mIsMuted = false; bool mMeAdmin = false; + bool mConferenceJoined = false; QList> mParticipants; LinphoneEnums::ChatRoomState mChatRoomState; std::shared_ptr mChatModel; diff --git a/Linphone/data/languages/de.ts b/Linphone/data/languages/de.ts index 16eadd572..45c9799a9 100644 --- a/Linphone/data/languages/de.ts +++ b/Linphone/data/languages/de.ts @@ -1315,6 +1315,7 @@ Anruf pausiert + call_srtp_point_to_point_encrypted Appel chiffré de point à point @@ -1327,23 +1328,22 @@ Validierung erforderlich - - + call_zrtp_end_to_end_encrypted Appel chiffré de bout en bout Ende-zu-Ende verschlüsselter Anruf - + call_not_encrypted "Appel non chiffré" Unverschlüsselter Anruf - + call_waiting_for_encryption_info - "En attente de chiffrement" + Waiting for encryption Warten auf Verschlüsselung @@ -1760,13 +1760,13 @@ ChatCore - + info_toast_deleted_title Deleted - + info_toast_deleted_message_history Message history has been deleted @@ -2143,79 +2143,79 @@ Error - + 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" - + menu_mark_all_as_read "mark all as read" - + chat_search_in_history "Rechercher une conversation" - + list_filter_no_result_found "Aucun résultat…" - + 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" - - + + information_popup_error_title - + group_chat_error_must_have_name "Un nom doit être donné au groupe - + group_call_error_not_connected "Vous n'etes pas connecté" Sie sind nicht verbunden @@ -5000,7 +5000,7 @@ Pour les activer dans un projet commercial, merci de nous contacter. SelectedChatView - + chat_view_group_call_toast_message Start a group call ? diff --git a/Linphone/data/languages/en.ts b/Linphone/data/languages/en.ts index 8855ada1a..93a60216d 100644 --- a/Linphone/data/languages/en.ts +++ b/Linphone/data/languages/en.ts @@ -1277,6 +1277,7 @@ Call paused + call_srtp_point_to_point_encrypted Appel chiffré de point à point @@ -1289,23 +1290,22 @@ Validation required - - + call_zrtp_end_to_end_encrypted Appel chiffré de bout en bout End-to-end encrypted call - + call_not_encrypted "Appel non chiffré" Unencrypted call - + call_waiting_for_encryption_info - "En attente de chiffrement" + Waiting for encryption Waiting for encryption @@ -1722,13 +1722,13 @@ ChatCore - + info_toast_deleted_title Deleted Deleted - + info_toast_deleted_message_history Message history has been deleted Message history has been deleted @@ -2106,79 +2106,79 @@ Only your correspondent can decrypt them. No conversation - + 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 - + group_chat_error_must_have_name "Un nom doit être donné au groupe A name must be set for the group - + group_call_error_not_connected "Vous n'etes pas connecté" You are not connected @@ -4889,7 +4889,7 @@ To enable them in a commercial project, please contact us. SelectedChatView - + chat_view_group_call_toast_message Start a group call ? diff --git a/Linphone/data/languages/fr_FR.ts b/Linphone/data/languages/fr_FR.ts index 17bdf1c1d..6313d2bbc 100644 --- a/Linphone/data/languages/fr_FR.ts +++ b/Linphone/data/languages/fr_FR.ts @@ -1277,6 +1277,7 @@ Appel mis en pause + call_srtp_point_to_point_encrypted Appel chiffré de point à point @@ -1289,23 +1290,22 @@ Vérification nécessaire - - + call_zrtp_end_to_end_encrypted Appel chiffré de bout en bout Appel chiffré de bout en bout - + call_not_encrypted "Appel non chiffré" Appel non chiffré - + call_waiting_for_encryption_info - "En attente de chiffrement" + Waiting for encryption En attente de chiffrement @@ -1722,13 +1722,13 @@ ChatCore - + info_toast_deleted_title Deleted Supprimé - + info_toast_deleted_message_history Message history has been deleted L'historique des messages a été supprimé @@ -2106,79 +2106,79 @@ en bout. Seul votre correspondant peut les déchiffrer. Aucune conversation - + 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 - + group_chat_error_must_have_name "Un nom doit être donné au groupe Un nom doit être donné au groupe - + group_call_error_not_connected "Vous n'etes pas connecté" Vous n'êtes pas connecté @@ -4889,7 +4889,7 @@ Pour les activer dans un projet commercial, merci de nous contacter. SelectedChatView - + chat_view_group_call_toast_message Démarrer un appel de groupe ? diff --git a/Linphone/view/Page/Form/Chat/SelectedChatView.qml b/Linphone/view/Page/Form/Chat/SelectedChatView.qml index 78fa692db..2e945754f 100644 --- a/Linphone/view/Page/Form/Chat/SelectedChatView.qml +++ b/Linphone/view/Page/Form/Chat/SelectedChatView.qml @@ -16,6 +16,7 @@ FocusScope { property ChatMessageGui chatMessage property var contactObj: chat ? UtilsCpp.findFriendByAddress(mainItem.chat.core.peerAddress) : null property var contact: contactObj?.value || null + property alias messagesLoading: chatMessagesListView.loading property CallGui call property alias callHeaderContent: splitPanel.headerContentItem property bool replyingToMessage: false @@ -258,7 +259,6 @@ FocusScope { ChatMessagesListView { id: chatMessagesListView clip: true - height: implicitHeight backgroundColor: splitPanel.panelColor width: parent.width - anchors.leftMargin - anchors.rightMargin chat: mainItem.chat diff --git a/Linphone/view/Page/Main/Chat/ChatPage.qml b/Linphone/view/Page/Main/Chat/ChatPage.qml index 08890f87a..e6c7dfd18 100644 --- a/Linphone/view/Page/Main/Chat/ChatPage.qml +++ b/Linphone/view/Page/Main/Chat/ChatPage.qml @@ -31,7 +31,8 @@ AbstractMainPage { property var remoteChatObj: UtilsCpp.getChatForAddress(remoteAddress) property var remoteChat: remoteChatObj ? remoteChatObj.value : null onRemoteChatChanged: { - selectedChatGui = remoteChat + if (remoteChat) selectedChatGui = remoteChat + else console.log("chat is null") } onSelectedChatGuiChanged: { @@ -330,9 +331,16 @@ AbstractMainPage { Component { id: currentChatComp FocusScope { + BusyIndicator { + anchors.centerIn: parent + visible: selectedChatView.chat && !selectedChatView.visible + indicatorHeight: visible ? Math.round(60 * DefaultStyle.dp) : 0 + indicatorWidth: Math.round(60 * DefaultStyle.dp) + indicatorColor: DefaultStyle.main1_500_main + } SelectedChatView { id: selectedChatView - visible: chat != undefined && chat != null + visible: chat && (chat.core.isBasic || chat.core.conferenceJoined) anchors.fill: parent chat: mainItem.selectedChatGui ? mainItem.selectedChatGui : null onChatChanged: { @@ -343,9 +351,15 @@ AbstractMainPage { Connections { target: mainItem function onSelectedChatGuiChanged() { - selectedChatView.chat = mainItem.selectedChatGui + if (mainItem.selectedChatGui) selectedChatView.chat = mainItem.selectedChatGui } } + Binding { + target: mainItem + property: "showDefaultItem" + when: selectedChatView.messagesLoading + value: false + } } } }