Add EventFile (unfunctional for now)

This commit is contained in:
miruka 2019-09-14 17:48:53 -04:00
parent 38e781c9f7
commit a80f294610
4 changed files with 53 additions and 4 deletions

View File

@ -0,0 +1,3 @@
<svg clip-rule="evenodd" fill-rule="evenodd" height="24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="m12.656464 1.0180754v19.2299966l6.218029-7.395358 1.003077.833334-7.849999 9.295877-7.9051411-9.308796 1.0043901-.832043 6.216716 7.405694v-19.2287046z" stroke="#020407" stroke-width=".8"/>
</svg>

After

Width:  |  Height:  |  Size: 314 B

View File

@ -0,0 +1,38 @@
import QtQuick 2.12
import QtQuick.Layouts 1.12
import "../../Base"
HTile {
width: Math.min(
mainColumn.width - eventContent.spacing * 2,
theme.chat.message.thumbnailWidth,
)
property url thumbnailUrl
property url fileUrl
property string fileTitle: ""
property int fileSize: 0
title.text: fileTitle || qsTr("Untitled file")
title.elide: Text.ElideMiddle
subtitle.text: CppUtils.formattedBytes(fileSize)
image: HIcon {
svgName: "download"
}
TapHandler {
acceptedButtons: Qt.LeftButton
onTapped: Qt.openUrlExternally(file.fileUrl)
}
HoverHandler {
id: hover
onHoveredChanged:
eventContent.hoveredImage = hovered ? file.fileUrl : ""
}
}

View File

@ -3,7 +3,6 @@ import "../../Base"
HImage {
id: image
x: eventContent.spacing
sourceSize.width: theme.chat.message.thumbnailWidth
sourceSize.height: theme.chat.message.thumbnailWidth
width: Math.min(

View File

@ -4,6 +4,7 @@ import "../../utils.js" as Utils
HLoader {
id: loader
x: eventContent.spacing
enum Type { Page, File, Image, Video, Audio }
@ -56,9 +57,17 @@ HLoader {
if (type === EventMediaLoader.Type.Image) {
var file = "EventImage.qml"
var props = { source: previewUrl, fullSource: mediaUrl }
} else {
return
}
} else if (type === EventMediaLoader.Type.File) {
var file = "EventFile.qml"
var props = {
thumbnailUrl: previewUrl,
fileUrl: mediaUrl,
fileTitle: info.media_title,
fileSize: info.media_size,
}
} else { return }
loader.setSource(file, props)
}