Show local echo icon on pure media events

This commit is contained in:
miruka 2019-11-06 09:48:27 -04:00
parent 18e184d1f0
commit 6cdd6de1b3
4 changed files with 17 additions and 10 deletions

View File

@ -1,7 +1,6 @@
- Media - Media
- Uploading progress bar (+local echo) - Uploading progress bar
- Text bubbles theming - Text bubbles theming
- Directly create cache files for our uploads before actually uploading
- Downloading - Downloading
- Bottom/top bar - Bottom/top bar
- Image loading progress bar - Image loading progress bar

View File

@ -15,9 +15,14 @@ HRowLayout {
Utils.coloredNameHtml(model.sender_name, model.sender_id) + Utils.coloredNameHtml(model.sender_name, model.sender_id) +
"</div>" "</div>"
) )
readonly property string eventText: Utils.processedEventText(model) readonly property string contentText: Utils.processedEventText(model)
readonly property string eventTime: Utils.formatTime(model.date, false) readonly property string timeText: Utils.formatTime(model.date, false)
readonly property bool pureMedia: ! eventText && linksRepeater.count readonly property string localEchoText:
model.is_local_echo ?
"&nbsp;<font size=" + theme.fontSize.small + "px>⏳</font>" :
""
readonly property bool pureMedia: ! contentText && linksRepeater.count
readonly property string hoveredLink: contentLabel.hoveredLink readonly property string hoveredLink: contentLabel.hoveredLink
readonly property bool hoveredSelectable: contentHover.hovered readonly property bool hoveredSelectable: contentHover.hovered
@ -87,7 +92,7 @@ HRowLayout {
eventContent.eventSender + eventContent.eventSender +
// Message body // Message body
eventContent.eventText + eventContent.contentText +
// Time // Time
// For some reason, if there's only one space, // For some reason, if there's only one space,
@ -95,7 +100,7 @@ HRowLayout {
" " + " " +
"<font size=" + theme.fontSize.small + "<font size=" + theme.fontSize.small +
"px color=" + theme.chat.message.date + '>' + "px color=" + theme.chat.message.date + '>' +
eventTime + timeText +
"</font>" + "</font>" +
// Local echo icon // Local echo icon
@ -117,7 +122,7 @@ HRowLayout {
contentLabel.select( contentLabel.select(
0, 0,
contentLabel.length - contentLabel.length -
eventTime.length - 1 // - 1: separating space timeText.length - 1 // - 1: separating space
) )
contentLabel.updateContainerSelectedTexts() contentLabel.updateContainerSelectedTexts()
} }
@ -148,7 +153,8 @@ HRowLayout {
singleMediaInfo: eventDelegate.currentItem singleMediaInfo: eventDelegate.currentItem
mediaUrl: modelData mediaUrl: modelData
showSender: pureMedia ? eventSender : "" showSender: pureMedia ? eventSender : ""
showDate: pureMedia ? eventTime : "" showDate: pureMedia ? timeText : ""
showLocalEcho: pureMedia ? localEchoText : ""
transform: Translate { x: xOffset } transform: Translate { x: xOffset }

View File

@ -67,6 +67,7 @@ HMxcImage {
EventImageTextBubble { EventImageTextBubble {
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
text: loader.showDate text: [loader.showDate, loader.showLocalEcho].join(" ")
textFormat: Text.StyledText
} }
} }

View File

@ -11,6 +11,7 @@ HLoader {
property string mediaUrl property string mediaUrl
property string showSender: "" property string showSender: ""
property string showDate: "" property string showDate: ""
property string showLocalEcho: ""
readonly property var imageExtensions: [ readonly property var imageExtensions: [
"bmp", "gif", "jpg", "jpeg", "png", "pbm", "pgm", "ppm", "xbm", "xpm", "bmp", "gif", "jpg", "jpeg", "png", "pbm", "pgm", "ppm", "xbm", "xpm",