Add EventFile (unfunctional for now)
This commit is contained in:
parent
38e781c9f7
commit
a80f294610
3
src/icons/thin/download.svg
Normal file
3
src/icons/thin/download.svg
Normal 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 |
38
src/qml/Chat/Timeline/EventFile.qml
Normal file
38
src/qml/Chat/Timeline/EventFile.qml
Normal 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 : ""
|
||||||
|
}
|
||||||
|
}
|
@ -3,7 +3,6 @@ import "../../Base"
|
|||||||
|
|
||||||
HImage {
|
HImage {
|
||||||
id: image
|
id: image
|
||||||
x: eventContent.spacing
|
|
||||||
sourceSize.width: theme.chat.message.thumbnailWidth
|
sourceSize.width: theme.chat.message.thumbnailWidth
|
||||||
sourceSize.height: theme.chat.message.thumbnailWidth
|
sourceSize.height: theme.chat.message.thumbnailWidth
|
||||||
width: Math.min(
|
width: Math.min(
|
||||||
|
@ -4,6 +4,7 @@ import "../../utils.js" as Utils
|
|||||||
|
|
||||||
HLoader {
|
HLoader {
|
||||||
id: loader
|
id: loader
|
||||||
|
x: eventContent.spacing
|
||||||
|
|
||||||
|
|
||||||
enum Type { Page, File, Image, Video, Audio }
|
enum Type { Page, File, Image, Video, Audio }
|
||||||
@ -56,10 +57,18 @@ HLoader {
|
|||||||
if (type === EventMediaLoader.Type.Image) {
|
if (type === EventMediaLoader.Type.Image) {
|
||||||
var file = "EventImage.qml"
|
var file = "EventImage.qml"
|
||||||
var props = { source: previewUrl, fullSource: mediaUrl }
|
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)
|
loader.setSource(file, props)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user