fix warnings

remove chat SafeConnection destruction

focus sending text area when chat change
This commit is contained in:
Gaelle Braud 2025-12-16 09:04:52 +01:00
parent e78e1fffbb
commit b34e4c24da
10 changed files with 36 additions and 28 deletions

View file

@ -1517,12 +1517,17 @@ void App::setMacOSDockActions() {
void App::setLocale(QString configLocale) { void App::setLocale(QString configLocale) {
if (!configLocale.isEmpty()) mLocale = QLocale(configLocale); if (!configLocale.isEmpty()) mLocale = QLocale(configLocale);
else mLocale = QLocale(QLocale::system().name()); else mLocale = QLocale(QLocale::system().name());
emit localeChanged();
} }
QLocale App::getLocale() { QLocale App::getLocale() {
return mLocale; return mLocale;
} }
QString App::getLocaleAsString() {
return mLocale.name();
}
//----------------------------------------------------------- //-----------------------------------------------------------
// Version infos. // Version infos.
//----------------------------------------------------------- //-----------------------------------------------------------

View file

@ -53,6 +53,7 @@ class App : public SingleApplication, public AbstractObject {
Q_PROPERTY(QString gitBranchName READ getGitBranchName CONSTANT) Q_PROPERTY(QString gitBranchName READ getGitBranchName CONSTANT)
Q_PROPERTY(QString sdkVersion READ getSdkVersion CONSTANT) Q_PROPERTY(QString sdkVersion READ getSdkVersion CONSTANT)
Q_PROPERTY(ChatGui *currentChat READ getCurrentChat WRITE setCurrentChat NOTIFY currentChatChanged) Q_PROPERTY(ChatGui *currentChat READ getCurrentChat WRITE setCurrentChat NOTIFY currentChatChanged)
Q_PROPERTY(QString localeAsString READ getLocaleAsString CONSTANT)
public: public:
App(int &argc, char *argv[]); App(int &argc, char *argv[]);
@ -135,6 +136,7 @@ public:
} }
void updateSysTrayCount(int n); void updateSysTrayCount(int n);
QLocale getLocale(); QLocale getLocale();
QString getLocaleAsString();
void onLoggerInitialized(); void onLoggerInitialized();
void sendCommand(); void sendCommand();
@ -210,6 +212,7 @@ signals:
void currentChatChanged(); void currentChatChanged();
void conferenceInfosChanged(); void conferenceInfosChanged();
void chatsChanged(); void chatsChanged();
void localeChanged();
// void executeCommand(QString command); // void executeCommand(QString command);
private: private:

View file

@ -118,7 +118,6 @@ ChatCore::ChatCore(const std::shared_ptr<linphone::ChatRoom> &chatRoom) : QObjec
ChatCore::~ChatCore() { ChatCore::~ChatCore() {
lDebug() << "[ChatCore] delete" << this; lDebug() << "[ChatCore] delete" << this;
mustBeInMainThread("~" + getClassName()); mustBeInMainThread("~" + getClassName());
if (mChatModelConnection) mChatModelConnection->disconnect();
emit mChatModel->removeListener(); emit mChatModel->removeListener();
} }

View file

@ -143,7 +143,7 @@ void ChatList::setSelf(QSharedPointer<ChatList> me) {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
if (!message) return; if (!message) return;
if (room->getAccount() != core->getDefaultAccount()) { 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; return;
} }
auto chatCore = ChatCore::create(room); auto chatCore = ChatCore::create(room);

View file

@ -808,7 +808,7 @@
<translation>Auf Updates prüfen</translation> <translation>Auf Updates prüfen</translation>
</message> </message>
<message> <message>
<location filename="../../core/App.cpp" line="1590"/> <location filename="../../core/App.cpp" line="1595"/>
<source>mark_all_read_action</source> <source>mark_all_read_action</source>
<translation>Alle als gelesen markieren</translation> <translation>Alle als gelesen markieren</translation>
</message> </message>
@ -2102,13 +2102,13 @@
<context> <context>
<name>ChatCore</name> <name>ChatCore</name>
<message> <message>
<location filename="../../core/chat/ChatCore.cpp" line="145"/> <location filename="../../core/chat/ChatCore.cpp" line="144"/>
<source>info_toast_deleted_title</source> <source>info_toast_deleted_title</source>
<extracomment>Deleted</extracomment> <extracomment>Deleted</extracomment>
<translation>Gelöscht</translation> <translation>Gelöscht</translation>
</message> </message>
<message> <message>
<location filename="../../core/chat/ChatCore.cpp" line="147"/> <location filename="../../core/chat/ChatCore.cpp" line="146"/>
<source>info_toast_deleted_message_history</source> <source>info_toast_deleted_message_history</source>
<extracomment>Message history has been deleted</extracomment> <extracomment>Message history has been deleted</extracomment>
<translation>Der Nachrichtenverlauf wurde gelöscht</translation> <translation>Der Nachrichtenverlauf wurde gelöscht</translation>
@ -5886,25 +5886,25 @@ Um sie in einem kommerziellen Projekt zu aktivieren, kontaktieren Sie uns bitte.
<translation>Auf %1 antworten</translation> <translation>Auf %1 antworten</translation>
</message> </message>
<message> <message>
<location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="637"/> <location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="638"/>
<source>shared_medias_title</source> <source>shared_medias_title</source>
<extracomment>Shared medias</extracomment> <extracomment>Shared medias</extracomment>
<translation>Geteilte Medien</translation> <translation>Geteilte Medien</translation>
</message> </message>
<message> <message>
<location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="639"/> <location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="640"/>
<source>shared_documents_title</source> <source>shared_documents_title</source>
<extracomment>Shared documents</extracomment> <extracomment>Shared documents</extracomment>
<translation>Geteilte Dokumente</translation> <translation>Geteilte Dokumente</translation>
</message> </message>
<message> <message>
<location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="668"/> <location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="669"/>
<source>forward_to_title</source> <source>forward_to_title</source>
<extracomment>Forward to</extracomment> <extracomment>Forward to</extracomment>
<translation>Weiterleiten an</translation> <translation>Weiterleiten an</translation>
</message> </message>
<message> <message>
<location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="702"/> <location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="703"/>
<source>conversations_title</source> <source>conversations_title</source>
<extracomment>Conversations</extracomment> <extracomment>Conversations</extracomment>
<translation>Konversationen</translation> <translation>Konversationen</translation>

View file

@ -789,7 +789,7 @@
<translation>Check for update</translation> <translation>Check for update</translation>
</message> </message>
<message> <message>
<location filename="../../core/App.cpp" line="1590"/> <location filename="../../core/App.cpp" line="1595"/>
<source>mark_all_read_action</source> <source>mark_all_read_action</source>
<translation>Marquer tout comme lu</translation> <translation>Marquer tout comme lu</translation>
</message> </message>
@ -2065,13 +2065,13 @@
<context> <context>
<name>ChatCore</name> <name>ChatCore</name>
<message> <message>
<location filename="../../core/chat/ChatCore.cpp" line="145"/> <location filename="../../core/chat/ChatCore.cpp" line="144"/>
<source>info_toast_deleted_title</source> <source>info_toast_deleted_title</source>
<extracomment>Deleted</extracomment> <extracomment>Deleted</extracomment>
<translation>Deleted</translation> <translation>Deleted</translation>
</message> </message>
<message> <message>
<location filename="../../core/chat/ChatCore.cpp" line="147"/> <location filename="../../core/chat/ChatCore.cpp" line="146"/>
<source>info_toast_deleted_message_history</source> <source>info_toast_deleted_message_history</source>
<extracomment>Message history has been deleted</extracomment> <extracomment>Message history has been deleted</extracomment>
<translation>Message history has been deleted</translation> <translation>Message history has been deleted</translation>
@ -5763,25 +5763,25 @@ To enable them in a commercial project, please contact us.</translation>
<translation>Reply to %1</translation> <translation>Reply to %1</translation>
</message> </message>
<message> <message>
<location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="637"/> <location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="638"/>
<source>shared_medias_title</source> <source>shared_medias_title</source>
<extracomment>Shared medias</extracomment> <extracomment>Shared medias</extracomment>
<translation>Shared medias</translation> <translation>Shared medias</translation>
</message> </message>
<message> <message>
<location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="639"/> <location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="640"/>
<source>shared_documents_title</source> <source>shared_documents_title</source>
<extracomment>Shared documents</extracomment> <extracomment>Shared documents</extracomment>
<translation>Shared documents</translation> <translation>Shared documents</translation>
</message> </message>
<message> <message>
<location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="668"/> <location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="669"/>
<source>forward_to_title</source> <source>forward_to_title</source>
<extracomment>Forward to</extracomment> <extracomment>Forward to</extracomment>
<translation>Froward to</translation> <translation>Froward to</translation>
</message> </message>
<message> <message>
<location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="702"/> <location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="703"/>
<source>conversations_title</source> <source>conversations_title</source>
<extracomment>Conversations</extracomment> <extracomment>Conversations</extracomment>
<translation>Conversations</translation> <translation>Conversations</translation>

View file

@ -784,7 +784,7 @@
<translation>Rechercher une mise à jour</translation> <translation>Rechercher une mise à jour</translation>
</message> </message>
<message> <message>
<location filename="../../core/App.cpp" line="1590"/> <location filename="../../core/App.cpp" line="1595"/>
<source>mark_all_read_action</source> <source>mark_all_read_action</source>
<translation>Marquer tout comme lu</translation> <translation>Marquer tout comme lu</translation>
</message> </message>
@ -2060,13 +2060,13 @@
<context> <context>
<name>ChatCore</name> <name>ChatCore</name>
<message> <message>
<location filename="../../core/chat/ChatCore.cpp" line="145"/> <location filename="../../core/chat/ChatCore.cpp" line="144"/>
<source>info_toast_deleted_title</source> <source>info_toast_deleted_title</source>
<extracomment>Deleted</extracomment> <extracomment>Deleted</extracomment>
<translation>Supprimé</translation> <translation>Supprimé</translation>
</message> </message>
<message> <message>
<location filename="../../core/chat/ChatCore.cpp" line="147"/> <location filename="../../core/chat/ChatCore.cpp" line="146"/>
<source>info_toast_deleted_message_history</source> <source>info_toast_deleted_message_history</source>
<extracomment>Message history has been deleted</extracomment> <extracomment>Message history has been deleted</extracomment>
<translation>L&apos;historique des messages a é supprimé</translation> <translation>L&apos;historique des messages a é supprimé</translation>
@ -5758,25 +5758,25 @@ Pour les activer dans un projet commercial, merci de nous contacter.</translatio
<translation>Réponse à %1</translation> <translation>Réponse à %1</translation>
</message> </message>
<message> <message>
<location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="637"/> <location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="638"/>
<source>shared_medias_title</source> <source>shared_medias_title</source>
<extracomment>Shared medias</extracomment> <extracomment>Shared medias</extracomment>
<translation>Médias partagés</translation> <translation>Médias partagés</translation>
</message> </message>
<message> <message>
<location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="639"/> <location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="640"/>
<source>shared_documents_title</source> <source>shared_documents_title</source>
<extracomment>Shared documents</extracomment> <extracomment>Shared documents</extracomment>
<translation>Documents partagés</translation> <translation>Documents partagés</translation>
</message> </message>
<message> <message>
<location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="668"/> <location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="669"/>
<source>forward_to_title</source> <source>forward_to_title</source>
<extracomment>Forward to</extracomment> <extracomment>Forward to</extracomment>
<translation>Transférer à</translation> <translation>Transférer à</translation>
</message> </message>
<message> <message>
<location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="702"/> <location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="703"/>
<source>conversations_title</source> <source>conversations_title</source>
<extracomment>Conversations</extracomment> <extracomment>Conversations</extracomment>
<translation>Conversations</translation> <translation>Conversations</translation>

View file

@ -146,7 +146,7 @@ Loader{
width: height width: height
Rectangle { Rectangle {
id: initialItem 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 radius: width / 2
color: DefaultStyle.main2_200 color: DefaultStyle.main2_200
height: stackView.height height: stackView.height

View file

@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls.Basic as Control import QtQuick.Controls.Basic as Control
import Linphone import Linphone
import UtilsCpp 1.0 import UtilsCpp
import ConstantsCpp import ConstantsCpp
import SettingsCpp import SettingsCpp
import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle
@ -36,7 +36,7 @@ FocusScope {
property real itemsRightMargin: Utils.getSizeWithScreenRatio(39) property real itemsRightMargin: Utils.getSizeWithScreenRatio(39)
property var displayName: searchResultItem? searchResultItem.core.fullName : "" 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 clicked(var mouse)
signal contactDeletionRequested(FriendGui contact) signal contactDeletionRequested(FriendGui contact)

View file

@ -114,7 +114,7 @@ FocusScope {
} }
} }
RowLayout { RowLayout {
visible: mainItem.chat.core.ephemeralEnabled visible: mainItem.chat?.core.ephemeralEnabled || false
EffectImage { EffectImage {
colorizationColor: DefaultStyle.main1_500_main colorizationColor: DefaultStyle.main1_500_main
Layout.preferredWidth: Utils.getSizeWithScreenRatio(14) Layout.preferredWidth: Utils.getSizeWithScreenRatio(14)
@ -122,7 +122,7 @@ FocusScope {
imageSource: AppIcons.clockCountDown imageSource: AppIcons.clockCountDown
} }
Text { Text {
text: UtilsCpp.getEphemeralFormatedTime(mainItem.chat.core.ephemeralLifetime) text: mainItem.chat ? UtilsCpp.getEphemeralFormatedTime(mainItem.chat.core.ephemeralLifetime) : ""
} }
} }
} }
@ -534,6 +534,7 @@ FocusScope {
function onReplyingToMessageChanged() { function onReplyingToMessageChanged() {
if (mainItem.replyingToMessage) messageSender.focusTextArea() if (mainItem.replyingToMessage) messageSender.focusTextArea()
} }
function onChatChanged() {messageSender.focusTextArea()}
} }
} }
} }