moment/src/gui/Pages/Chat/RoomHeader.qml

70 lines
1.9 KiB
QML
Raw Normal View History

import QtQuick 2.12
import QtQuick.Layouts 1.12
2019-12-18 19:53:08 +11:00
import "../../Base"
2019-03-22 14:28:14 +11:00
2019-08-28 12:46:31 +10:00
Rectangle {
2019-07-17 07:08:06 +10:00
implicitHeight: theme.baseElementsHeight
2019-12-09 20:25:31 +11:00
color: theme.chat.roomHeader.background
2019-03-22 14:28:14 +11:00
HRowLayout {
id: row
2019-03-26 09:29:46 +11:00
anchors.fill: parent
2019-03-22 14:28:14 +11:00
HRoomAvatar {
id: avatar
2019-12-09 20:25:31 +11:00
displayName: chat.roomInfo.display_name
mxc: chat.roomInfo.avatar_url
Layout.alignment: Qt.AlignTop
2019-03-26 09:29:46 +11:00
}
HLabel {
2019-12-09 20:25:31 +11:00
id: nameLabel
text: chat.roomInfo.display_name || qsTr("Empty room")
font.pixelSize: theme.fontSize.big
color: theme.chat.roomHeader.name
2019-12-09 20:25:31 +11:00
2019-03-26 09:29:46 +11:00
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
2019-12-09 20:25:31 +11:00
leftPadding: theme.spacing
rightPadding: leftPadding
2019-05-13 03:17:42 +10:00
2019-12-09 20:25:31 +11:00
Layout.preferredWidth: Math.min(
implicitWidth, row.width - row.spacing - avatar.width
)
2019-12-09 20:25:31 +11:00
Layout.fillHeight: true
HoverHandler { id: nameHover }
2019-03-26 09:29:46 +11:00
}
2019-03-22 14:28:14 +11:00
HRichLabel {
2019-12-09 20:25:31 +11:00
id: topicLabel
text: chat.roomInfo.topic
textFormat: Text.StyledText
font.pixelSize: theme.fontSize.small
color: theme.chat.roomHeader.topic
2019-12-09 20:25:31 +11:00
2019-03-26 09:29:46 +11:00
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
2019-12-09 20:25:31 +11:00
rightPadding: nameLabel.rightPadding
2019-05-13 03:17:42 +10:00
2019-12-09 20:25:31 +11:00
Layout.fillWidth: true
Layout.fillHeight: true
HoverHandler { id: topicHover }
}
HToolTip {
visible: text && (nameHover.hovered || topicHover.hovered)
2019-12-09 20:25:31 +11:00
label.textFormat: Text.StyledText
text: name && topic ? (`${name}<br>${topic}`) : (name || topic)
readonly property string name:
2019-12-09 20:25:31 +11:00
nameLabel.truncated ?
(`<b>${chat.roomInfo.display_name}</b>`) : ""
2019-05-13 03:17:42 +10:00
2019-12-09 20:25:31 +11:00
readonly property string topic:
topicLabel.truncated ? chat.roomInfo.topic : ""
2019-05-13 03:17:42 +10:00
}
2019-03-22 14:28:14 +11:00
}
}