2019-09-08 13:44:46 +03:00
|
|
|
import QtQuick 2.6
|
|
|
|
|
2019-11-30 03:43:39 +03:00
|
|
|
import im.nheko 1.0
|
2019-10-06 02:44:02 +03:00
|
|
|
|
2019-09-08 13:44:46 +03:00
|
|
|
Item {
|
2019-12-13 04:16:12 +03:00
|
|
|
property double tempWidth: Math.min(parent ? parent.width : undefined, model.width)
|
|
|
|
property double tempHeight: tempWidth * model.proportionalHeight
|
|
|
|
|
|
|
|
property bool tooHigh: tempHeight > chat.height - 40
|
|
|
|
|
|
|
|
height: tooHigh ? chat.height - 40 : tempHeight
|
|
|
|
width: tooHigh ? (chat.height - 40) / model.proportionalHeight : tempWidth
|
2019-09-08 13:44:46 +03:00
|
|
|
|
|
|
|
Image {
|
2019-09-28 12:07:58 +03:00
|
|
|
id: img
|
2019-09-08 13:44:46 +03:00
|
|
|
anchors.fill: parent
|
|
|
|
|
2019-10-08 21:55:09 +03:00
|
|
|
source: model.url.replace("mxc://", "image://MxcImage/")
|
2019-09-08 13:44:46 +03:00
|
|
|
asynchronous: true
|
|
|
|
fillMode: Image.PreserveAspectFit
|
2019-09-28 12:07:58 +03:00
|
|
|
|
|
|
|
MouseArea {
|
2019-10-08 21:55:09 +03:00
|
|
|
enabled: model.type == MtxEvent.ImageMessage
|
2019-09-28 12:07:58 +03:00
|
|
|
anchors.fill: parent
|
2019-12-03 04:26:41 +03:00
|
|
|
onClicked: timelineManager.openImageOverlay(model.url, model.id)
|
2019-09-28 12:07:58 +03:00
|
|
|
}
|
2019-09-08 13:44:46 +03:00
|
|
|
}
|
|
|
|
}
|