2020-04-27 04:20:45 +10:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
|
|
|
import ".."
|
|
|
|
import "../Base"
|
|
|
|
import "../Base/HTile"
|
|
|
|
|
|
|
|
HColumnLayout {
|
2020-04-28 12:40:04 +10:00
|
|
|
property AccountView accountView
|
2020-04-27 04:20:45 +10:00
|
|
|
|
|
|
|
|
|
|
|
HButton {
|
|
|
|
id: settingsButton
|
2020-04-28 13:49:36 +10:00
|
|
|
backgroundColor: theme.accountsBar.settingsButtonBackground
|
2020-04-27 04:20:45 +10:00
|
|
|
icon.name: "settings"
|
|
|
|
toolTip.text: qsTr("Open config folder")
|
|
|
|
|
|
|
|
onClicked: py.callCoro("get_config_dir", [], Qt.openUrlExternally)
|
|
|
|
|
|
|
|
Layout.preferredHeight: theme.baseElementsHeight
|
|
|
|
}
|
|
|
|
|
|
|
|
HListView {
|
|
|
|
id: accountList
|
|
|
|
model: ModelStore.get("accounts")
|
2020-04-28 12:40:04 +10:00
|
|
|
currentIndex: accountView.currentIndex
|
2020-04-27 04:20:45 +10:00
|
|
|
|
|
|
|
delegate: HTileDelegate {
|
|
|
|
id: tile
|
|
|
|
width: accountList.width
|
2020-04-28 13:49:36 +10:00
|
|
|
backgroundColor: theme.accountsBar.accountList.account.background
|
2020-04-27 04:20:45 +10:00
|
|
|
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: account.compact
|
|
|
|
|
2020-04-28 13:49:36 +10:00
|
|
|
radius: theme.accountsBar.accountList.account.avatarRadius
|
2020-04-27 04:20:45 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-28 12:40:04 +10:00
|
|
|
onLeftClicked: accountView.currentIndex = model.index
|
2020-04-27 04:20:45 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2020-04-28 12:10:10 +10:00
|
|
|
|
|
|
|
HShortcut {
|
|
|
|
sequences: window.settings.keys.goToPreviousAccount
|
2020-04-28 12:40:04 +10:00
|
|
|
onActivated: accountView.decrementWrapIndex()
|
2020-04-28 12:10:10 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
HShortcut {
|
|
|
|
sequences: window.settings.keys.goToNextAccount
|
2020-04-28 12:40:04 +10:00
|
|
|
onActivated: accountView.incrementWrapIndex()
|
2020-04-28 12:10:10 +10:00
|
|
|
}
|
2020-04-28 13:49:36 +10:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
|
|
|
z: -100
|
|
|
|
color: theme.accountsBar.accountList.background
|
|
|
|
}
|
2020-04-27 04:20:45 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
HButton {
|
|
|
|
id: addAccountButton
|
|
|
|
icon.name: "add-account"
|
|
|
|
toolTip.text: qsTr("Add another account")
|
2020-04-28 13:49:36 +10:00
|
|
|
backgroundColor: theme.accountsBar.addAccountButtonBackground
|
2020-04-27 04:20:45 +10:00
|
|
|
onClicked: pageLoader.showPage("AddAccount/AddAccount")
|
|
|
|
|
|
|
|
Layout.preferredHeight: theme.baseElementsHeight
|
|
|
|
|
|
|
|
HShortcut {
|
|
|
|
sequences: window.settings.keys.addNewAccount
|
|
|
|
onActivated: addAccountButton.clicked()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|