Fix RoomDelegates v padding when collapsed

This commit is contained in:
miruka 2019-08-11 22:57:36 -04:00
parent 3c35616eaa
commit 9924b0565a

View File

@ -6,69 +6,66 @@ import "../utils.js" as Utils
HInteractiveRectangle { HInteractiveRectangle {
id: roomDelegate id: roomDelegate
width: roomList.width width: roomList.width
height: childrenRect.height height: rowLayout.height
color: theme.sidePane.room.background color: theme.sidePane.room.background
TapHandler { onTapped: pageStack.showRoom(userId, model.room_id) } TapHandler { onTapped: pageStack.showRoom(userId, model.room_id) }
Row { HRowLayout {
width: parent.width - leftPadding * 2 id: rowLayout
padding: sidePane.currentSpacing / 2 x: sidePane.currentSpacing
leftPadding: sidePane.currentSpacing width: parent.width - sidePane.currentSpacing * 1.5
rightPadding: 0 height: roomLabel.height + subtitleLabel.height +
sidePane.currentSpacing / 1.5
spacing: sidePane.currentSpacing
HRowLayout { HRoomAvatar {
width: parent.width id: roomAvatar
spacing: sidePane.currentSpacing displayName: model.display_name
avatarUrl: model.avatar_url
}
HRoomAvatar { HColumnLayout {
id: roomAvatar Layout.fillWidth: true
displayName: model.display_name
avatarUrl: model.avatar_url HLabel {
id: roomLabel
color: theme.sidePane.room.name
text: model.display_name || "<i>Empty room</i>"
textFormat:
model.display_name? Text.PlainText : Text.StyledText
elide: Text.ElideRight
verticalAlignment: Qt.AlignVCenter
Layout.fillWidth: true
} }
HColumnLayout { HRichLabel {
Layout.fillWidth: true id: subtitleLabel
color: theme.sidePane.room.subtitle
visible: Boolean(text)
textFormat: Text.StyledText
HLabel { text: {
id: roomLabel if (! model.last_event) { return "" }
color: theme.sidePane.room.name
text: model.display_name || "<i>Empty room</i>"
textFormat:
model.display_name? Text.PlainText : Text.StyledText
elide: Text.ElideRight
verticalAlignment: Qt.AlignVCenter
Layout.fillWidth: true let ev = model.last_event
}
HRichLabel { if (ev.event_type === "RoomMessageEmote" ||
id: subtitleLabel ! ev.event_type.startsWith("RoomMessage")) {
color: theme.sidePane.room.subtitle return Utils.processedEventText(ev)
visible: Boolean(text)
textFormat: Text.StyledText
text: {
if (! model.last_event) { return "" }
let ev = model.last_event
if (ev.event_type === "RoomMessageEmote" ||
! ev.event_type.startsWith("RoomMessage")) {
return Utils.processedEventText(ev)
}
return Utils.coloredNameHtml(
ev.sender_name, ev.sender_id
) + ": " + ev.inline_content
} }
return Utils.coloredNameHtml(
font.pixelSize: theme.fontSize.small ev.sender_name, ev.sender_id
elide: Text.ElideRight ) + ": " + ev.inline_content
Layout.fillWidth: true
} }
font.pixelSize: theme.fontSize.small
elide: Text.ElideRight
Layout.fillWidth: true
} }
} }
} }