Fix member filtering

This commit is contained in:
miruka 2019-08-21 12:17:12 -04:00
parent 8ef3a6dc33
commit 1886303481
3 changed files with 30 additions and 11 deletions

View File

@ -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,

View File

@ -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
}

View File

@ -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
}