moment/harmonyqml/components/sidePane/AccountDelegate.qml
miruka 8f35e60801 Capitalization, list model and room header work
- Standardized capitalization for variables and file names everywhere in
  QML and JS, get rid of mixed camelCase/snakeCase,
  use camelCase like everywhere in Qt

- ListModel items are now stored and returned as real QObjects with
  PyQt properties and signals.
  This makes dynamic property binding a lot easier and eliminates the need
  for many hacks.

- New update(), updateOrAppendWhere() methods and roles property
  for ListModel

- RoomHeader now properly updates when the room title or topic changes

- Add Backend.pdb(), to make it easier to start the debugger from QML
2019-04-20 17:43:57 -04:00

88 lines
2.3 KiB
QML

import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.4
import "../base" as Base
ColumnLayout {
id: "accountDelegate"
spacing: 0
width: parent.width
RowLayout {
id: "row"
spacing: 0
Base.Avatar { id: "avatar"; name: displayName; dimmension: 36 }
ColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 0
Base.HLabel {
id: "accountLabel"
text: displayName.value || userId
elide: Text.ElideRight
maximumLineCount: 1
Layout.fillWidth: true
leftPadding: 6
rightPadding: leftPadding
}
TextField {
id: "statusEdit"
text: statusMessage || ""
placeholderText: qsTr("Set status message")
background: null
color: "black"
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()
}
}
}
Base.HToolButton {
id: "toggleExpand"
iconName: roomList.visible ? "up" : "down"
Layout.maximumWidth: 28
Layout.minimumHeight: row.height
onClicked: {
toggleExpand.ToolTip.hide()
roomList.visible = ! roomList.visible
}
}
}
RoomList {
id: "roomList"
visible: true
interactive: false // no scrolling
forUserId: userId
Layout.minimumHeight:
roomList.visible ?
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
}
}