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,26 +39,16 @@ HColumnLayout {
-1, -1,
) )
highlight: Item { model: HFilterModel {
Rectangle { model: ModelStore.get("accounts")
anchors.fill: parent acceptItem: item =>
color: theme.accountsBar.accountList.account.selectedBackground ! roomFilter || item.id in roomList.sectionIndice
opacity: theme.accountsBar.accountList.account
.selectedBackgroundOpacity
}
Rectangle {
z: 100
width: theme.accountsBar.accountList.account.selectedBorderSize
height: parent.height
color: theme.accountsBar.accountList.account.selectedBorder
}
}
delegate: HTileDelegate { delegate: HTileDelegate {
id: tile id: tile
width: accountList.width width: accountList.width
backgroundColor: theme.accountsBar.accountList.account.background backgroundColor:
theme.accountsBar.accountList.account.background
topPadding: (accountList.width - avatar.width) / 4 topPadding: (accountList.width - avatar.width) / 4
bottomPadding: topPadding bottomPadding: topPadding
@ -77,14 +66,16 @@ HColumnLayout {
mxc: model.avatar_url mxc: model.avatar_url
// compact: tile.compact // compact: tile.compact
radius: theme.accountsBar.accountList.account.avatarRadius radius:
theme.accountsBar.accountList.account.avatarRadius
} }
MessageIndicator { MessageIndicator {
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
indicatorTheme: theme.accountView.account.unreadIndicator indicatorTheme:
theme.accountView.account.unreadIndicator
unreads: model.total_unread unreads: model.total_unread
mentions: model.total_mentions 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.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true