moment/harmonyqml/components/side_pane/AccountDelegate.qml

88 lines
2.4 KiB
QML
Raw Normal View History

2019-03-22 14:28:14 +11:00
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.4
import "../base" as Base
2019-03-22 14:28:14 +11:00
ColumnLayout {
id: "accountDelegate"
spacing: 0
width: parent.width
2019-03-22 14:28:14 +11:00
RowLayout {
id: "row"
spacing: 0
2019-03-26 09:29:46 +11:00
Base.Avatar { id: "avatar"; name: display_name; dimmension: 36 }
2019-03-26 09:29:46 +11:00
ColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 0
2019-03-26 09:29:46 +11:00
Base.HLabel {
id: "accountLabel"
text: display_name
2019-03-26 09:29:46 +11:00
elide: Text.ElideRight
maximumLineCount: 1
Layout.fillWidth: true
leftPadding: 6
rightPadding: leftPadding
2019-03-26 09:29:46 +11:00
}
2019-03-26 09:29:46 +11:00
TextField {
id: "statusEdit"
text: status_message || ""
2019-03-26 09:29:46 +11:00
placeholderText: qsTr("Set status message")
background: null
color: "black"
2019-03-26 09:29:46 +11:00
selectByMouse: true
font.family: "Roboto"
font.pixelSize: 12
Layout.fillWidth: true
padding: 0
leftPadding: accountLabel.leftPadding
rightPadding: leftPadding
onEditingFinished: {
Backend.setStatusMessage(user_id, text)
pageStack.forceActiveFocus()
}
}
}
2019-03-26 09:29:46 +11:00
Base.HToolButton {
id: "toggleExpand"
iconName: roomList.visible ? "up" : "down"
Layout.maximumWidth: 28
Layout.minimumHeight: row.height
onClicked: {
toggleExpand.ToolTip.hide()
roomList.visible = ! roomList.visible
2019-03-22 14:28:14 +11:00
}
}
}
RoomList {
id: "roomList"
visible: true
interactive: false // no scrolling
user: Backend.getUser(user_id)
Layout.minimumHeight:
roomList.visible ?
roomList.contentHeight + roomList.anchors.margins * 2 :
0
Layout.maximumHeight: Layout.minimumHeight
Layout.minimumWidth:
parent.width - Layout.leftMargin - Layout.rightMargin
Layout.maximumWidth: Layout.minimumWidth
Layout.margins: accountList.spacing
Layout.leftMargin:
sidePane.width < 36 + Layout.margins ? 0 : Layout.margins
Layout.rightMargin: 0
}
2019-03-22 14:28:14 +11:00
}