diff --git a/include/libqmatrixclient b/include/libqmatrixclient index 9fb5fd1..f5651c7 160000 --- a/include/libqmatrixclient +++ b/include/libqmatrixclient @@ -1 +1 @@ -Subproject commit 9fb5fd1181fc74a040630df333a20ddd29cd7b28 +Subproject commit f5651c74ddddd8c66b3b42b471fbe2ff278c0d9a diff --git a/qml/component/MessageDelegate.qml b/qml/component/MessageDelegate.qml index 8237e3f..ecb10cc 100644 --- a/qml/component/MessageDelegate.qml +++ b/qml/component/MessageDelegate.qml @@ -77,8 +77,7 @@ RowLayout { visible: isText color: highlighted ? "white": Material.foreground - font.family: "Noto Sans" - font.pointSize: 10 + font: Qt.font({pointSize: 10}) selectByMouse: true readOnly: true wrapMode: Label.Wrap diff --git a/qml/form/RoomForm.qml b/qml/form/RoomForm.qml index 2a9a319..c2cb93a 100644 --- a/qml/form/RoomForm.qml +++ b/qml/form/RoomForm.qml @@ -19,23 +19,6 @@ Item { MessageEventModel { id: messageEventModel room: currentRoom - - onModelReset: { - if (currentRoom) - { - var lastScrollPosition = currentRoom.savedTopVisibleIndex() - if (lastScrollPosition === 0) - messageListView.positionViewAtBeginning() - else - { - console.log("Scrolling to position", lastScrollPosition) - messageListView.positionViewAtIndex(lastScrollPosition, ListView.Contain) - } - if (messageListView.contentY < messageListView.originY + 10) - currentRoom.getPreviousContent(100) - } - console.log("Model timeline reset") - } } RoomDrawer { @@ -128,6 +111,7 @@ Item { displayMarginEnd: 40 verticalLayoutDirection: ListView.BottomToTop spacing: 8 + cacheBuffer: 200 flickDeceleration: 4096 @@ -138,7 +122,7 @@ Item { onContentYChanged: { // Check whether we're about to bump into the ceiling in 2 seconds var curVelocity = verticalVelocity // Snapshot the current speed - if( curVelocity < 0 && contentY + curVelocity*2 < originY) + if(curVelocity < 0 && contentY + curVelocity*2 < originY) { // Request the amount of messages enough to scroll at this // rate for 3 more seconds @@ -147,16 +131,38 @@ Item { } } - onMovementEnded: currentRoom.saveViewport(indexAt(contentX, contentY), largestVisibleIndex) + onMovementEnded: currentRoom.saveViewport(sortedMessageEventModel.mapToSource(indexAt(contentX, contentY)), sortedMessageEventModel.mapToSource(largestVisibleIndex)) + + displaced: Transition { NumberAnimation { + property: "y"; duration: 200 + easing.type: Easing.OutQuad + }} model: SortFilterProxyModel { - id: sortedRoomListModel + id: sortedMessageEventModel sourceModel: messageEventModel filters: ExpressionFilter { expression: marks !== 0x08 && marks !== 0x10 } + + onModelReset: { + if (currentRoom) + { + var lastScrollPosition = mapFromSource(currentRoom.savedTopVisibleIndex()) + if (lastScrollPosition === 0) + messageListView.positionViewAtBeginning() + else + { + console.log("Scrolling to position", lastScrollPosition) + messageListView.currentIndex = lastScrollPosition + } + if (messageListView.contentY < messageListView.originY + 10) + currentRoom.getPreviousContent(100) + } + console.log("Model timeline reset") + } } delegate: ColumnLayout {