Fix member filtering
This commit is contained in:
parent
8ef3a6dc33
commit
1886303481
6
TODO.md
6
TODO.md
|
@ -1,7 +1,6 @@
|
||||||
- Refactoring
|
- Refactoring
|
||||||
- Repair filter members field and retest its performance
|
|
||||||
|
|
||||||
- Use HInterfaceBox for EditAccount Profile and Encryption
|
- Use HInterfaceBox for EditAccount Profile and Encryption
|
||||||
|
- Banners
|
||||||
|
|
||||||
- Make all icon SVG files white/black, since we can now use ColorOverlay
|
- 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
|
- 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
|
- When qml syntax highlighting supports ES6 string interpolation, use them
|
||||||
|
|
||||||
- Fixes
|
- Fixes
|
||||||
- (Left?)Banner binding loop
|
|
||||||
- Reloading config files (cache)
|
- Reloading config files (cache)
|
||||||
- Run import in thread and AsyncClient.olm functions, they block async loop
|
- Run import in thread and AsyncClient.olm functions, they block async loop
|
||||||
- Handle import keys errors
|
- Handle import keys errors
|
||||||
|
@ -45,6 +43,8 @@
|
||||||
- Which element was focused
|
- Which element was focused
|
||||||
- Room member filter field
|
- 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
|
- Combine events so they take less space
|
||||||
- After combining is implemented, no need to hide our own profile changes.
|
- After combining is implemented, no need to hide our own profile changes.
|
||||||
- When starting a long task, e.g. importing keys, quitting the page,
|
- When starting a long task, e.g. importing keys, quitting the page,
|
||||||
|
|
|
@ -7,21 +7,37 @@ HColumnLayout {
|
||||||
HListView {
|
HListView {
|
||||||
id: memberList
|
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 {
|
model: HListModel {
|
||||||
keyField: "user_id"
|
keyField: "user_id"
|
||||||
source: Utils.filterModelSource(
|
source: originSource
|
||||||
modelSources[["Member", chatPage.roomId]] || [],
|
|
||||||
filterField.text
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: MemberDelegate {
|
delegate: MemberDelegate {
|
||||||
width: memberList.width
|
width: memberList.width
|
||||||
}
|
}
|
||||||
|
|
||||||
Layout.fillWidth: true
|
HRateLimiter {
|
||||||
Layout.fillHeight: true
|
id: filterLimiter
|
||||||
|
cooldown: 16
|
||||||
|
onFired: memberList.filterSource()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HTextField {
|
HTextField {
|
||||||
|
@ -30,6 +46,8 @@ HColumnLayout {
|
||||||
backgroundColor: theme.sidePane.filterRooms.background
|
backgroundColor: theme.sidePane.filterRooms.background
|
||||||
bordered: false
|
bordered: false
|
||||||
|
|
||||||
|
onTextChanged: filterLimiter.requestFire()
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: theme.baseElementsHeight
|
Layout.preferredHeight: theme.baseElementsHeight
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,9 +97,10 @@ function filterModelSource(source, filter_text, property="filter_string") {
|
||||||
|
|
||||||
for (let i = 0; i < source.length; i++) {
|
for (let i = 0; i < source.length; i++) {
|
||||||
if (filterMatches(filter_text, source[i][property])) {
|
if (filterMatches(filter_text, source[i][property])) {
|
||||||
results.push(item)
|
results.push(source[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return results
|
return results
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user