diff --git a/TODO.md b/TODO.md index a6561c18..1a176265 100644 --- a/TODO.md +++ b/TODO.md @@ -4,7 +4,6 @@ - add account number binds - rename goto*account → scrollto*account -- fix interrupted transitions - fix back/front buttons in small window - fix message delegate too tall - fix left rooms opacity diff --git a/src/gui/Base/HListView.qml b/src/gui/Base/HListView.qml index 345969e7..c9e18a65 100644 --- a/src/gui/Base/HListView.qml +++ b/src/gui/Base/HListView.qml @@ -29,39 +29,34 @@ ListView { // property bool debug: false - // Make sure to handle when a previous transition gets interrupted + // https://doc.qt.io/qt-5/qml-qtquick-viewtransition.html + // #handling-interrupted-animations + // XXX: add transitions are buggy when using DelegateModel, `add` should be + // set to `null` and delegates should have `ListView.onAdd: ...` instead. add: Transition { - ParallelAnimation { - // ScriptAction { script: if (listView.debug) print("add") } - HNumberAnimation { property: "opacity"; from: 0; to: 1 } - HNumberAnimation { property: "scale"; from: 0; to: 1 } - } + // ScriptAction { script: if (listView.debug) print("add") } + HNumberAnimation { property: "opacity"; from: 0; to: 1 } + HNumberAnimation { property: "scale"; from: 0; to: 1 } } move: Transition { - ParallelAnimation { - // ScriptAction { script: if (listView.debug) print("move") } - HNumberAnimation { property: "opacity"; to: 1 } - HNumberAnimation { property: "scale"; to: 1 } - HNumberAnimation { properties: "x,y" } - } + // ScriptAction { script: if (listView.debug) print("move") } + HNumberAnimation { property: "opacity"; to: 1 } + HNumberAnimation { property: "scale"; to: 1 } + HNumberAnimation { properties: "x,y" } } remove: Transition { - ParallelAnimation { - // ScriptAction { script: if (listView.debug) print("remove") } - HNumberAnimation { property: "opacity"; to: 0 } - HNumberAnimation { property: "scale"; to: 0 } - } + // ScriptAction { script: if (listView.debug) print("remove") } + HNumberAnimation { property: "opacity"; to: 0 } + HNumberAnimation { property: "scale"; to: 0 } } displaced: Transition { - ParallelAnimation { - // ScriptAction { script: if (listView.debug) print("displaced") } - HNumberAnimation { property: "opacity"; to: 1 } - HNumberAnimation { property: "scale"; to: 1 } - HNumberAnimation { properties: "x,y" } - } + // ScriptAction { script: if (listView.debug) print("displaced") } + HNumberAnimation { property: "opacity"; to: 1 } + HNumberAnimation { property: "scale"; to: 1 } + HNumberAnimation { properties: "x,y" } } onSelectedCountChanged: if (! selectedCount) lastCheckedDelegateIndex = 0 diff --git a/src/gui/MainPane/RoomList.qml b/src/gui/MainPane/RoomList.qml index 3a1db850..96e5e3ae 100644 --- a/src/gui/MainPane/RoomList.qml +++ b/src/gui/MainPane/RoomList.qml @@ -7,14 +7,25 @@ import "../Base" HListView { id: roomList + add: null // See the XXX comment in HListView.qml model: HStringFilterModel { id: filterModel sourceModel: ModelStore.get("every_room") field: "display_name" + delegate: Room { + id: room width: roomList.width onActivated: showRoomAtIndex(model.index) + ListView.onAdd: ParallelAnimation { + HNumberAnimation { + target: room; property: "opacity"; from: 0; to: 1; + } + HNumberAnimation { + target: room; property: "scale"; from: 0; to: 1; + } + } } } diff --git a/src/gui/Pages/Chat/RoomPane/MemberView.qml b/src/gui/Pages/Chat/RoomPane/MemberView.qml index 3dcc5b52..c28930f8 100644 --- a/src/gui/Pages/Chat/RoomPane/MemberView.qml +++ b/src/gui/Pages/Chat/RoomPane/MemberView.qml @@ -12,12 +12,25 @@ HColumnLayout { HListView { id: memberList clip: true + add: null // See the XXX comment in HListView.qml model: HStringFilterModel { sourceModel: ModelStore.get(chat.userId, chat.roomId, "members") field: "display_name" filter: filterField.text - delegate: MemberDelegate { width: memberList.width } + + delegate: MemberDelegate { + id: member + width: memberList.width + ListView.onAdd: ParallelAnimation { + HNumberAnimation { + target: member; property: "opacity"; from: 0; to: 1; + } + HNumberAnimation { + target: member; property: "scale"; from: 0; to: 1; + } + } + } } Layout.fillWidth: true