diff --git a/TODO.md b/TODO.md index 678fe180..e4d549f1 100644 --- a/TODO.md +++ b/TODO.md @@ -1,7 +1,6 @@ - Refactoring - - Repair filter members field and retest its performance - - Use HInterfaceBox for EditAccount Profile and Encryption + - Banners - Make all icon SVG files white/black, since we can now use ColorOverlay - Make the icon blue in EditAccount when hovering and no avatar set @@ -17,7 +16,6 @@ - When qml syntax highlighting supports ES6 string interpolation, use them - Fixes - - (Left?)Banner binding loop - Reloading config files (cache) - Run import in thread and AsyncClient.olm functions, they block async loop - Handle import keys errors @@ -45,6 +43,8 @@ - Which element was focused - Room member filter field + - Prevent others from having a too similar hue as us, or our own accounts + from sharing a too similar hue - Combine events so they take less space - After combining is implemented, no need to hide our own profile changes. - When starting a long task, e.g. importing keys, quitting the page, diff --git a/src/qml/Chat/RoomSidePane/MembersView.qml b/src/qml/Chat/RoomSidePane/MembersView.qml index b8119f21..ad6e71a3 100644 --- a/src/qml/Chat/RoomSidePane/MembersView.qml +++ b/src/qml/Chat/RoomSidePane/MembersView.qml @@ -7,21 +7,37 @@ HColumnLayout { HListView { id: memberList + Layout.fillWidth: true + Layout.fillHeight: true + + + readonly property var originSource: + modelSources[["Member", chatPage.roomId]] || [] + + + onOriginSourceChanged: filterLimiter.requestFire() + + + function filterSource() { + model.source = + Utils.filterModelSource(originSource, filterField.text) + } + + model: HListModel { keyField: "user_id" - source: Utils.filterModelSource( - modelSources[["Member", chatPage.roomId]] || [], - filterField.text - ) + source: originSource } delegate: MemberDelegate { width: memberList.width } - Layout.fillWidth: true - Layout.fillHeight: true - + HRateLimiter { + id: filterLimiter + cooldown: 16 + onFired: memberList.filterSource() + } } HTextField { @@ -30,6 +46,8 @@ HColumnLayout { backgroundColor: theme.sidePane.filterRooms.background bordered: false + onTextChanged: filterLimiter.requestFire() + Layout.fillWidth: true Layout.preferredHeight: theme.baseElementsHeight } diff --git a/src/qml/utils.js b/src/qml/utils.js index 385a240b..5f9c1fc4 100644 --- a/src/qml/utils.js +++ b/src/qml/utils.js @@ -97,9 +97,10 @@ function filterModelSource(source, filter_text, property="filter_string") { for (let i = 0; i < source.length; i++) { if (filterMatches(filter_text, source[i][property])) { - results.push(item) + results.push(source[i]) } } + return results }