Merge pull request #184 from shocklateboy92/features/backlog-progress
Add visual indication that data is being fetched
This commit is contained in:
commit
38417a374d
3 changed files with 33 additions and 8 deletions
|
|
@ -429,15 +429,26 @@ TimelineModel::canFetchMore(const QModelIndex &) const
|
|||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
TimelineModel::setPaginationInProgress(const bool paginationInProgress)
|
||||
{
|
||||
if (m_paginationInProgress == paginationInProgress) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_paginationInProgress = paginationInProgress;
|
||||
emit paginationInProgressChanged(m_paginationInProgress);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineModel::fetchMore(const QModelIndex &)
|
||||
{
|
||||
if (paginationInProgress) {
|
||||
if (m_paginationInProgress) {
|
||||
nhlog::ui()->warn("Already loading older messages");
|
||||
return;
|
||||
}
|
||||
|
||||
paginationInProgress = true;
|
||||
setPaginationInProgress(true);
|
||||
mtx::http::MessagesOpts opts;
|
||||
opts.room_id = room_id_.toStdString();
|
||||
opts.from = prev_batch_token_.toStdString();
|
||||
|
|
@ -452,12 +463,13 @@ TimelineModel::fetchMore(const QModelIndex &)
|
|||
mtx::errors::to_string(err->matrix_error.errcode),
|
||||
err->matrix_error.error,
|
||||
err->parse_error);
|
||||
paginationInProgress = false;
|
||||
emit oldMessagesRetrieved(std::move(res));
|
||||
setPaginationInProgress(false);
|
||||
return;
|
||||
}
|
||||
|
||||
emit oldMessagesRetrieved(std::move(res));
|
||||
paginationInProgress = false;
|
||||
setPaginationInProgress(false);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue