From cde0c15a6860b166a44f674b502ebd20fb4b6a38 Mon Sep 17 00:00:00 2001 From: miruka Date: Sat, 7 Sep 2019 14:14:04 -0400 Subject: [PATCH] Add full name/topic tooltip to room header --- TODO.md | 5 +++-- src/qml/Base/HToolTip.qml | 5 +++++ src/qml/Chat/RoomHeader.qml | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/TODO.md b/TODO.md index b050fc18..d554666a 100644 --- a/TODO.md +++ b/TODO.md @@ -35,10 +35,10 @@ - Room header descriptions: styled text - Message selection - - Make scroll wheel usable - Copy to X11 selection - Link previews - - Support images not just at the end of the message + - Support showing images at the place they should be instead of always + at the end of the message - Just use Shortcut onHeld instead of analyzing the current velocity in `smartVerticalFlick()` @@ -159,6 +159,7 @@ - nio - `AsyncClient.share_group_session`: send device batches concurrently + - Guard against asyncio OSError Network unreachable - downloads API - MatrixRoom invited members list diff --git a/src/qml/Base/HToolTip.qml b/src/qml/Base/HToolTip.qml index 6ceb9193..6e74c5e1 100644 --- a/src/qml/Base/HToolTip.qml +++ b/src/qml/Base/HToolTip.qml @@ -11,6 +11,10 @@ ToolTip { theme.fontSize.normal * 0.5 * 75, ) + + property alias label: label + + background: Rectangle { id: background color: theme.controls.toolTip.background @@ -19,6 +23,7 @@ ToolTip { } contentItem: HLabel { + id: label color: theme.controls.toolTip.text text: toolTip.text wrapMode: Text.Wrap diff --git a/src/qml/Chat/RoomHeader.qml b/src/qml/Chat/RoomHeader.qml index 1f0398f7..e4353777 100644 --- a/src/qml/Chat/RoomHeader.qml +++ b/src/qml/Chat/RoomHeader.qml @@ -43,6 +43,8 @@ Rectangle { viewButtons.width - (expandButton.visible ? expandButton.width : 0) ) + + HoverHandler { id: nameHover } } HLabel { @@ -60,6 +62,20 @@ Rectangle { roomName.width - viewButtons.width - (expandButton.visible ? expandButton.width : 0) ) + + HoverHandler { id: topicHover } + } + + HToolTip { + text: name && topic ? (name + "
" + topic) : (name || topic) + label.textFormat: Text.StyledText + visible: text && (nameHover.hovered || topicHover.hovered) + + readonly property string name: + roomName.truncated ? + ("" + chatPage.roomInfo.display_name + "") : "" + readonly property string topic: + roomTopic.truncated ? chatPage.roomInfo.topic : "" } HSpacer {}