Fix section layout issues and pagination issues

Pagination could get stuck, if the messages request failed.
Section height seemes to have been calculated to late, which would make
some section overlap the next message in some cases. Fix that by doing
the height calculation manually.
This commit is contained in:
Nicolas Werner 2019-10-13 15:10:33 +02:00
parent 0fd2199112
commit a83ae7e95f
3 changed files with 4 additions and 6 deletions

View file

@ -68,7 +68,7 @@ Rectangle {
model.currentIndex = newIndex model.currentIndex = newIndex
} }
if (contentHeight < height) { if (contentHeight < height && model) {
model.fetchHistory(); model.fetchHistory();
} }
} }
@ -143,8 +143,7 @@ Rectangle {
spacing: 8 spacing: 8
width: parent.width width: parent.width
height: (section.includes(" ") ? dateBubble.height + 8 + userName.height : userName.height) + 8
Component.onCompleted: chat.forceLayout()
Label { Label {
id: dateBubble id: dateBubble

View file

@ -41,7 +41,6 @@ ImageOverlay::ImageOverlay(QPixmap image, QWidget *parent)
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
setWindowState(Qt::WindowFullScreen); setWindowState(Qt::WindowFullScreen);
// Deprecated in 5.13: screen_ = QApplication::desktop()->availableGeometry();
screen_ = QGuiApplication::primaryScreen()->availableGeometry(); screen_ = QGuiApplication::primaryScreen()->availableGeometry();
move(QApplication::desktop()->mapToGlobal(screen_.topLeft())); move(QApplication::desktop()->mapToGlobal(screen_.topLeft()));

View file

@ -618,10 +618,12 @@ TimelineModel::fetchHistory()
opts.room_id, opts.room_id,
mtx::errors::to_string(err->matrix_error.errcode), mtx::errors::to_string(err->matrix_error.errcode),
err->matrix_error.error); err->matrix_error.error);
paginationInProgress = false;
return; return;
} }
emit oldMessagesRetrieved(std::move(res)); emit oldMessagesRetrieved(std::move(res));
paginationInProgress = false;
}); });
} }
@ -658,8 +660,6 @@ TimelineModel::addBackwardsEvents(const mtx::responses::Messages &msgs)
} }
prev_batch_token_ = QString::fromStdString(msgs.end); prev_batch_token_ = QString::fromStdString(msgs.end);
paginationInProgress = false;
} }
QColor QColor