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