put confinfo list in app so it is intanciated only once
chat list in app to load it once
This commit is contained in:
parent
a562b0f1c8
commit
f53b992704
7 changed files with 44 additions and 9 deletions
|
|
@ -1190,6 +1190,27 @@ AccountList *App::getAccounts() const {
|
||||||
return mAccountList.get();
|
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 {
|
QSharedPointer<CallList> App::getCallList() const {
|
||||||
return mCallList;
|
return mCallList;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@
|
||||||
#include "core/account/AccountProxy.hpp"
|
#include "core/account/AccountProxy.hpp"
|
||||||
#include "core/call/CallProxy.hpp"
|
#include "core/call/CallProxy.hpp"
|
||||||
#include "core/chat/ChatGui.hpp"
|
#include "core/chat/ChatGui.hpp"
|
||||||
|
#include "core/chat/ChatList.hpp"
|
||||||
|
#include "core/conference/ConferenceInfoList.hpp"
|
||||||
#include "core/setting/SettingsCore.hpp"
|
#include "core/setting/SettingsCore.hpp"
|
||||||
#include "core/singleapplication/singleapplication.h"
|
#include "core/singleapplication/singleapplication.h"
|
||||||
#include "model/cli/CliModel.hpp"
|
#include "model/cli/CliModel.hpp"
|
||||||
|
|
@ -154,6 +156,12 @@ public:
|
||||||
void setAccountList(QSharedPointer<AccountList> data);
|
void setAccountList(QSharedPointer<AccountList> data);
|
||||||
Q_INVOKABLE AccountList *getAccounts() const;
|
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;
|
QSharedPointer<CallList> getCallList() const;
|
||||||
void setCallList(QSharedPointer<CallList> data);
|
void setCallList(QSharedPointer<CallList> data);
|
||||||
Q_INVOKABLE CallList *getCalls() const;
|
Q_INVOKABLE CallList *getCalls() const;
|
||||||
|
|
@ -198,6 +206,8 @@ signals:
|
||||||
void callsChanged();
|
void callsChanged();
|
||||||
void currentDateChanged();
|
void currentDateChanged();
|
||||||
void currentChatChanged();
|
void currentChatChanged();
|
||||||
|
void conferenceInfosChanged();
|
||||||
|
void chatsChanged();
|
||||||
// void executeCommand(QString command);
|
// void executeCommand(QString command);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -220,6 +230,8 @@ private:
|
||||||
ChatGui *mCurrentChat = nullptr;
|
ChatGui *mCurrentChat = nullptr;
|
||||||
QSharedPointer<SettingsCore> mSettings;
|
QSharedPointer<SettingsCore> mSettings;
|
||||||
QSharedPointer<AccountList> mAccountList;
|
QSharedPointer<AccountList> mAccountList;
|
||||||
|
QSharedPointer<ConferenceInfoList> mConferenceInfoList;
|
||||||
|
QSharedPointer<ChatList> mChatList;
|
||||||
QSharedPointer<CallList> mCallList;
|
QSharedPointer<CallList> mCallList;
|
||||||
QSharedPointer<SafeConnection<App, CoreModel>> mCoreModelConnection;
|
QSharedPointer<SafeConnection<App, CoreModel>> mCoreModelConnection;
|
||||||
QSharedPointer<SafeConnection<App, CliModel>> mCliModelConnection;
|
QSharedPointer<SafeConnection<App, CliModel>> mCliModelConnection;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,11 @@
|
||||||
DEFINE_ABSTRACT_OBJECT(ChatProxy)
|
DEFINE_ABSTRACT_OBJECT(ChatProxy)
|
||||||
|
|
||||||
ChatProxy::ChatProxy(QObject *parent) {
|
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());
|
setSourceModel(mList.get());
|
||||||
setDynamicSortFilter(true);
|
setDynamicSortFilter(true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,11 @@
|
||||||
DEFINE_ABSTRACT_OBJECT(ConferenceInfoProxy)
|
DEFINE_ABSTRACT_OBJECT(ConferenceInfoProxy)
|
||||||
|
|
||||||
ConferenceInfoProxy::ConferenceInfoProxy(QObject *parent) : LimitProxy(parent) {
|
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));
|
setSourceModels(new SortFilterList(mList.get(), Qt::AscendingOrder));
|
||||||
connect(
|
connect(
|
||||||
mList.get(), &ConferenceInfoList::haveCurrentDateChanged, this,
|
mList.get(), &ConferenceInfoList::haveCurrentDateChanged, this,
|
||||||
|
|
|
||||||
|
|
@ -358,7 +358,7 @@ void Notifier::notifyReceivedMessages(const std::shared_ptr<linphone::ChatRoom>
|
||||||
if (content->isText()) txt += content->getUtf8Text().c_str();
|
if (content->isText()) txt += content->getUtf8Text().c_str();
|
||||||
}
|
}
|
||||||
} else if (fileContent->isVoiceRecording())
|
} 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");
|
txt = tr("new_voice_message");
|
||||||
else txt = tr("new_file_message");
|
else txt = tr("new_file_message");
|
||||||
if (txt.isEmpty() && message->hasConferenceInvitationContent())
|
if (txt.isEmpty() && message->hasConferenceInvitationContent())
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,6 @@ ListView {
|
||||||
|
|
||||||
model: ChatProxy {
|
model: ChatProxy {
|
||||||
id: chatProxy
|
id: chatProxy
|
||||||
Component.onCompleted: {
|
|
||||||
loading = true
|
|
||||||
}
|
|
||||||
filterText: mainItem.searchText
|
filterText: mainItem.searchText
|
||||||
onFilterTextChanged: {
|
onFilterTextChanged: {
|
||||||
chatToSelectLater = currentChatGui
|
chatToSelectLater = currentChatGui
|
||||||
|
|
|
||||||
|
|
@ -101,9 +101,6 @@ ListView {
|
||||||
filterType: ConferenceInfoProxy.None
|
filterType: ConferenceInfoProxy.None
|
||||||
initialDisplayItems: Math.max(20, Math.round(2 * mainItem.height / Utils.getSizeWithScreenRatio(63)))
|
initialDisplayItems: Math.max(20, Math.round(2 * mainItem.height / Utils.getSizeWithScreenRatio(63)))
|
||||||
displayItemsStep: initialDisplayItems/2
|
displayItemsStep: initialDisplayItems/2
|
||||||
Component.onCompleted: {
|
|
||||||
mainItem.loading = false
|
|
||||||
}
|
|
||||||
onModelAboutToBeReset: {
|
onModelAboutToBeReset: {
|
||||||
mainItem.loading = true
|
mainItem.loading = true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue