2019-05-02 14:20:21 -04:00
|
|
|
import QtQuick 2.7
|
2019-04-28 15:45:42 -04:00
|
|
|
import QtQuick.Layouts 1.3
|
2019-04-28 15:18:36 -04:00
|
|
|
import "../Base"
|
2019-07-03 22:31:29 -04:00
|
|
|
import "../utils.js" as Utils
|
2019-03-21 23:28:14 -04:00
|
|
|
|
2019-05-02 14:20:21 -04:00
|
|
|
Column {
|
2019-04-20 17:45:51 -04:00
|
|
|
id: accountDelegate
|
2019-03-26 03:19:55 -04:00
|
|
|
width: parent.width
|
2019-03-21 23:28:14 -04:00
|
|
|
|
2019-06-28 18:12:45 -04:00
|
|
|
// Avoid binding loop by using Component.onCompleted
|
|
|
|
property var user: null
|
|
|
|
Component.onCompleted: user = models.users.getUser(userId)
|
2019-05-11 15:52:56 -04:00
|
|
|
|
2019-05-02 14:20:21 -04:00
|
|
|
property string roomCategoriesListUserId: userId
|
|
|
|
property bool expanded: true
|
2019-04-28 12:40:18 -04:00
|
|
|
|
2019-04-28 15:18:36 -04:00
|
|
|
HRowLayout {
|
2019-05-02 14:20:21 -04:00
|
|
|
width: parent.width
|
|
|
|
height: childrenRect.height
|
2019-04-20 17:45:51 -04:00
|
|
|
id: row
|
2019-03-25 18:29:46 -04:00
|
|
|
|
2019-05-02 14:20:21 -04:00
|
|
|
HAvatar {
|
|
|
|
id: avatar
|
2019-07-03 22:31:29 -04:00
|
|
|
name: user.displayName || Utils.stripUserId(user.userId)
|
2019-05-02 14:20:21 -04:00
|
|
|
}
|
2019-03-25 18:29:46 -04:00
|
|
|
|
2019-04-28 15:18:36 -04:00
|
|
|
HColumnLayout {
|
2019-03-26 03:19:55 -04:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2019-03-25 18:29:46 -04:00
|
|
|
|
2019-04-28 15:18:36 -04:00
|
|
|
HLabel {
|
2019-04-20 17:45:51 -04:00
|
|
|
id: accountLabel
|
2019-06-28 18:12:45 -04:00
|
|
|
text: user.displayName || user.userId
|
2019-04-28 15:36:43 -04:00
|
|
|
elide: HLabel.ElideRight
|
2019-03-25 18:29:46 -04:00
|
|
|
maximumLineCount: 1
|
|
|
|
Layout.fillWidth: true
|
2019-03-26 03:19:55 -04:00
|
|
|
leftPadding: 6
|
|
|
|
rightPadding: leftPadding
|
2019-03-25 18:29:46 -04:00
|
|
|
}
|
2019-03-26 03:19:55 -04:00
|
|
|
|
2019-04-28 15:18:36 -04:00
|
|
|
HTextField {
|
2019-04-20 17:45:51 -04:00
|
|
|
id: statusEdit
|
2019-05-11 15:52:56 -04:00
|
|
|
text: user.statusMessage || ""
|
2019-03-25 18:29:46 -04:00
|
|
|
placeholderText: qsTr("Set status message")
|
2019-04-28 15:18:36 -04:00
|
|
|
font.pixelSize: HStyle.fontSize.small
|
2019-03-26 03:19:55 -04:00
|
|
|
background: null
|
2019-04-28 12:40:18 -04:00
|
|
|
|
2019-03-26 03:19:55 -04:00
|
|
|
padding: 0
|
|
|
|
leftPadding: accountLabel.leftPadding
|
|
|
|
rightPadding: leftPadding
|
2019-04-28 12:40:18 -04:00
|
|
|
Layout.fillWidth: true
|
2019-03-26 03:19:55 -04:00
|
|
|
|
|
|
|
onEditingFinished: {
|
2019-04-28 12:40:18 -04:00
|
|
|
//Backend.setStatusMessage(userId, text)
|
2019-03-26 03:19:55 -04:00
|
|
|
pageStack.forceActiveFocus()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-03-25 18:29:46 -04:00
|
|
|
|
2019-05-06 20:37:41 -04:00
|
|
|
ExpandButton {
|
|
|
|
expandableItem: accountDelegate
|
2019-04-28 12:08:54 -04:00
|
|
|
Layout.preferredHeight: row.height
|
2019-03-21 23:28:14 -04:00
|
|
|
}
|
|
|
|
}
|
2019-03-26 03:19:55 -04:00
|
|
|
|
2019-05-02 14:20:21 -04:00
|
|
|
RoomCategoriesList {
|
|
|
|
id: roomCategoriesList
|
2019-03-27 15:53:29 -04:00
|
|
|
interactive: false // no scrolling
|
2019-05-02 14:20:21 -04:00
|
|
|
visible: height > 0
|
|
|
|
width: parent.width
|
|
|
|
height: childrenRect.height * (accountDelegate.expanded ? 1 : 0)
|
|
|
|
clip: heightAnimation.running
|
2019-03-26 03:19:55 -04:00
|
|
|
|
2019-05-02 14:20:21 -04:00
|
|
|
userId: roomCategoriesListUserId
|
2019-03-26 03:19:55 -04:00
|
|
|
|
2019-05-02 14:20:21 -04:00
|
|
|
Behavior on height {
|
2019-05-14 15:15:10 -04:00
|
|
|
NumberAnimation {
|
|
|
|
id: heightAnimation;
|
|
|
|
duration: HStyle.animationDuration
|
|
|
|
}
|
2019-05-02 14:20:21 -04:00
|
|
|
}
|
2019-03-26 03:19:55 -04:00
|
|
|
}
|
2019-03-21 23:28:14 -04:00
|
|
|
}
|