diff --git a/linphone-app/src/components/calls/CallsListModel.cpp b/linphone-app/src/components/calls/CallsListModel.cpp index a3bc6f0f9..5c920ee5c 100644 --- a/linphone-app/src/components/calls/CallsListModel.cpp +++ b/linphone-app/src/components/calls/CallsListModel.cpp @@ -498,6 +498,7 @@ void CallsListModel::addCall (const shared_ptr &call) { beginInsertRows(QModelIndex(), row, row); mList << callModel; endInsertRows(); + emit layoutChanged(); } void CallsListModel::removeCall (const shared_ptr &call) { diff --git a/linphone-app/src/components/chat-events/ChatCallModel.cpp b/linphone-app/src/components/chat-events/ChatCallModel.cpp index 1374ec076..2c995a25a 100644 --- a/linphone-app/src/components/chat-events/ChatCallModel.cpp +++ b/linphone-app/src/components/chat-events/ChatCallModel.cpp @@ -27,7 +27,7 @@ // ============================================================================= -ChatCallModel::ChatCallModel ( std::shared_ptr callLog, const bool& isStart, QObject * parent) : QObject(parent), ChatEvent(ChatRoomModel::EntryType::CallEntry) { +ChatCallModel::ChatCallModel ( std::shared_ptr callLog, const bool& isStart, QObject * parent) : ChatEvent(ChatRoomModel::EntryType::CallEntry, parent) { App::getInstance()->getEngine()->setObjectOwnership(this, QQmlEngine::CppOwnership);// Avoid QML to destroy it when passing by Q_INVOKABLE mCallLog = callLog; if(isStart){ diff --git a/linphone-app/src/components/chat-events/ChatCallModel.hpp b/linphone-app/src/components/chat-events/ChatCallModel.hpp index 930053ffa..bf388ca59 100644 --- a/linphone-app/src/components/chat-events/ChatCallModel.hpp +++ b/linphone-app/src/components/chat-events/ChatCallModel.hpp @@ -27,7 +27,7 @@ // ============================================================================= -class ChatCallModel : public QObject, public ChatEvent { +class ChatCallModel : public ChatEvent { Q_OBJECT public: @@ -64,7 +64,6 @@ private: std::shared_ptr mCallLog; std::weak_ptr mSelf; // Used to pass to functions that need a shared_ptr }; - Q_DECLARE_METATYPE(std::shared_ptr) Q_DECLARE_METATYPE(ChatCallModel*) #endif diff --git a/linphone-app/src/components/chat-events/ChatEvent.cpp b/linphone-app/src/components/chat-events/ChatEvent.cpp index c03571fb3..2964946ab 100644 --- a/linphone-app/src/components/chat-events/ChatEvent.cpp +++ b/linphone-app/src/components/chat-events/ChatEvent.cpp @@ -26,7 +26,7 @@ // ============================================================================= -ChatEvent::ChatEvent (ChatRoomModel::EntryType type){ +ChatEvent::ChatEvent (ChatRoomModel::EntryType type, QObject * parent) : QObject(parent){ mType = type; } ChatEvent::~ChatEvent(){ diff --git a/linphone-app/src/components/chat-events/ChatEvent.hpp b/linphone-app/src/components/chat-events/ChatEvent.hpp index 50677676d..3c43b81ef 100644 --- a/linphone-app/src/components/chat-events/ChatEvent.hpp +++ b/linphone-app/src/components/chat-events/ChatEvent.hpp @@ -26,9 +26,10 @@ // ============================================================================= -class ChatEvent{ +class ChatEvent : public QObject{ +Q_OBJECT public: - ChatEvent (ChatRoomModel::EntryType type); + ChatEvent (ChatRoomModel::EntryType type, QObject * parent = nullptr); virtual ~ChatEvent(); ChatRoomModel::EntryType mType; QDateTime mTimestamp; diff --git a/linphone-app/src/components/chat-events/ChatMessageModel.cpp b/linphone-app/src/components/chat-events/ChatMessageModel.cpp index f976496f4..f8dcba304 100644 --- a/linphone-app/src/components/chat-events/ChatMessageModel.cpp +++ b/linphone-app/src/components/chat-events/ChatMessageModel.cpp @@ -294,7 +294,7 @@ QString ChatMessageModel::AppDataManager::toString(){ } return pairs.join(';'); } -ChatMessageModel::ChatMessageModel ( std::shared_ptr chatMessage, QObject * parent) : QObject(parent), ChatEvent(ChatRoomModel::EntryType::MessageEntry) { +ChatMessageModel::ChatMessageModel ( std::shared_ptr chatMessage, QObject * parent) : ChatEvent(ChatRoomModel::EntryType::MessageEntry, parent) { App::getInstance()->getEngine()->setObjectOwnership(this, QQmlEngine::CppOwnership);// Avoid QML to destroy it mParticipantImdnStateListModel = std::make_shared(chatMessage); mChatMessageListener = std::make_shared(this, parent); diff --git a/linphone-app/src/components/chat-events/ChatMessageModel.hpp b/linphone-app/src/components/chat-events/ChatMessageModel.hpp index 3db77631f..66d07056a 100644 --- a/linphone-app/src/components/chat-events/ChatMessageModel.hpp +++ b/linphone-app/src/components/chat-events/ChatMessageModel.hpp @@ -118,7 +118,7 @@ signals: void ephemeralMessageDeleted(const std::shared_ptr & message); }; -class ChatMessageModel : public QObject, public ChatEvent { +class ChatMessageModel : public ChatEvent { Q_OBJECT public: static std::shared_ptr create(std::shared_ptr chatMessage, QObject * parent = nullptr);// Call it instead constructor @@ -220,7 +220,7 @@ private: std::shared_ptr mParticipantImdnStateListModel; std::shared_ptr mChatMessageListener; }; - +Q_DECLARE_METATYPE(ChatMessageModel*) Q_DECLARE_METATYPE(std::shared_ptr) Q_DECLARE_METATYPE(ChatMessageListener*) #endif diff --git a/linphone-app/src/components/chat-events/ChatNoticeModel.cpp b/linphone-app/src/components/chat-events/ChatNoticeModel.cpp index 080929335..8894cd416 100644 --- a/linphone-app/src/components/chat-events/ChatNoticeModel.cpp +++ b/linphone-app/src/components/chat-events/ChatNoticeModel.cpp @@ -28,7 +28,7 @@ // ============================================================================= -ChatNoticeModel::ChatNoticeModel ( std::shared_ptr eventLog, QObject * parent) : QObject(parent), ChatEvent(ChatRoomModel::EntryType::NoticeEntry) { +ChatNoticeModel::ChatNoticeModel ( std::shared_ptr eventLog, QObject * parent) : ChatEvent(ChatRoomModel::EntryType::NoticeEntry, parent) { App::getInstance()->getEngine()->setObjectOwnership(this, QQmlEngine::CppOwnership);// Avoid QML to destroy it when passing by Q_INVOKABLE mEventLog = eventLog; mTimestamp = QDateTime::fromMSecsSinceEpoch(eventLog->getCreationTime() * 1000); diff --git a/linphone-app/src/components/chat-events/ChatNoticeModel.hpp b/linphone-app/src/components/chat-events/ChatNoticeModel.hpp index 286c19ccc..6fe8a4e97 100644 --- a/linphone-app/src/components/chat-events/ChatNoticeModel.hpp +++ b/linphone-app/src/components/chat-events/ChatNoticeModel.hpp @@ -27,7 +27,7 @@ // ============================================================================= -class ChatNoticeModel : public QObject, public ChatEvent { +class ChatNoticeModel : public ChatEvent { Q_OBJECT public: diff --git a/linphone-app/src/components/chat-room/ChatRoomModel.cpp b/linphone-app/src/components/chat-room/ChatRoomModel.cpp index 0f0a19df5..3531fb0ff 100644 --- a/linphone-app/src/components/chat-room/ChatRoomModel.cpp +++ b/linphone-app/src/components/chat-room/ChatRoomModel.cpp @@ -835,6 +835,7 @@ void ChatRoomModel::loadMoreEntries(){ for(auto entry : entries) mEntries.prepend(entry); endInsertRows(); + emit layoutChanged(); updateLastUpdateTime(); } } @@ -869,6 +870,7 @@ void ChatRoomModel::insertCall (const std::shared_ptr &callLo endInsertRows(); } } + emit layoutChanged(); updateLastUpdateTime(); } } @@ -894,6 +896,7 @@ void ChatRoomModel::insertCalls (const QList entries << mEntries; mEntries = entries; endInsertRows(); + emit layoutChanged(); } } } @@ -907,6 +910,7 @@ void ChatRoomModel::insertMessageAtEnd (const std::shared_ptr &eve beginInsertRows(QModelIndex(), row, row); mEntries << model; endInsertRows(); + emit layoutChanged(); } } } @@ -956,6 +962,7 @@ void ChatRoomModel::insertNotices (const QListclone()); endInsertRows(); + emit layoutChanged(); mConferenceHelperModel->invalidate(); @@ -105,6 +106,7 @@ bool ConferenceHelperModel::ConferenceAddModel::addToConference (const QString & addToConferencePrivate(address); endInsertRows(); + emit layoutChanged(); mConferenceHelperModel->invalidate(); diff --git a/linphone-app/src/components/contacts/ContactsImporterListModel.cpp b/linphone-app/src/components/contacts/ContactsImporterListModel.cpp index aff335950..9b3d9206c 100644 --- a/linphone-app/src/components/contacts/ContactsImporterListModel.cpp +++ b/linphone-app/src/components/contacts/ContactsImporterListModel.cpp @@ -152,6 +152,7 @@ ContactsImporterModel *ContactsImporterListModel::createContactsImporter(QVarian beginInsertRows(QModelIndex(), row, row); addContactsImporter(contactsImporter); endInsertRows(); + emit layoutChanged(); emit contactsImporterAdded(contactsImporter); } diff --git a/linphone-app/src/components/contacts/ContactsListModel.cpp b/linphone-app/src/components/contacts/ContactsListModel.cpp index 751f15a4e..a456d15d1 100644 --- a/linphone-app/src/components/contacts/ContactsListModel.cpp +++ b/linphone-app/src/components/contacts/ContactsListModel.cpp @@ -162,6 +162,7 @@ ContactModel *ContactsListModel::addContact (VcardModel *vcardModel) { beginInsertRows(QModelIndex(), row, row); addContact(contact); endInsertRows(); + emit layoutChanged(); emit contactAdded(contact); diff --git a/linphone-app/src/components/history/HistoryModel.cpp b/linphone-app/src/components/history/HistoryModel.cpp index 6c341f7cb..182a3b4a4 100644 --- a/linphone-app/src/components/history/HistoryModel.cpp +++ b/linphone-app/src/components/history/HistoryModel.cpp @@ -225,6 +225,7 @@ void HistoryModel::insertCall (const shared_ptr &callLog) { beginInsertRows(QModelIndex(), row, row); it = mEntries.insert(it, entry); endInsertRows(); + emit layoutChanged(); return it; }; diff --git a/linphone-app/src/components/ldap/LdapListModel.cpp b/linphone-app/src/components/ldap/LdapListModel.cpp index 9e7bac551..144dc6cc2 100644 --- a/linphone-app/src/components/ldap/LdapListModel.cpp +++ b/linphone-app/src/components/ldap/LdapListModel.cpp @@ -126,7 +126,7 @@ void LdapListModel::add(){ ldap->init(); mServers << ldap; endInsertRows(); - resetInternalData(); + emit layoutChanged(); } void LdapListModel::remove (LdapModel *ldap) { diff --git a/linphone-app/src/components/other/colors/ColorListModel.cpp b/linphone-app/src/components/other/colors/ColorListModel.cpp index dd0cebc3b..6921cf57b 100644 --- a/linphone-app/src/components/other/colors/ColorListModel.cpp +++ b/linphone-app/src/components/other/colors/ColorListModel.cpp @@ -76,7 +76,7 @@ void ColorListModel::add(std::shared_ptr color){ mList << color; endInsertRows(); - resetInternalData(); + emit layoutChanged(); } bool ColorListModel::removeRow (int row, const QModelIndex &parent){ diff --git a/linphone-app/src/components/other/images/ImageListModel.cpp b/linphone-app/src/components/other/images/ImageListModel.cpp index 1b79b4bba..a396fe34f 100644 --- a/linphone-app/src/components/other/images/ImageListModel.cpp +++ b/linphone-app/src/components/other/images/ImageListModel.cpp @@ -84,7 +84,7 @@ void ImageListModel::add(std::shared_ptr image){ mList << image; endInsertRows(); - resetInternalData(); + emit layoutChanged(); } bool ImageListModel::removeRow (int row, const QModelIndex &parent){ diff --git a/linphone-app/src/components/participant-imdn/ParticipantImdnStateListModel.cpp b/linphone-app/src/components/participant-imdn/ParticipantImdnStateListModel.cpp index 60c574835..0283f9e01 100644 --- a/linphone-app/src/components/participant-imdn/ParticipantImdnStateListModel.cpp +++ b/linphone-app/src/components/participant-imdn/ParticipantImdnStateListModel.cpp @@ -77,7 +77,7 @@ void ParticipantImdnStateListModel::add(std::shared_ptr participant){ beginInsertRows(QModelIndex(), row, row); mParticipants << participant; endInsertRows(); + emit layoutChanged(); emit participantsChanged(); emit countChanged(); } diff --git a/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp b/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp index 08104dacb..7c4186553 100644 --- a/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp +++ b/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp @@ -529,6 +529,7 @@ void SipAddressesModel::addOrUpdateSipAddress (const QString &sipAddress, T data mRefs << &mPeerAddressToSipAddressEntry[sipAddress]; endInsertRows(); + emit layoutChanged(); } // ----------------------------------------------------------------------------- diff --git a/linphone-app/src/components/timeline/TimelineListModel.cpp b/linphone-app/src/components/timeline/TimelineListModel.cpp index 3e3f8d8b8..0edfc3dab 100644 --- a/linphone-app/src/components/timeline/TimelineListModel.cpp +++ b/linphone-app/src/components/timeline/TimelineListModel.cpp @@ -288,7 +288,7 @@ void TimelineListModel::add (std::shared_ptr timeline){ beginInsertRows(QModelIndex(), row, row); mTimelines << timeline; endInsertRows(); - resetInternalData(); + emit layoutChanged(); emit countChanged(); }