2019-09-15 07:48:53 +10:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
|
|
|
import "../../Base"
|
|
|
|
|
|
|
|
HTile {
|
2019-11-11 20:34:46 +11:00
|
|
|
width: Math.max(
|
|
|
|
Math.min(eventContent.messageBodyWidth,
|
|
|
|
theme.chat.message.fileMinWidth),
|
|
|
|
Math.min(eventContent.messageBodyWidth, implicitWidth),
|
|
|
|
)
|
|
|
|
|
2019-11-11 20:26:32 +11:00
|
|
|
onLeftClicked: Qt.openUrlExternally(loader.mediaUrl)
|
2019-09-15 08:52:43 +10:00
|
|
|
onRightClicked: eventDelegate.openContextMenu()
|
2019-09-15 08:33:32 +10:00
|
|
|
|
2019-11-11 20:26:32 +11:00
|
|
|
// TODO: have the right URL, not mxc
|
2019-09-15 08:33:32 +10:00
|
|
|
onHoveredChanged:
|
|
|
|
eventDelegate.hoveredMediaTypeUrl =
|
2019-11-11 20:26:32 +11:00
|
|
|
hovered ? [EventDelegate.Media.File, loader.mediaUrl] : []
|
2019-09-15 08:33:32 +10:00
|
|
|
|
2019-09-15 07:48:53 +10:00
|
|
|
|
2019-11-11 20:26:32 +11:00
|
|
|
property EventMediaLoader loader
|
2019-09-15 07:48:53 +10:00
|
|
|
|
|
|
|
|
2019-11-11 20:26:32 +11:00
|
|
|
title.text: loader.singleMediaInfo.media_title || qsTr("Untitled file")
|
2019-09-15 07:48:53 +10:00
|
|
|
title.elide: Text.ElideMiddle
|
|
|
|
|
2019-11-11 20:26:32 +11:00
|
|
|
subtitle.text: CppUtils.formattedBytes(loader.singleMediaInfo.media_size)
|
2019-09-15 07:48:53 +10:00
|
|
|
|
|
|
|
image: HIcon {
|
|
|
|
svgName: "download"
|
|
|
|
}
|
|
|
|
}
|