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

View File

@ -29,7 +29,6 @@ HColumnLayout {
HListView {
id: accountList
clip: true
model: ModelStore.get("accounts")
currentIndex:
roomList.currentIndex === -1 ?
-1 :
@ -40,26 +39,16 @@ HColumnLayout {
-1,
)
highlight: Item {
Rectangle {
anchors.fill: parent
color: theme.accountsBar.accountList.account.selectedBackground
opacity: theme.accountsBar.accountList.account
.selectedBackgroundOpacity
}
Rectangle {
z: 100
width: theme.accountsBar.accountList.account.selectedBorderSize
height: parent.height
color: theme.accountsBar.accountList.account.selectedBorder
}
}
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
backgroundColor:
theme.accountsBar.accountList.account.background
topPadding: (accountList.width - avatar.width) / 4
bottomPadding: topPadding
@ -77,14 +66,16 @@ HColumnLayout {
mxc: model.avatar_url
// compact: tile.compact
radius: theme.accountsBar.accountList.account.avatarRadius
radius:
theme.accountsBar.accountList.account.avatarRadius
}
MessageIndicator {
anchors.right: parent.right
anchors.bottom: parent.bottom
indicatorTheme: theme.accountView.account.unreadIndicator
indicatorTheme:
theme.accountView.account.unreadIndicator
unreads: model.total_unread
mentions: model.total_mentions
}
@ -99,6 +90,28 @@ HColumnLayout {
}
}
onRoomFilterChanged: refilterAll()
readonly property string roomFilter: roomList.filter
}
highlight: Item {
Rectangle {
anchors.fill: parent
color: theme.accountsBar.accountList.account.selectedBackground
opacity: theme.accountsBar.accountList.account
.selectedBackgroundOpacity
}
Rectangle {
z: 100
width: theme.accountsBar.accountList.account.selectedBorderSize
height: parent.height
color: theme.accountsBar.accountList.account.selectedBorder
}
}
Layout.fillWidth: true
Layout.fillHeight: true