matrixion/qml/delegates/FileMessage.qml

80 lines
2.2 KiB
QML
Raw Normal View History

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