2019-12-19 22:46:16 +11:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-07-13 19:39:01 +10:00
|
|
|
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
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HRowLayout {
|
2019-04-21 07:45:51 +10:00
|
|
|
id: row
|
2019-03-26 09:29:46 +11:00
|
|
|
anchors.fill: parent
|
2019-03-22 14:28:14 +11:00
|
|
|
|
2019-07-07 14:24:23 +10:00
|
|
|
HRoomAvatar {
|
2019-04-21 07:45:51 +10:00
|
|
|
id: avatar
|
2019-12-09 20:25:31 +11:00
|
|
|
displayName: chat.roomInfo.display_name
|
|
|
|
mxc: chat.roomInfo.avatar_url
|
2019-04-29 04:20:30 +10:00
|
|
|
Layout.alignment: Qt.AlignTop
|
2019-03-26 09:29:46 +11:00
|
|
|
}
|
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HLabel {
|
2019-12-09 20:25:31 +11:00
|
|
|
id: nameLabel
|
|
|
|
text: chat.roomInfo.display_name || qsTr("Empty room")
|
2019-07-07 07:50:55 +10:00
|
|
|
font.pixelSize: theme.fontSize.big
|
2019-07-24 16:14:34 +10:00
|
|
|
color: theme.chat.roomHeader.name
|
2019-12-09 20:25:31 +11:00
|
|
|
|
2019-03-26 09:29:46 +11:00
|
|
|
elide: Text.ElideRight
|
2019-07-19 14:10:46 +10:00
|
|
|
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-05-13 08:59:29 +10:00
|
|
|
)
|
2019-12-09 20:25:31 +11:00
|
|
|
Layout.fillHeight: true
|
2019-09-08 04:14:04 +10:00
|
|
|
|
|
|
|
HoverHandler { id: nameHover }
|
2019-03-26 09:29:46 +11:00
|
|
|
}
|
2019-03-22 14:28:14 +11:00
|
|
|
|
2019-09-12 06:01:37 +10:00
|
|
|
HRichLabel {
|
2019-12-09 20:25:31 +11:00
|
|
|
id: topicLabel
|
|
|
|
text: chat.roomInfo.topic
|
2019-09-12 06:01:37 +10:00
|
|
|
textFormat: Text.StyledText
|
2019-07-07 07:50:55 +10:00
|
|
|
font.pixelSize: theme.fontSize.small
|
2019-07-24 16:14:34 +10:00
|
|
|
color: theme.chat.roomHeader.topic
|
2019-12-09 20:25:31 +11:00
|
|
|
|
2019-03-26 09:29:46 +11:00
|
|
|
elide: Text.ElideRight
|
2019-07-19 14:10:46 +10:00
|
|
|
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
|
2019-07-19 14:10:46 +10:00
|
|
|
Layout.fillHeight: true
|
2019-09-08 04:14:04 +10:00
|
|
|
|
|
|
|
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)
|
2019-09-08 04:14:04 +10:00
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|