mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-07 14:44:01 +00:00
fix(src/components/chat/ChatProxyModel): increment properly visible messages number
This commit is contained in:
parent
0988bb934b
commit
79853f9995
3 changed files with 18 additions and 2 deletions
|
|
@ -83,6 +83,8 @@ ChatModel::ChatModel (QObject *parent) : QAbstractListModel(parent) {
|
|||
if (m_chat_room == message->getChatRoom()) {
|
||||
insertMessageAtEnd(message);
|
||||
m_chat_room->markAsRead();
|
||||
|
||||
emit messageReceived(message);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,8 @@ signals:
|
|||
void sipAddressChanged (const QString &sip_address);
|
||||
void allEntriesRemoved ();
|
||||
|
||||
void messageSent (std::shared_ptr<linphone::ChatMessage> &message);
|
||||
void messageSent (const std::shared_ptr<linphone::ChatMessage> &message);
|
||||
void messageReceived (const std::shared_ptr<linphone::ChatMessage> &message);
|
||||
|
||||
private:
|
||||
void fillMessageEntry (
|
||||
|
|
|
|||
|
|
@ -27,6 +27,20 @@ const unsigned int ChatProxyModel::ENTRIES_CHUNK_SIZE = 50;
|
|||
|
||||
ChatProxyModel::ChatProxyModel (QObject *parent) : QSortFilterProxyModel(parent) {
|
||||
setSourceModel(&m_chat_model_filter);
|
||||
|
||||
ChatModel *chat = static_cast<ChatModel *>(m_chat_model_filter.sourceModel());
|
||||
|
||||
QObject::connect(
|
||||
chat, &ChatModel::messageReceived, this, [this](const shared_ptr<linphone::ChatMessage> &) {
|
||||
m_n_max_displayed_entries++;
|
||||
}
|
||||
);
|
||||
|
||||
QObject::connect(
|
||||
chat, &ChatModel::messageSent, this, [this](const shared_ptr<linphone::ChatMessage> &) {
|
||||
m_n_max_displayed_entries++;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void ChatProxyModel::loadMoreEntries () {
|
||||
|
|
@ -42,7 +56,6 @@ void ChatProxyModel::loadMoreEntries () {
|
|||
invalidateFilter();
|
||||
|
||||
count = rowCount() - count;
|
||||
|
||||
if (count > 0)
|
||||
emit moreEntriesLoaded(count);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue