fix chat transfer #LINQT-2246
This commit is contained in:
parent
f173a887cd
commit
fc42ada7ba
6 changed files with 16 additions and 6 deletions
|
|
@ -635,6 +635,9 @@ void App::initCore() {
|
||||||
});
|
});
|
||||||
if (!mCallList) setCallList(CallList::create());
|
if (!mCallList) setCallList(CallList::create());
|
||||||
else mCallList->lUpdate();
|
else mCallList->lUpdate();
|
||||||
|
if (!mChatList) setChatList(ChatList::create());
|
||||||
|
else mChatList->lUpdate();
|
||||||
|
|
||||||
if (!mSettings) {
|
if (!mSettings) {
|
||||||
mSettings = settings;
|
mSettings = settings;
|
||||||
setLocale(settings->getConfigLocale());
|
setLocale(settings->getConfigLocale());
|
||||||
|
|
@ -1204,6 +1207,10 @@ QSharedPointer<ChatList> App::getChatList() const {
|
||||||
return mChatList;
|
return mChatList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChatList *App::getChats() const {
|
||||||
|
return mChatList.get();
|
||||||
|
}
|
||||||
|
|
||||||
void App::setChatList(QSharedPointer<ChatList> data) {
|
void App::setChatList(QSharedPointer<ChatList> data) {
|
||||||
if (mChatList != data) {
|
if (mChatList != data) {
|
||||||
mChatList = data;
|
mChatList = data;
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ class App : public SingleApplication, public AbstractObject {
|
||||||
Q_PROPERTY(bool coreStarted READ getCoreStarted WRITE setCoreStarted NOTIFY coreStartedChanged)
|
Q_PROPERTY(bool coreStarted READ getCoreStarted WRITE setCoreStarted NOTIFY coreStartedChanged)
|
||||||
Q_PROPERTY(AccountList *accounts READ getAccounts NOTIFY accountsChanged)
|
Q_PROPERTY(AccountList *accounts READ getAccounts NOTIFY accountsChanged)
|
||||||
Q_PROPERTY(CallList *calls READ getCalls NOTIFY callsChanged)
|
Q_PROPERTY(CallList *calls READ getCalls NOTIFY callsChanged)
|
||||||
|
Q_PROPERTY(ChatList *chats READ getChats NOTIFY chatsChanged)
|
||||||
Q_PROPERTY(QString shortApplicationVersion READ getShortApplicationVersion CONSTANT)
|
Q_PROPERTY(QString shortApplicationVersion READ getShortApplicationVersion CONSTANT)
|
||||||
Q_PROPERTY(QString qtVersion READ getQtVersion CONSTANT)
|
Q_PROPERTY(QString qtVersion READ getQtVersion CONSTANT)
|
||||||
Q_PROPERTY(QString gitBranchName READ getGitBranchName CONSTANT)
|
Q_PROPERTY(QString gitBranchName READ getGitBranchName CONSTANT)
|
||||||
|
|
@ -160,6 +161,7 @@ public:
|
||||||
void setConferenceInfoList(QSharedPointer<ConferenceInfoList> data);
|
void setConferenceInfoList(QSharedPointer<ConferenceInfoList> data);
|
||||||
|
|
||||||
QSharedPointer<ChatList> getChatList() const;
|
QSharedPointer<ChatList> getChatList() const;
|
||||||
|
ChatList *getChats() const;
|
||||||
void setChatList(QSharedPointer<ChatList> data);
|
void setChatList(QSharedPointer<ChatList> data);
|
||||||
|
|
||||||
QSharedPointer<CallList> getCallList() const;
|
QSharedPointer<CallList> getCallList() const;
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,7 @@
|
||||||
DEFINE_ABSTRACT_OBJECT(ChatProxy)
|
DEFINE_ABSTRACT_OBJECT(ChatProxy)
|
||||||
|
|
||||||
ChatProxy::ChatProxy(QObject *parent) {
|
ChatProxy::ChatProxy(QObject *parent) {
|
||||||
if (!App::getInstance()->getChatList()) {
|
mList = ChatList::create();
|
||||||
mList = ChatList::create();
|
|
||||||
App::getInstance()->setChatList(mList);
|
|
||||||
}
|
|
||||||
mList = App::getInstance()->getChatList();
|
|
||||||
setSourceModel(mList.get());
|
setSourceModel(mList.get());
|
||||||
setDynamicSortFilter(true);
|
setDynamicSortFilter(true);
|
||||||
}
|
}
|
||||||
|
|
@ -51,6 +47,8 @@ void ChatProxy::setSourceModel(QAbstractItemModel *model) {
|
||||||
[this, newChatList] { emit newChatList->filterChanged(getFilterText()); });
|
[this, newChatList] { emit newChatList->filterChanged(getFilterText()); });
|
||||||
connect(newChatList, &ChatList::chatAdded, this, [this] { invalidate(); });
|
connect(newChatList, &ChatList::chatAdded, this, [this] { invalidate(); });
|
||||||
connect(newChatList, &ChatList::dataChanged, this, [this] { invalidate(); });
|
connect(newChatList, &ChatList::dataChanged, this, [this] { invalidate(); });
|
||||||
|
connect(newChatList, &ChatList::modelAboutToBeReset, this, &ChatProxy::modelAboutToBeReset);
|
||||||
|
connect(newChatList, &ChatList::modelReset, this, &ChatProxy::modelReset);
|
||||||
}
|
}
|
||||||
QSortFilterProxyModel::setSourceModel(newChatList);
|
QSortFilterProxyModel::setSourceModel(newChatList);
|
||||||
sort(0);
|
sort(0);
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
class ChatProxy : public SortFilterProxy, public AbstractObject {
|
class ChatProxy : public SortFilterProxy, public AbstractObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(QAbstractItemModel *model WRITE setSourceModel )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ChatProxy(QObject *parent = Q_NULLPTR);
|
ChatProxy(QObject *parent = Q_NULLPTR);
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ ListView {
|
||||||
property SearchBar searchBar
|
property SearchBar searchBar
|
||||||
property bool loading: false
|
property bool loading: false
|
||||||
property string searchText: searchBar?.text
|
property string searchText: searchBar?.text
|
||||||
|
property alias chatProxy: chatProxy
|
||||||
property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60)
|
property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60)
|
||||||
|
|
||||||
property ChatGui currentChatGui: model.getAt(currentIndex) || null
|
property ChatGui currentChatGui: model.getAt(currentIndex) || null
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ AbstractMainPage {
|
||||||
if (selectedChatGui) {
|
if (selectedChatGui) {
|
||||||
if (!listStackView.currentItem || listStackView.currentItem.objectName !== "chatListItem") {
|
if (!listStackView.currentItem || listStackView.currentItem.objectName !== "chatListItem") {
|
||||||
listStackView.popToIndex(0)
|
listStackView.popToIndex(0)
|
||||||
if (listStackView.depth === 0 || listStackView.currentItem.objectName !== "chatListItem") listStackView.push(chatListItem)
|
if (listStackView.depth === 0 || listStackView.currentItem && listStackView.currentItem.objectName !== "chatListItem") listStackView.push(chatListItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AppCpp.currentChat = visible ? selectedChatGui : null
|
AppCpp.currentChat = visible ? selectedChatGui : null
|
||||||
|
|
@ -214,6 +214,7 @@ AbstractMainPage {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.topMargin: Utils.getSizeWithScreenRatio(39)
|
Layout.topMargin: Utils.getSizeWithScreenRatio(39)
|
||||||
searchBar: searchBar
|
searchBar: searchBar
|
||||||
|
chatProxy.sourceModel: AppCpp.chats
|
||||||
Control.ScrollBar.vertical: scrollbar
|
Control.ScrollBar.vertical: scrollbar
|
||||||
|
|
||||||
onCurrentChatGuiChanged: {
|
onCurrentChatGuiChanged: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue