From 6cdd6de1b389304c58814739d818af6f4edd498d Mon Sep 17 00:00:00 2001 From: miruka Date: Wed, 6 Nov 2019 09:48:27 -0400 Subject: [PATCH] Show local echo icon on pure media events --- TODO.md | 3 +-- src/qml/Chat/Timeline/EventContent.qml | 20 +++++++++++++------- src/qml/Chat/Timeline/EventImage.qml | 3 ++- src/qml/Chat/Timeline/EventMediaLoader.qml | 1 + 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/TODO.md b/TODO.md index 1440e1b9..84126b86 100644 --- a/TODO.md +++ b/TODO.md @@ -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 diff --git a/src/qml/Chat/Timeline/EventContent.qml b/src/qml/Chat/Timeline/EventContent.qml index 4894ded4..fa1fe11c 100644 --- a/src/qml/Chat/Timeline/EventContent.qml +++ b/src/qml/Chat/Timeline/EventContent.qml @@ -15,9 +15,14 @@ HRowLayout { Utils.coloredNameHtml(model.sender_name, model.sender_id) + "" ) - 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 ? + " " : + "" + + 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 { " " + "" + // 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 } diff --git a/src/qml/Chat/Timeline/EventImage.qml b/src/qml/Chat/Timeline/EventImage.qml index 5a336cad..737c3a45 100644 --- a/src/qml/Chat/Timeline/EventImage.qml +++ b/src/qml/Chat/Timeline/EventImage.qml @@ -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 } } diff --git a/src/qml/Chat/Timeline/EventMediaLoader.qml b/src/qml/Chat/Timeline/EventMediaLoader.qml index c9e1e2bf..d3f6c1f2 100644 --- a/src/qml/Chat/Timeline/EventMediaLoader.qml +++ b/src/qml/Chat/Timeline/EventMediaLoader.qml @@ -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",