moment/harmonyqml/components/SidePane/AccountDelegate.qml

78 lines
2.1 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
2019-04-29 02:45:12 +10:00
import "../Base" as Base
2019-03-22 14:28:14 +11:00
Base.HColumnLayout {
id: accountDelegate
width: parent.width
2019-03-22 14:28:14 +11:00
property string roomListUserId: userId
Base.HRowLayout {
id: row
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
Base.HColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true
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
}
Base.HTextField {
id: statusEdit
text: statusMessage || ""
2019-03-26 09:29:46 +11:00
placeholderText: qsTr("Set status message")
font.pixelSize: Base.HStyle.fontSize.small
background: null
padding: 0
leftPadding: accountLabel.leftPadding
rightPadding: leftPadding
Layout.fillWidth: true
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
userId: roomListUserId
Layout.preferredHeight: roomList.visible ? roomList.contentHeight : 0
Layout.preferredWidth:
parent.width - Layout.leftMargin - Layout.rightMargin
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
}