put confinfo list in app so it is intanciated only once

chat list in app to load it once
This commit is contained in:
gaelle 2025-12-08 15:28:59 +01:00 committed by gaelle.braud
parent a562b0f1c8
commit f53b992704
7 changed files with 44 additions and 9 deletions

View file

@ -1190,6 +1190,27 @@ AccountList *App::getAccounts() const {
return mAccountList.get();
}
QSharedPointer<ConferenceInfoList> App::getConferenceInfoList() const {
return mConferenceInfoList;
}
void App::setConferenceInfoList(QSharedPointer<ConferenceInfoList> data) {
if (mConferenceInfoList != data) {
mConferenceInfoList = data;
emit conferenceInfosChanged();
}
}
QSharedPointer<ChatList> App::getChatList() const {
return mChatList;
}
void App::setChatList(QSharedPointer<ChatList> data) {
if (mChatList != data) {
mChatList = data;
emit chatsChanged();
}
}
QSharedPointer<CallList> App::getCallList() const {
return mCallList;
}

View file

@ -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<AccountList> data);
Q_INVOKABLE AccountList *getAccounts() const;
QSharedPointer<ConferenceInfoList> getConferenceInfoList() const;
void setConferenceInfoList(QSharedPointer<ConferenceInfoList> data);
QSharedPointer<ChatList> getChatList() const;
void setChatList(QSharedPointer<ChatList> data);
QSharedPointer<CallList> getCallList() const;
void setCallList(QSharedPointer<CallList> 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<SettingsCore> mSettings;
QSharedPointer<AccountList> mAccountList;
QSharedPointer<ConferenceInfoList> mConferenceInfoList;
QSharedPointer<ChatList> mChatList;
QSharedPointer<CallList> mCallList;
QSharedPointer<SafeConnection<App, CoreModel>> mCoreModelConnection;
QSharedPointer<SafeConnection<App, CliModel>> mCliModelConnection;

View file

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

View file

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

View file

@ -358,7 +358,7 @@ void Notifier::notifyReceivedMessages(const std::shared_ptr<linphone::ChatRoom>
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())

View file

@ -38,9 +38,6 @@ ListView {
model: ChatProxy {
id: chatProxy
Component.onCompleted: {
loading = true
}
filterText: mainItem.searchText
onFilterTextChanged: {
chatToSelectLater = currentChatGui

View file

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