Page MenuHomePhorge

D99.1729658528.diff
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

D99.1729658528.diff

diff --git a/src/contents/ui/Bubble.qml b/src/contents/ui/Bubble.qml
--- a/src/contents/ui/Bubble.qml
+++ b/src/contents/ui/Bubble.qml
@@ -22,6 +22,7 @@
property var menuContent: []
readonly property var bubbleSpacing: leftPadding + rightPadding
+ readonly property double replyMaxHeight: Kirigami.Units.gridUnit * 7
Layout.fillWidth: true
Layout.preferredHeight: bubbleRootLayout.implicitHeight
@@ -122,7 +123,7 @@
Layout.fillWidth: true
Layout.margins: 0
Layout.preferredHeight: inReplyToLayout.implicitHeight
- Layout.maximumHeight: Kirigami.Units.gridUnit * 5
+ Layout.maximumHeight: upper.replyMaxHeight
clip: true
onClicked: eventListView.goToEvent(bubbleRootLayout.replyToOrAnnotatedEventId)
diff --git a/src/contents/ui/event-types/Image.qml b/src/contents/ui/event-types/Image.qml
--- a/src/contents/ui/event-types/Image.qml
+++ b/src/contents/ui/event-types/Image.qml
@@ -30,6 +30,7 @@
property var imageFile: event.content.file || {}
property var imageWidth: imageInfo.w
property var imageHeight: imageInfo.h
+ property var imageMaxHeight: compactMode ? Kirigami.Units.gridUnit * 5 : Infinity
property var imageMxcUri: fileHandler.encryptedFileMxcUri || fileHandler.unencryptedFileMxcUri
property var innerContentWidth: upper.contentMaxWidth - bubble.bubbleSpacing
@@ -70,9 +71,14 @@
property var image: Image {
id: image
+ objectName: 'mainImage'
Layout.fillWidth: true
- Layout.preferredWidth: calcImageWidth()
- Layout.preferredHeight: width < calcImageWidth() ? calcImageHeight() / calcImageWidth() * width : calcImageHeight()
+ property double imageWidth: upper.thumbnailWidth || upper.imageWidth || image.implicitWidth || 1
+ property double imageHeight: upper.thumbnailHeight || upper.imageHeight || image.implicitHeight || 1
+ property double privHeight: Math.min(imageMaxHeight, imageHeight)
+ property double privWidth: privHeight / imageHeight * imageWidth
+ Layout.preferredWidth: privWidth
+ Layout.preferredHeight: width < privWidth ? privHeight / privWidth * width : privHeight
source: fileHandler.kazvIOJob ? "" : fileHandler.cachedFile
horizontalAlignment: Image.AlignLeft
fillMode: Image.PreserveAspectFit
@@ -106,14 +112,4 @@
]
}
}
-
- function calcImageWidth() {
- const eventSpecWidth = thumbnailWidth || imageWidth
- return eventSpecWidth || image.implicitWidth || 1
- }
-
- function calcImageHeight() {
- const eventSpecHeight = thumbnailHeight || imageHeight
- return eventSpecHeight || image.implicitHeight || 1
- }
}
diff --git a/src/tests/quick-tests/tst_EventView.qml b/src/tests/quick-tests/tst_EventView.qml
--- a/src/tests/quick-tests/tst_EventView.qml
+++ b/src/tests/quick-tests/tst_EventView.qml
@@ -9,7 +9,7 @@
import QtTest 1.0
import moe.kazv.mxc.kazv 0.0 as MK
-
+import org.kde.kirigami 2.13 as Kirigami
import '../../contents/ui' as Kazv
import 'test-helpers.js' as Helpers
import 'test-helpers' as TestHelpers
@@ -140,6 +140,10 @@
content: {
msgtype: 'm.image',
body: 'some body',
+ info: {
+ h: Kirigami.Units.gridUnit * 10,
+ w: Kirigami.Units.gridUnit * 10,
+ }
},
formattedTime: '4:06 P.M.',
})
@@ -589,6 +593,9 @@
verify(findChild(eventViewSticker, 'bodyLabel').visible);
verify(findChild(eventViewStickerCompact, 'summaryLabel').visible);
verify(!findChild(eventViewStickerCompact, 'bodyLabel').visible);
+
+ const image = findChild(eventViewImageCompact, 'mainImage');
+ verify(image.height <= Kirigami.Units.gridUnit * 5);
}
}
}

File Metadata

Mime Type
text/plain
Expires
Tue, Oct 22, 9:42 PM (19 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29095
Default Alt Text
D99.1729658528.diff (3 KB)

Event Timeline