nheko/resources/qml/delegates/FileMessage.qml

97 lines
2.2 KiB
QML
Raw Normal View History

2021-03-05 00:35:15 +01:00
// SPDX-FileCopyrightText: 2021 Nheko Contributors
// SPDX-FileCopyrightText: 2022 Nheko Contributors
//
2021-03-05 00:35:15 +01:00
// SPDX-License-Identifier: GPL-3.0-or-later
2021-02-14 01:28:28 +01:00
import QtQuick 2.12
import QtQuick.Layouts 1.2
2020-06-24 16:24:22 +02:00
import im.nheko 1.0
2020-04-09 00:10:08 +02:00
Item {
required property string eventId
required property string filename
required property string filesize
2022-02-14 21:07:03 +01:00
height: row.height + (Settings.bubbles? 16: 24)
width: parent.width
2022-02-14 21:07:03 +01:00
implicitWidth: row.implicitWidth+metadataWidth
property int metadataWidth
property bool fitsMetadata: true
2020-10-08 21:11:21 +02:00
RowLayout {
id: row
anchors.centerIn: parent
2022-02-14 21:07:03 +01:00
width: parent.width - (Settings.bubbles? 16 : 24)
2020-10-08 21:11:21 +02:00
spacing: 15
Rectangle {
id: button
2021-05-13 08:23:56 +02:00
color: Nheko.colors.light
2020-10-08 21:11:21 +02:00
radius: 22
height: 44
width: 44
Image {
id: img
2022-01-02 23:17:23 +01:00
height: 40
width: 40
sourceSize.height: 40
sourceSize.width: 40
2020-10-08 21:11:21 +02:00
anchors.centerIn: parent
2021-11-14 02:23:10 +01:00
source: "qrc:/icons/icons/ui/download.svg"
2020-10-08 21:11:21 +02:00
fillMode: Image.Pad
}
2021-02-14 01:28:28 +01:00
TapHandler {
onSingleTapped: room.saveMedia(eventId)
2021-04-11 22:24:39 +02:00
gesturePolicy: TapHandler.ReleaseWithinBounds
2021-02-14 01:28:28 +01:00
}
CursorShape {
anchors.fill: parent
2020-10-08 21:11:21 +02:00
cursorShape: Qt.PointingHandCursor
}
}
ColumnLayout {
id: col
Text {
id: filename_
2020-10-08 21:11:21 +02:00
Layout.fillWidth: true
text: filename
2020-10-08 21:11:21 +02:00
textFormat: Text.PlainText
elide: Text.ElideRight
2021-05-13 08:23:56 +02:00
color: Nheko.colors.text
2020-10-08 21:11:21 +02:00
}
Text {
id: filesize_
2020-10-08 21:11:21 +02:00
Layout.fillWidth: true
text: filesize
2020-10-08 21:11:21 +02:00
textFormat: Text.PlainText
elide: Text.ElideRight
2021-05-13 08:23:56 +02:00
color: Nheko.colors.text
2020-10-08 21:11:21 +02:00
}
}
}
Rectangle {
2021-05-13 08:23:56 +02:00
color: Nheko.colors.alternateBase
2020-10-08 21:11:21 +02:00
z: -1
radius: 10
2022-02-14 14:03:17 +01:00
anchors.fill: parent
2022-02-14 21:07:03 +01:00
visible: !Settings.bubbles // the bubble in a bubble looks odd
2020-10-08 21:11:21 +02:00
}
2019-10-04 01:10:46 +02:00
}