Improve/fix EventImage size handling
This commit is contained in:
parent
bf4517b146
commit
040bfe37f8
3
TODO.md
3
TODO.md
|
@ -19,10 +19,7 @@
|
||||||
- Video: missing buttons and small size problems
|
- Video: missing buttons and small size problems
|
||||||
- Audio: online playback is buggy, must download+play file
|
- Audio: online playback is buggy, must download+play file
|
||||||
|
|
||||||
- Shrinking the window near its minimum size (seen at 262px) makes
|
|
||||||
image preview position/padding wrong
|
|
||||||
- In the "Leave me" room, "join > Hi > left" aren't combined
|
- In the "Leave me" room, "join > Hi > left" aren't combined
|
||||||
- GIF glitchy border
|
|
||||||
- Combined pure media events time looks bad
|
- Combined pure media events time looks bad
|
||||||
|
|
||||||
- RoomMessageNotice
|
- RoomMessageNotice
|
||||||
|
|
|
@ -145,38 +145,25 @@ HRowLayout {
|
||||||
|
|
||||||
transform: Translate { x: xOffset }
|
transform: Translate { x: xOffset }
|
||||||
|
|
||||||
Layout.bottomMargin: contentLabel.bottomPadding * multiply
|
Layout.bottomMargin: pureMedia ? 0 : contentLabel.bottomPadding
|
||||||
Layout.leftMargin: contentLabel.leftPadding * multiply
|
Layout.leftMargin: pureMedia ? 0 : contentLabel.leftPadding
|
||||||
Layout.rightMargin: contentLabel.rightPadding * multiply
|
Layout.rightMargin: pureMedia ? 0 : contentLabel.rightPadding
|
||||||
|
|
||||||
Layout.minimumWidth:
|
// Layout.minimumWidth:
|
||||||
type === EventDelegate.Media.File ?
|
// type === EventDelegate.Media.File ?
|
||||||
theme.chat.message.fileMinWidth : -1
|
// theme.chat.message.fileMinWidth : -1
|
||||||
|
|
||||||
Layout.preferredWidth:
|
// Layout.preferredWidth:
|
||||||
type === EventDelegate.Media.Image ?
|
// type === EventDelegate.Media.Video ?
|
||||||
(item ? item.fitSize.width : 0) :
|
// theme.chat.message.videoWidth :
|
||||||
|
|
||||||
type === EventDelegate.Media.Video ?
|
// type === EventDelegate.Media.Audio ?
|
||||||
theme.chat.message.videoWidth :
|
// theme.chat.message.audioWidth :
|
||||||
|
|
||||||
type === EventDelegate.Media.Audio ?
|
// -1
|
||||||
theme.chat.message.audioWidth :
|
|
||||||
|
|
||||||
-1
|
Layout.maximumWidth: messageBodyWidth
|
||||||
|
Layout.maximumHeight: eventList.height / 1.5
|
||||||
Layout.maximumWidth:
|
|
||||||
messageBodyWidth - Layout.leftMargin - Layout.rightMargin
|
|
||||||
|
|
||||||
Layout.maximumHeight:
|
|
||||||
type === EventDelegate.Media.Image && item ?
|
|
||||||
Utils.fitSize(
|
|
||||||
Layout.maximumWidth,
|
|
||||||
item.fitSize.height,
|
|
||||||
Layout.maximumWidth
|
|
||||||
).height : -1
|
|
||||||
|
|
||||||
readonly property int multiply: pureMedia ? 0 : 1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,23 +4,13 @@ import "../../utils.js" as Utils
|
||||||
|
|
||||||
HImage {
|
HImage {
|
||||||
id: image
|
id: image
|
||||||
sourceSize.width: theme.chat.message.thumbnailWidth
|
horizontalAlignment: Image.AlignLeft
|
||||||
sourceSize.height: theme.chat.message.thumbnailWidth
|
sourceSize.width: theme.chat.message.thumbnailWidth // FIXME
|
||||||
width: fitSize.width
|
|
||||||
height: fitSize.height
|
|
||||||
|
|
||||||
// Leaving PreserveAspectFit creates a binding loop, and is uneeded
|
|
||||||
// since we calculate ourself the right size.
|
|
||||||
fillMode: Image.Pad
|
|
||||||
|
|
||||||
|
|
||||||
// source = thumbnail, fullSource = full original image
|
// source = thumbnail, fullSource = full original image
|
||||||
property url fullSource: source
|
property url fullSource: source
|
||||||
|
|
||||||
readonly property size fitSize: Utils.fitSize(
|
|
||||||
implicitWidth, implicitHeight, theme.chat.message.thumbnailWidth,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
TapHandler {
|
TapHandler {
|
||||||
onTapped: if (! image.animated) Qt.openUrlExternally(fullSource)
|
onTapped: if (! image.animated) Qt.openUrlExternally(fullSource)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user