From a83ae7e95fcb21f0f61cdb7d8cf9e4c4985bd853 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 13 Oct 2019 15:10:33 +0200 Subject: [PATCH] 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. --- resources/qml/TimelineView.qml | 5 ++--- src/dialogs/ImageOverlay.cpp | 1 - src/timeline2/TimelineModel.cpp | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index ef1db0f0..b0a8853e 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -68,7 +68,7 @@ Rectangle { model.currentIndex = newIndex } - if (contentHeight < height) { + if (contentHeight < height && model) { model.fetchHistory(); } } @@ -143,8 +143,7 @@ Rectangle { spacing: 8 width: parent.width - - Component.onCompleted: chat.forceLayout() + height: (section.includes(" ") ? dateBubble.height + 8 + userName.height : userName.height) + 8 Label { id: dateBubble diff --git a/src/dialogs/ImageOverlay.cpp b/src/dialogs/ImageOverlay.cpp index dd9cd03a..cbdd351c 100644 --- a/src/dialogs/ImageOverlay.cpp +++ b/src/dialogs/ImageOverlay.cpp @@ -41,7 +41,6 @@ ImageOverlay::ImageOverlay(QPixmap image, QWidget *parent) setAttribute(Qt::WA_DeleteOnClose, true); setWindowState(Qt::WindowFullScreen); - // Deprecated in 5.13: screen_ = QApplication::desktop()->availableGeometry(); screen_ = QGuiApplication::primaryScreen()->availableGeometry(); move(QApplication::desktop()->mapToGlobal(screen_.topLeft())); diff --git a/src/timeline2/TimelineModel.cpp b/src/timeline2/TimelineModel.cpp index 27bd09b6..b37ade54 100644 --- a/src/timeline2/TimelineModel.cpp +++ b/src/timeline2/TimelineModel.cpp @@ -618,10 +618,12 @@ TimelineModel::fetchHistory() opts.room_id, mtx::errors::to_string(err->matrix_error.errcode), err->matrix_error.error); + paginationInProgress = false; return; } 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); - - paginationInProgress = false; } QColor