Fix EventFile sizing/elliding

This commit is contained in:
miruka 2019-11-11 05:34:46 -04:00
parent 4b76725006
commit deedc8c7aa
3 changed files with 7 additions and 26 deletions

View File

@ -164,32 +164,6 @@ HRowLayout {
Layout.preferredWidth: item ? item.width : -1 Layout.preferredWidth: item ? item.width : -1
Layout.preferredHeight: item ? item.height : -1 Layout.preferredHeight: item ? item.height : -1
// Layout.minimumWidth:
// type === EventDelegate.Media.Image ?
// (singleMediaInfo.media_width ||
// (item ? item.loadingLabel.implicitWidth : -1)) : -1
// Layout.minimumHeight:
// type === EventDelegate.Media.Image ?
// (singleMediaInfo.media_height ||
// (item ? item.loadingLabel.implicitHeight : -1)) : -1
// Layout.minimumWidth:
// type === EventDelegate.Media.File ?
// theme.chat.message.fileMinWidth : -1
// Layout.preferredWidth:
// type === EventDelegate.Media.Video ?
// theme.chat.message.videoWidth :
// type === EventDelegate.Media.Audio ?
// theme.chat.message.audioWidth :
// -1
// Layout.maximumWidth: messageBodyWidth
// Layout.maximumHeight: eventList.height / 2
} }
} }
} }

View File

@ -3,6 +3,12 @@ import QtQuick.Layouts 1.12
import "../../Base" import "../../Base"
HTile { HTile {
width: Math.max(
Math.min(eventContent.messageBodyWidth,
theme.chat.message.fileMinWidth),
Math.min(eventContent.messageBodyWidth, implicitWidth),
)
onLeftClicked: Qt.openUrlExternally(loader.mediaUrl) onLeftClicked: Qt.openUrlExternally(loader.mediaUrl)
onRightClicked: eventDelegate.openContextMenu() onRightClicked: eventDelegate.openContextMenu()

View File

@ -6,6 +6,7 @@ HMxcImage {
id: image id: image
width: fitSize.width width: fitSize.width
height: fitSize.height height: fitSize.height
horizontalAlignment: Image.AlignLeft horizontalAlignment: Image.AlignLeft
animated: loader.singleMediaInfo.media_mime === "image/gif" || animated: loader.singleMediaInfo.media_mime === "image/gif" ||
Utils.urlExtension(loader.mediaUrl) === "gif" Utils.urlExtension(loader.mediaUrl) === "gif"