From f53b9927044fb938b1fe221a77f2d110c0166c40 Mon Sep 17 00:00:00 2001 From: gaelle Date: Mon, 8 Dec 2025 15:28:59 +0100 Subject: [PATCH] put confinfo list in app so it is intanciated only once chat list in app to load it once --- Linphone/core/App.cpp | 21 +++++++++++++++++++ Linphone/core/App.hpp | 12 +++++++++++ Linphone/core/chat/ChatProxy.cpp | 6 +++++- .../core/conference/ConferenceInfoProxy.cpp | 6 +++++- Linphone/core/notifier/Notifier.cpp | 2 +- .../Control/Display/Chat/ChatListView.qml | 3 --- .../Display/Meeting/MeetingListView.qml | 3 --- 7 files changed, 44 insertions(+), 9 deletions(-) diff --git a/Linphone/core/App.cpp b/Linphone/core/App.cpp index 2460aede..5a407517 100644 --- a/Linphone/core/App.cpp +++ b/Linphone/core/App.cpp @@ -1190,6 +1190,27 @@ AccountList *App::getAccounts() const { return mAccountList.get(); } +QSharedPointer App::getConferenceInfoList() const { + return mConferenceInfoList; +} +void App::setConferenceInfoList(QSharedPointer data) { + if (mConferenceInfoList != data) { + mConferenceInfoList = data; + emit conferenceInfosChanged(); + } +} + +QSharedPointer App::getChatList() const { + return mChatList; +} + +void App::setChatList(QSharedPointer data) { + if (mChatList != data) { + mChatList = data; + emit chatsChanged(); + } +} + QSharedPointer App::getCallList() const { return mCallList; } diff --git a/Linphone/core/App.hpp b/Linphone/core/App.hpp index a18387e2..3168d39d 100644 --- a/Linphone/core/App.hpp +++ b/Linphone/core/App.hpp @@ -26,6 +26,8 @@ #include "core/account/AccountProxy.hpp" #include "core/call/CallProxy.hpp" #include "core/chat/ChatGui.hpp" +#include "core/chat/ChatList.hpp" +#include "core/conference/ConferenceInfoList.hpp" #include "core/setting/SettingsCore.hpp" #include "core/singleapplication/singleapplication.h" #include "model/cli/CliModel.hpp" @@ -154,6 +156,12 @@ public: void setAccountList(QSharedPointer data); Q_INVOKABLE AccountList *getAccounts() const; + QSharedPointer getConferenceInfoList() const; + void setConferenceInfoList(QSharedPointer data); + + QSharedPointer getChatList() const; + void setChatList(QSharedPointer data); + QSharedPointer getCallList() const; void setCallList(QSharedPointer data); Q_INVOKABLE CallList *getCalls() const; @@ -198,6 +206,8 @@ signals: void callsChanged(); void currentDateChanged(); void currentChatChanged(); + void conferenceInfosChanged(); + void chatsChanged(); // void executeCommand(QString command); private: @@ -220,6 +230,8 @@ private: ChatGui *mCurrentChat = nullptr; QSharedPointer mSettings; QSharedPointer mAccountList; + QSharedPointer mConferenceInfoList; + QSharedPointer mChatList; QSharedPointer mCallList; QSharedPointer> mCoreModelConnection; QSharedPointer> mCliModelConnection; diff --git a/Linphone/core/chat/ChatProxy.cpp b/Linphone/core/chat/ChatProxy.cpp index fd30a71a..d56be470 100644 --- a/Linphone/core/chat/ChatProxy.cpp +++ b/Linphone/core/chat/ChatProxy.cpp @@ -26,7 +26,11 @@ DEFINE_ABSTRACT_OBJECT(ChatProxy) ChatProxy::ChatProxy(QObject *parent) { - mList = ChatList::create(); + if (!App::getInstance()->getChatList()) { + mList = ChatList::create(); + App::getInstance()->setChatList(mList); + } + mList = App::getInstance()->getChatList(); setSourceModel(mList.get()); setDynamicSortFilter(true); } diff --git a/Linphone/core/conference/ConferenceInfoProxy.cpp b/Linphone/core/conference/ConferenceInfoProxy.cpp index 81816d98..3d77ba3f 100644 --- a/Linphone/core/conference/ConferenceInfoProxy.cpp +++ b/Linphone/core/conference/ConferenceInfoProxy.cpp @@ -27,7 +27,11 @@ DEFINE_ABSTRACT_OBJECT(ConferenceInfoProxy) ConferenceInfoProxy::ConferenceInfoProxy(QObject *parent) : LimitProxy(parent) { - mList = ConferenceInfoList::create(); + if (!App::getInstance()->getConferenceInfoList()) { + mList = ConferenceInfoList::create(); + App::getInstance()->setConferenceInfoList(mList); + } + mList = App::getInstance()->getConferenceInfoList(); setSourceModels(new SortFilterList(mList.get(), Qt::AscendingOrder)); connect( mList.get(), &ConferenceInfoList::haveCurrentDateChanged, this, diff --git a/Linphone/core/notifier/Notifier.cpp b/Linphone/core/notifier/Notifier.cpp index 8612d3bf..c3866303 100644 --- a/Linphone/core/notifier/Notifier.cpp +++ b/Linphone/core/notifier/Notifier.cpp @@ -358,7 +358,7 @@ void Notifier::notifyReceivedMessages(const std::shared_ptr if (content->isText()) txt += content->getUtf8Text().c_str(); } } else if (fileContent->isVoiceRecording()) - //: 'Voice message received!' : message to warn the user in a notofication for voice messages. + //: 'Voice message received!' : message to warn the user in a notification for voice messages. txt = tr("new_voice_message"); else txt = tr("new_file_message"); if (txt.isEmpty() && message->hasConferenceInvitationContent()) diff --git a/Linphone/view/Control/Display/Chat/ChatListView.qml b/Linphone/view/Control/Display/Chat/ChatListView.qml index 1291b6d5..3718f549 100644 --- a/Linphone/view/Control/Display/Chat/ChatListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatListView.qml @@ -38,9 +38,6 @@ ListView { model: ChatProxy { id: chatProxy - Component.onCompleted: { - loading = true - } filterText: mainItem.searchText onFilterTextChanged: { chatToSelectLater = currentChatGui diff --git a/Linphone/view/Control/Display/Meeting/MeetingListView.qml b/Linphone/view/Control/Display/Meeting/MeetingListView.qml index 4983b056..d47c619b 100644 --- a/Linphone/view/Control/Display/Meeting/MeetingListView.qml +++ b/Linphone/view/Control/Display/Meeting/MeetingListView.qml @@ -101,9 +101,6 @@ ListView { filterType: ConferenceInfoProxy.None initialDisplayItems: Math.max(20, Math.round(2 * mainItem.height / Utils.getSizeWithScreenRatio(63))) displayItemsStep: initialDisplayItems/2 - Component.onCompleted: { - mainItem.loading = false - } onModelAboutToBeReset: { mainItem.loading = true }