moment/harmonyqml/components/sidePane/AccountDelegate.qml

86 lines
2.3 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
2019-04-29 01:32:02 +10:00
Base.HAvatar { id: avatar; name: displayName; dimension: 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: displayName.value || userId
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: statusMessage || ""
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(userId, text)
pageStack.forceActiveFocus()
}
}
}
2019-03-26 09:29:46 +11:00
Base.HButton {
id: toggleExpand
iconName: roomList.visible ? "up" : "down"
iconDimension: 16
backgroundColor: "transparent"
onClicked: roomList.visible = ! roomList.visible
Layout.preferredHeight: row.height
2019-03-22 14:28:14 +11:00
}
}
RoomList {
id: roomList
visible: true
interactive: false // no scrolling
forUserId: userId
Layout.minimumHeight:
roomList.visible ?
2019-04-13 20:28:24 +10:00
roomList.contentHeight :
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
}