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) {
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.
//-----------------------------------------------------------

View file

@ -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:

View file

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

View file

@ -143,7 +143,7 @@ void ChatList::setSelf(QSharedPointer<ChatList> 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);

View file

@ -808,7 +808,7 @@
<translation>Auf Updates prüfen</translation>
</message>
<message>
<location filename="../../core/App.cpp" line="1590"/>
<location filename="../../core/App.cpp" line="1595"/>
<source>mark_all_read_action</source>
<translation>Alle als gelesen markieren</translation>
</message>
@ -2102,13 +2102,13 @@
<context>
<name>ChatCore</name>
<message>
<location filename="../../core/chat/ChatCore.cpp" line="145"/>
<location filename="../../core/chat/ChatCore.cpp" line="144"/>
<source>info_toast_deleted_title</source>
<extracomment>Deleted</extracomment>
<translation>Gelöscht</translation>
</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>
<extracomment>Message history has been deleted</extracomment>
<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>
</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>
<extracomment>Shared medias</extracomment>
<translation>Geteilte Medien</translation>
</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>
<extracomment>Shared documents</extracomment>
<translation>Geteilte Dokumente</translation>
</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>
<extracomment>Forward to</extracomment>
<translation>Weiterleiten an</translation>
</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>
<extracomment>Conversations</extracomment>
<translation>Konversationen</translation>

View file

@ -789,7 +789,7 @@
<translation>Check for update</translation>
</message>
<message>
<location filename="../../core/App.cpp" line="1590"/>
<location filename="../../core/App.cpp" line="1595"/>
<source>mark_all_read_action</source>
<translation>Marquer tout comme lu</translation>
</message>
@ -2065,13 +2065,13 @@
<context>
<name>ChatCore</name>
<message>
<location filename="../../core/chat/ChatCore.cpp" line="145"/>
<location filename="../../core/chat/ChatCore.cpp" line="144"/>
<source>info_toast_deleted_title</source>
<extracomment>Deleted</extracomment>
<translation>Deleted</translation>
</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>
<extracomment>Message history has been deleted</extracomment>
<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>
</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>
<extracomment>Shared medias</extracomment>
<translation>Shared medias</translation>
</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>
<extracomment>Shared documents</extracomment>
<translation>Shared documents</translation>
</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>
<extracomment>Forward to</extracomment>
<translation>Froward to</translation>
</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>
<extracomment>Conversations</extracomment>
<translation>Conversations</translation>

View file

@ -784,7 +784,7 @@
<translation>Rechercher une mise à jour</translation>
</message>
<message>
<location filename="../../core/App.cpp" line="1590"/>
<location filename="../../core/App.cpp" line="1595"/>
<source>mark_all_read_action</source>
<translation>Marquer tout comme lu</translation>
</message>
@ -2060,13 +2060,13 @@
<context>
<name>ChatCore</name>
<message>
<location filename="../../core/chat/ChatCore.cpp" line="145"/>
<location filename="../../core/chat/ChatCore.cpp" line="144"/>
<source>info_toast_deleted_title</source>
<extracomment>Deleted</extracomment>
<translation>Supprimé</translation>
</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>
<extracomment>Message history has been deleted</extracomment>
<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>
</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>
<extracomment>Shared medias</extracomment>
<translation>Médias partagés</translation>
</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>
<extracomment>Shared documents</extracomment>
<translation>Documents partagés</translation>
</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>
<extracomment>Forward to</extracomment>
<translation>Transférer à</translation>
</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>
<extracomment>Conversations</extracomment>
<translation>Conversations</translation>

View file

@ -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

View file

@ -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)

View file

@ -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()}
}
}
}