Filtering → hide accounts with no matching rooms

This commit is contained in:
miruka 2020-05-01 19:00:49 -04:00
parent 4f9e320074
commit 5b2c131fd1
2 changed files with 58 additions and 45 deletions

View File

@ -1,6 +1,5 @@
# TODO # TODO
- account context menu
- add account number binds - add account number binds
- rename goto*account → scrollto*account - rename goto*account → scrollto*account
@ -11,6 +10,7 @@
- fix escape keybinds (filter rooms, message selection) - fix escape keybinds (filter rooms, message selection)
- fix nio 429 - fix nio 429
- account delegates refactor
- lag when switching accounts - lag when switching accounts
- update glass theme - update glass theme
- improve room highlight - improve room highlight

View File

@ -29,7 +29,6 @@ HColumnLayout {
HListView { HListView {
id: accountList id: accountList
clip: true clip: true
model: ModelStore.get("accounts")
currentIndex: currentIndex:
roomList.currentIndex === -1 ? roomList.currentIndex === -1 ?
-1 : -1 :
@ -40,6 +39,63 @@ HColumnLayout {
-1, -1,
) )
model: HFilterModel {
model: ModelStore.get("accounts")
acceptItem: item =>
! roomFilter || item.id in roomList.sectionIndice
delegate: HTileDelegate {
id: tile
width: accountList.width
backgroundColor:
theme.accountsBar.accountList.account.background
topPadding: (accountList.width - avatar.width) / 4
bottomPadding: topPadding
leftPadding: 0
rightPadding: leftPadding
contentItem: Item {
implicitHeight: avatar.height
HUserAvatar {
id: avatar
anchors.horizontalCenter: parent.horizontalCenter
userId: model.id
displayName: model.display_name
mxc: model.avatar_url
// compact: tile.compact
radius:
theme.accountsBar.accountList.account.avatarRadius
}
MessageIndicator {
anchors.right: parent.right
anchors.bottom: parent.bottom
indicatorTheme:
theme.accountView.account.unreadIndicator
unreads: model.total_unread
mentions: model.total_mentions
}
}
contextMenu: AccountContextMenu { userId: model.id }
onLeftClicked: {
model.id in roomList.sectionIndice ?
roomList.goToAccount(model.id) :
pageLoader.showPage("AddChat/AddChat", {userId: model.id})
}
}
onRoomFilterChanged: refilterAll()
readonly property string roomFilter: roomList.filter
}
highlight: Item { highlight: Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
@ -56,49 +112,6 @@ HColumnLayout {
} }
} }
delegate: HTileDelegate {
id: tile
width: accountList.width
backgroundColor: theme.accountsBar.accountList.account.background
topPadding: (accountList.width - avatar.width) / 4
bottomPadding: topPadding
leftPadding: 0
rightPadding: leftPadding
contentItem: Item {
implicitHeight: avatar.height
HUserAvatar {
id: avatar
anchors.horizontalCenter: parent.horizontalCenter
userId: model.id
displayName: model.display_name
mxc: model.avatar_url
// compact: tile.compact
radius: theme.accountsBar.accountList.account.avatarRadius
}
MessageIndicator {
anchors.right: parent.right
anchors.bottom: parent.bottom
indicatorTheme: theme.accountView.account.unreadIndicator
unreads: model.total_unread
mentions: model.total_mentions
}
}
contextMenu: AccountContextMenu { userId: model.id }
onLeftClicked: {
model.id in roomList.sectionIndice ?
roomList.goToAccount(model.id) :
pageLoader.showPage("AddChat/AddChat", {userId: model.id})
}
}
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true