diff --git a/TODO.md b/TODO.md index a1348dc4..9b16cfdd 100644 --- a/TODO.md +++ b/TODO.md @@ -49,7 +49,6 @@ ## Issues - load_past raise -- Room pane slightly overlaps chat at small width - invisible uploaded mxc images? - first undecryptable message - Join button 502 diff --git a/src/gui/Pages/Chat/Timeline/EventContent.qml b/src/gui/Pages/Chat/Timeline/EventContent.qml index e25eb541..0dc081ed 100644 --- a/src/gui/Pages/Chat/Timeline/EventContent.qml +++ b/src/gui/Pages/Chat/Timeline/EventContent.qml @@ -43,7 +43,7 @@ HRowLayout { ) : 0 - // 600px max with a 16px font + // ~600px max with a 16px font readonly property int maxMessageWidth: theme.fontSize.normal * 0.5 * 75 @@ -85,6 +85,8 @@ HRowLayout { HColumnLayout { id: contentColumn + + Layout.fillWidth: true Layout.alignment: Qt.AlignVCenter HSelectableLabel { @@ -185,9 +187,8 @@ HRowLayout { transform: Translate { x: xOffset } Layout.bottomMargin: pureMedia ? 0 : contentLabel.bottomPadding - Layout.leftMargin: pureMedia ? 0 : contentLabel.leftPadding - Layout.rightMargin: pureMedia ? 0 : contentLabel.rightPadding - + Layout.leftMargin: pureMedia ? 0 : eventContent.spacing + Layout.rightMargin: pureMedia ? 0 : eventContent.spacing Layout.preferredWidth: item ? item.width : -1 Layout.preferredHeight: item ? item.height : -1 } diff --git a/src/gui/Pages/Chat/Timeline/EventImage.qml b/src/gui/Pages/Chat/Timeline/EventImage.qml index 531fcca3..115fbdd1 100644 --- a/src/gui/Pages/Chat/Timeline/EventImage.qml +++ b/src/gui/Pages/Chat/Timeline/EventImage.qml @@ -25,7 +25,7 @@ HMxcImage { readonly property bool isEncrypted: ! utils.isEmptyObject(cryptDict) readonly property real maxHeight: - theme.chat.message.thumbnailMaxHeightRatio + eventList.height * theme.chat.message.thumbnailMaxHeightRatio readonly property size fitSize: utils.fitSize( // Minimum display size @@ -49,10 +49,12 @@ HMxcImage { // Maximum display size Math.min( - eventList.height * maxHeight, - eventContent.maxMessageWidth * Math.min(1, theme.uiScale), // XXX + Math.max(maxHeight, theme.chat.message.thumbnailMinSize.width), + pureMedia ? Infinity : eventContent.maxMessageWidth, + eventDelegate.width - eventContent.spacing - avatarWrapper.width - + eventContent.spacing * 2, // padding ), - eventList.height * maxHeight, + Math.max(maxHeight, theme.chat.message.thumbnailMinSize.height), ) diff --git a/src/gui/Utils.qml b/src/gui/Utils.qml index 82049829..394ff6aa 100644 --- a/src/gui/Utils.qml +++ b/src/gui/Utils.qml @@ -187,11 +187,11 @@ QtObject { function fitSize(minWidth, minHeight, width, height, maxWidth, maxHeight) { if (width >= height) { - let new_width = Math.max(Math.min(width, maxWidth), minWidth) + let new_width = Math.min(Math.max(width, minWidth), maxWidth) return Qt.size(new_width, height / (width / new_width)) } - let new_height = Math.max(Math.min(height, maxHeight), minHeight) + let new_height = Math.min(Math.max(height, minHeight), maxHeight) return Qt.size(width / (height / new_height), new_height) } diff --git a/src/themes/Default.qpl b/src/themes/Default.qpl index 36af1546..b3a9f793 100644 --- a/src/themes/Default.qpl +++ b/src/themes/Default.qpl @@ -365,11 +365,11 @@ chat: // Don't scale down thumbnails below this size in pixels, if // the becomes too small to show it at normal size. - size thumbnailMinSize: Qt.size(192 * uiScale, 192 * uiScale) + size thumbnailMinSize: Qt.size(256 * uiScale, 256 * uiScale) // How much of the chat height thumbnails can take at most, - // by default 0.3 for 30%. - real thumbnailMaxHeightRatio: 0.3 * Math.min(1, uiScale) + // by default 0.4 for 40%. + real thumbnailMaxHeightRatio: 0.4 * Math.min(1, uiScale) daybreak: color background: colors.strongBackground