2020-04-26 14:20:45 -04:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
import ".."
|
|
|
|
import "../Base"
|
|
|
|
import "../Base/HTile"
|
|
|
|
|
|
|
|
|
2020-05-13 07:37:39 -04:00
|
|
|
Rectangle {
|
|
|
|
implicitHeight: accountList.count >= 2 ? accountList.contentHeight : 0
|
2020-05-13 08:24:53 -04:00
|
|
|
color: theme.mainPane.accountBar.background
|
2020-04-26 14:20:45 -04:00
|
|
|
|
|
|
|
|
2020-05-13 07:37:39 -04:00
|
|
|
property RoomList roomList
|
|
|
|
readonly property alias accountList: accountList
|
2020-04-28 16:18:18 -04:00
|
|
|
|
2020-04-26 14:20:45 -04:00
|
|
|
|
2020-05-13 07:37:39 -04:00
|
|
|
Behavior on implicitHeight { HNumberAnimation {} }
|
|
|
|
|
|
|
|
HGridView {
|
2020-04-26 14:20:45 -04:00
|
|
|
id: accountList
|
2020-05-13 07:37:39 -04:00
|
|
|
anchors.centerIn: parent
|
|
|
|
width: Math.min(cellWidth * count, parent.width)
|
|
|
|
height: parent.height
|
|
|
|
|
2020-04-28 14:21:15 -04:00
|
|
|
clip: true
|
2020-05-13 07:37:39 -04:00
|
|
|
cellWidth: theme.controls.avatar.size + theme.spacing
|
|
|
|
cellHeight: cellWidth
|
2020-04-29 14:00:02 -04:00
|
|
|
currentIndex:
|
2020-05-10 17:41:12 -04:00
|
|
|
roomList.count === 0 || roomList.currentIndex === -1 ?
|
2020-04-29 14:00:02 -04:00
|
|
|
-1 :
|
2020-05-10 17:41:12 -04:00
|
|
|
model.findIndex(
|
2020-05-12 06:09:07 -04:00
|
|
|
roomList.model.get(roomList.currentIndex).for_account ||
|
|
|
|
roomList.model.get(roomList.currentIndex).id,
|
|
|
|
-1,
|
2020-04-29 14:00:02 -04:00
|
|
|
)
|
2020-04-26 14:20:45 -04:00
|
|
|
|
2020-05-10 14:26:26 -04:00
|
|
|
model: ModelStore.get("matching_accounts")
|
|
|
|
|
2020-05-14 18:42:50 -04:00
|
|
|
delegate: Account {
|
2020-05-13 07:37:39 -04:00
|
|
|
width: accountList.cellWidth
|
|
|
|
height: accountList.cellHeight
|
|
|
|
padded: false
|
2020-05-14 18:42:50 -04:00
|
|
|
compact: false
|
|
|
|
filterActive: Boolean(roomList.filter)
|
2020-05-10 14:26:26 -04:00
|
|
|
|
2020-05-14 18:42:50 -04:00
|
|
|
title.visible: false
|
|
|
|
addChat.visible: false
|
|
|
|
expand.visible: false
|
2020-05-10 14:26:26 -04:00
|
|
|
|
2020-05-14 18:42:50 -04:00
|
|
|
onLeftClicked: roomList.goToAccount(model.id)
|
2020-05-01 19:00:49 -04:00
|
|
|
}
|
|
|
|
|
2020-04-28 14:21:15 -04:00
|
|
|
highlight: Item {
|
2020-05-12 06:09:07 -04:00
|
|
|
readonly property alias border: border
|
|
|
|
|
2020-04-28 14:21:15 -04:00
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
2020-05-13 08:24:53 -04:00
|
|
|
color: theme.mainPane.accountBar.account.selectedBackground
|
|
|
|
opacity: theme.mainPane.accountBar.account
|
2020-04-28 14:21:15 -04:00
|
|
|
.selectedBackgroundOpacity
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
2020-05-12 06:09:07 -04:00
|
|
|
id: border
|
2020-05-13 07:37:39 -04:00
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
width: parent.width
|
|
|
|
height:
|
2020-05-13 08:24:53 -04:00
|
|
|
theme.mainPane.accountBar.account.selectedBorderSize
|
|
|
|
color: theme.mainPane.accountBar.account.selectedBorder
|
2020-04-28 14:21:15 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-27 22:10:10 -04:00
|
|
|
|
|
|
|
HShortcut {
|
|
|
|
sequences: window.settings.keys.goToPreviousAccount
|
2020-04-29 14:00:02 -04:00
|
|
|
onActivated: {
|
2020-05-14 03:49:52 -04:00
|
|
|
accountList.moveCurrentIndexLeft()
|
2020-04-29 14:00:02 -04:00
|
|
|
accountList.currentItem.leftClicked()
|
|
|
|
}
|
2020-04-27 22:10:10 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
HShortcut {
|
|
|
|
sequences: window.settings.keys.goToNextAccount
|
2020-04-29 14:00:02 -04:00
|
|
|
onActivated: {
|
2020-05-14 03:49:52 -04:00
|
|
|
accountList.moveCurrentIndexRight()
|
2020-04-29 14:00:02 -04:00
|
|
|
accountList.currentItem.leftClicked()
|
|
|
|
}
|
2020-04-27 22:10:10 -04:00
|
|
|
}
|
2020-04-28 16:18:18 -04:00
|
|
|
}
|
2020-04-26 14:20:45 -04:00
|
|
|
}
|