From fa232a4cbf86aedccae6b042c31824aa72d9f621 Mon Sep 17 00:00:00 2001 From: John Gibbon Date: Tue, 19 Jan 2021 00:12:59 +0100 Subject: [PATCH] Change channel messages layout - make text wider - add view count --- images/icon-s-eye.svg | 35 ++++++++++++++++++++++++++ qml/components/MessageListViewItem.qml | 29 +++++++++++++++++++++ qml/pages/ChatPage.qml | 2 +- 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 images/icon-s-eye.svg diff --git a/images/icon-s-eye.svg b/images/icon-s-eye.svg new file mode 100644 index 0000000..822f025 --- /dev/null +++ b/images/icon-s-eye.svg @@ -0,0 +1,35 @@ + +image/svg+xml + + \ No newline at end of file diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index 1e81d59..f3c9155 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -475,6 +475,7 @@ ListItem { color: messageListItem.isOwnMessage ? Theme.secondaryHighlightColor : Theme.secondaryColor horizontalAlignment: messageListItem.textAlign text: getMessageStatusText(myMessage, index, chatView.lastReadSentIndex, messageDateText.useElapsed) + rightPadding: interactionLoader.active ? interactionLoader.width : 0 MouseArea { anchors.fill: parent enabled: !messageListItem.precalculatedValues.pageIsSelecting @@ -483,6 +484,34 @@ ListItem { messageDateText.text = getMessageStatusText(myMessage, index, chatView.lastReadSentIndex, messageDateText.useElapsed); } } + + Loader { + id: interactionLoader + height: parent.height + anchors.right: parent.right + asynchronous: true + active: chatPage.isChannel && myMessage.interaction_info && myMessage.interaction_info.view_count + sourceComponent: Component { + Label { + text: Functions.getShortenedCount(myMessage.interaction_info.view_count) + leftPadding: Theme.iconSizeSmall + font.pixelSize: Theme.fontSizeTiny + color: Theme.secondaryColor + Icon { + anchors.verticalCenter: parent.verticalCenter + width: Theme.iconSizeExtraSmall + height: Theme.iconSizeExtraSmall + opacity: 0.6 + source: "../../images/icon-s-eye.svg" + sourceSize { + width: Theme.iconSizeExtraSmall + height: Theme.iconSizeExtraSmall + } + } + } + } + + } } } diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 0e59b1b..b297805 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -963,7 +963,7 @@ Page { readonly property int paddingMediumDouble: 2 * Theme.paddingMedium readonly property int entryWidth: chatView.width - pageMarginDouble readonly property int textItemWidth: entryWidth - profileThumbnailDimensions - Theme.paddingSmall - readonly property int backgroundWidth: textItemWidth - pageMarginDouble + readonly property int backgroundWidth: page.isChannel ? textItemWidth : textItemWidth - pageMarginDouble readonly property int backgroundRadius: textItemWidth/50 readonly property int textColumnWidth: backgroundWidth - Theme.horizontalPageMargin readonly property int messageInReplyToHeight: Theme.fontSizeExtraSmall * 2.571428571 + Theme.paddingSmall;