From b34e4c24da0506c01d729e7580a423fe8de8ae89 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Tue, 16 Dec 2025 09:04:52 +0100 Subject: [PATCH] fix warnings remove chat SafeConnection destruction focus sending text area when chat change --- Linphone/core/App.cpp | 5 +++++ Linphone/core/App.hpp | 3 +++ Linphone/core/chat/ChatCore.cpp | 1 - Linphone/core/chat/ChatList.cpp | 2 +- Linphone/data/languages/de.ts | 14 +++++++------- Linphone/data/languages/en.ts | 14 +++++++------- Linphone/data/languages/fr.ts | 14 +++++++------- Linphone/view/Control/Display/Contact/Avatar.qml | 2 +- .../Control/Display/Contact/ContactListItem.qml | 4 ++-- Linphone/view/Page/Form/Chat/SelectedChatView.qml | 5 +++-- 10 files changed, 36 insertions(+), 28 deletions(-) diff --git a/Linphone/core/App.cpp b/Linphone/core/App.cpp index 078af8bff..90d819148 100644 --- a/Linphone/core/App.cpp +++ b/Linphone/core/App.cpp @@ -1517,12 +1517,17 @@ void App::setMacOSDockActions() { void App::setLocale(QString configLocale) { if (!configLocale.isEmpty()) mLocale = QLocale(configLocale); else mLocale = QLocale(QLocale::system().name()); + emit localeChanged(); } QLocale App::getLocale() { return mLocale; } +QString App::getLocaleAsString() { + return mLocale.name(); +} + //----------------------------------------------------------- // Version infos. //----------------------------------------------------------- diff --git a/Linphone/core/App.hpp b/Linphone/core/App.hpp index 240fe4c49..f699856de 100644 --- a/Linphone/core/App.hpp +++ b/Linphone/core/App.hpp @@ -53,6 +53,7 @@ class App : public SingleApplication, public AbstractObject { Q_PROPERTY(QString gitBranchName READ getGitBranchName CONSTANT) Q_PROPERTY(QString sdkVersion READ getSdkVersion CONSTANT) Q_PROPERTY(ChatGui *currentChat READ getCurrentChat WRITE setCurrentChat NOTIFY currentChatChanged) + Q_PROPERTY(QString localeAsString READ getLocaleAsString CONSTANT) public: App(int &argc, char *argv[]); @@ -135,6 +136,7 @@ public: } void updateSysTrayCount(int n); QLocale getLocale(); + QString getLocaleAsString(); void onLoggerInitialized(); void sendCommand(); @@ -210,6 +212,7 @@ signals: void currentChatChanged(); void conferenceInfosChanged(); void chatsChanged(); + void localeChanged(); // void executeCommand(QString command); private: diff --git a/Linphone/core/chat/ChatCore.cpp b/Linphone/core/chat/ChatCore.cpp index 149b8262f..cb00b146c 100644 --- a/Linphone/core/chat/ChatCore.cpp +++ b/Linphone/core/chat/ChatCore.cpp @@ -118,7 +118,6 @@ ChatCore::ChatCore(const std::shared_ptr &chatRoom) : QObjec ChatCore::~ChatCore() { lDebug() << "[ChatCore] delete" << this; mustBeInMainThread("~" + getClassName()); - if (mChatModelConnection) mChatModelConnection->disconnect(); emit mChatModel->removeListener(); } diff --git a/Linphone/core/chat/ChatList.cpp b/Linphone/core/chat/ChatList.cpp index 7a7bf38d3..0f3944c42 100644 --- a/Linphone/core/chat/ChatList.cpp +++ b/Linphone/core/chat/ChatList.cpp @@ -143,7 +143,7 @@ void ChatList::setSelf(QSharedPointer me) { mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); if (!message) return; if (room->getAccount() != core->getDefaultAccount()) { - qWarning() << log().arg("Chat room does not refer to current account, return"); + qInfo() << log().arg("Chat room does not refer to current account, return"); return; } auto chatCore = ChatCore::create(room); diff --git a/Linphone/data/languages/de.ts b/Linphone/data/languages/de.ts index 1498ad5a6..eca5cc4d5 100644 --- a/Linphone/data/languages/de.ts +++ b/Linphone/data/languages/de.ts @@ -808,7 +808,7 @@ Auf Updates prüfen - + mark_all_read_action Alle als gelesen markieren @@ -2102,13 +2102,13 @@ ChatCore - + info_toast_deleted_title Deleted Gelöscht - + info_toast_deleted_message_history Message history has been deleted Der Nachrichtenverlauf wurde gelöscht @@ -5886,25 +5886,25 @@ Um sie in einem kommerziellen Projekt zu aktivieren, kontaktieren Sie uns bitte. Auf %1 antworten - + shared_medias_title Shared medias Geteilte Medien - + shared_documents_title Shared documents Geteilte Dokumente - + forward_to_title Forward to… Weiterleiten an… - + conversations_title Conversations Konversationen diff --git a/Linphone/data/languages/en.ts b/Linphone/data/languages/en.ts index e73f95e00..b04f291a3 100644 --- a/Linphone/data/languages/en.ts +++ b/Linphone/data/languages/en.ts @@ -789,7 +789,7 @@ Check for update - + mark_all_read_action Marquer tout comme lu @@ -2065,13 +2065,13 @@ ChatCore - + info_toast_deleted_title Deleted Deleted - + info_toast_deleted_message_history Message history has been deleted Message history has been deleted @@ -5763,25 +5763,25 @@ To enable them in a commercial project, please contact us. Reply to %1 - + shared_medias_title Shared medias Shared medias - + shared_documents_title Shared documents Shared documents - + forward_to_title Forward to… Froward to… - + conversations_title Conversations Conversations diff --git a/Linphone/data/languages/fr.ts b/Linphone/data/languages/fr.ts index f776f4812..504c2fc28 100644 --- a/Linphone/data/languages/fr.ts +++ b/Linphone/data/languages/fr.ts @@ -784,7 +784,7 @@ Rechercher une mise à jour - + mark_all_read_action Marquer tout comme lu @@ -2060,13 +2060,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é @@ -5758,25 +5758,25 @@ Pour les activer dans un projet commercial, merci de nous contacter.Réponse à %1 - + shared_medias_title Shared medias Médias partagés - + shared_documents_title Shared documents Documents partagés - + forward_to_title Forward to… Transférer à… - + conversations_title Conversations Conversations diff --git a/Linphone/view/Control/Display/Contact/Avatar.qml b/Linphone/view/Control/Display/Contact/Avatar.qml index 8de31f8b0..735f95381 100644 --- a/Linphone/view/Control/Display/Contact/Avatar.qml +++ b/Linphone/view/Control/Display/Contact/Avatar.qml @@ -146,7 +146,7 @@ Loader{ width: height Rectangle { id: initialItem - property string initials: mainItem.isConference || mainItem.displayNameVal[0] === "+" ? "" : UtilsCpp.getInitials(mainItem.displayNameVal) + property string initials: mainItem.isConference || (mainItem.displayNameVal && mainItem.displayNameVal[0] === "+") ? "" : UtilsCpp.getInitials(mainItem.displayNameVal) radius: width / 2 color: DefaultStyle.main2_200 height: stackView.height diff --git a/Linphone/view/Control/Display/Contact/ContactListItem.qml b/Linphone/view/Control/Display/Contact/ContactListItem.qml index c9ffc5dba..89ab3b238 100644 --- a/Linphone/view/Control/Display/Contact/ContactListItem.qml +++ b/Linphone/view/Control/Display/Contact/ContactListItem.qml @@ -3,7 +3,7 @@ import QtQuick.Layouts import QtQuick.Controls.Basic as Control import Linphone -import UtilsCpp 1.0 +import UtilsCpp import ConstantsCpp import SettingsCpp import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle @@ -36,7 +36,7 @@ FocusScope { property real itemsRightMargin: Utils.getSizeWithScreenRatio(39) property var displayName: searchResultItem? searchResultItem.core.fullName : "" - property var initial: displayName != "" ? displayName[0].toLocaleLowerCase(ConstantsCpp.DefaultLocale) : '' + property var initial: displayName.length > 0 ? displayName[0].toLocaleLowerCase(AppCpp.localeAsString) : '' signal clicked(var mouse) signal contactDeletionRequested(FriendGui contact) diff --git a/Linphone/view/Page/Form/Chat/SelectedChatView.qml b/Linphone/view/Page/Form/Chat/SelectedChatView.qml index 4b55be5e2..38f68de42 100644 --- a/Linphone/view/Page/Form/Chat/SelectedChatView.qml +++ b/Linphone/view/Page/Form/Chat/SelectedChatView.qml @@ -114,7 +114,7 @@ FocusScope { } } RowLayout { - visible: mainItem.chat.core.ephemeralEnabled + visible: mainItem.chat?.core.ephemeralEnabled || false EffectImage { colorizationColor: DefaultStyle.main1_500_main Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) @@ -122,7 +122,7 @@ FocusScope { imageSource: AppIcons.clockCountDown } Text { - text: UtilsCpp.getEphemeralFormatedTime(mainItem.chat.core.ephemeralLifetime) + text: mainItem.chat ? UtilsCpp.getEphemeralFormatedTime(mainItem.chat.core.ephemeralLifetime) : "" } } } @@ -534,6 +534,7 @@ FocusScope { function onReplyingToMessageChanged() { if (mainItem.replyingToMessage) messageSender.focusTextArea() } + function onChatChanged() {messageSender.focusTextArea()} } } }