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
- Uploading progress bar (+local echo)
- Uploading progress bar
- Text bubbles theming
- Directly create cache files for our uploads before actually uploading
- Downloading
- Bottom/top bar
- Image loading progress bar

View File

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

View File

@ -67,6 +67,7 @@ HMxcImage {
EventImageTextBubble {
anchors.right: parent.right
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 showSender: ""
property string showDate: ""
property string showLocalEcho: ""
readonly property var imageExtensions: [
"bmp", "gif", "jpg", "jpeg", "png", "pbm", "pgm", "ppm", "xbm", "xpm",