2023-02-22 01:48:49 +03:00
|
|
|
// SPDX-FileCopyrightText: Nheko Contributors
|
2021-03-07 07:57:56 +03:00
|
|
|
//
|
2021-03-05 02:35:15 +03:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-08-13 12:30:41 +03:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import QtQuick.Controls
|
|
|
|
import im.nheko
|
|
|
|
|
|
|
|
Control {
|
|
|
|
id: evRoot
|
2020-06-24 17:24:22 +03:00
|
|
|
|
2021-07-12 01:24:33 +03:00
|
|
|
required property string eventId
|
|
|
|
required property string filename
|
|
|
|
required property string filesize
|
|
|
|
|
2023-08-13 12:30:41 +03:00
|
|
|
padding: Settings.bubbles? 8 : 12
|
|
|
|
//Layout.preferredHeight: rowa.implicitHeight + padding
|
|
|
|
//Layout.maximumWidth: rowa.Layout.maximumWidth + metadataWidth + padding
|
|
|
|
property int metadataWidth: 0
|
|
|
|
property bool fitsMetadata: false
|
|
|
|
|
|
|
|
Layout.maximumWidth: rowa.Layout.maximumWidth + padding * 2
|
2020-10-08 22:11:21 +03:00
|
|
|
|
2023-08-13 12:30:41 +03:00
|
|
|
contentItem: RowLayout {
|
2023-06-06 01:29:46 +03:00
|
|
|
id: rowa
|
2020-10-08 22:11:21 +03:00
|
|
|
|
2023-08-13 12:30:41 +03:00
|
|
|
spacing: 16
|
2020-10-08 22:11:21 +03:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: button
|
|
|
|
|
2023-06-02 02:29:05 +03:00
|
|
|
color: palette.light
|
2020-10-08 22:11:21 +03:00
|
|
|
radius: 22
|
2023-10-26 02:51:45 +03:00
|
|
|
Layout.preferredHeight: 44
|
|
|
|
Layout.preferredWidth: 44
|
2020-10-08 22:11:21 +03:00
|
|
|
|
|
|
|
Image {
|
|
|
|
id: img
|
|
|
|
|
2022-01-03 01:17:23 +03:00
|
|
|
height: 40
|
|
|
|
width: 40
|
|
|
|
sourceSize.height: 40
|
|
|
|
sourceSize.width: 40
|
|
|
|
|
2020-10-08 22:11:21 +03:00
|
|
|
anchors.centerIn: parent
|
2021-11-14 04:23:10 +03:00
|
|
|
source: "qrc:/icons/icons/ui/download.svg"
|
2020-10-08 22:11:21 +03:00
|
|
|
fillMode: Image.Pad
|
|
|
|
}
|
|
|
|
|
2021-02-14 03:28:28 +03:00
|
|
|
TapHandler {
|
2021-07-12 01:24:33 +03:00
|
|
|
onSingleTapped: room.saveMedia(eventId)
|
2021-04-11 23:24:39 +03:00
|
|
|
gesturePolicy: TapHandler.ReleaseWithinBounds
|
2021-02-14 03:28:28 +03:00
|
|
|
}
|
|
|
|
|
2023-06-19 02:38:40 +03:00
|
|
|
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 {
|
2021-07-12 01:24:33 +03:00
|
|
|
id: filename_
|
2020-10-08 22:11:21 +03:00
|
|
|
|
|
|
|
Layout.fillWidth: true
|
2023-08-13 12:30:41 +03:00
|
|
|
Layout.maximumWidth: implicitWidth + 1
|
2023-10-26 02:51:45 +03:00
|
|
|
text: evRoot.filename
|
2020-10-08 22:11:21 +03:00
|
|
|
textFormat: Text.PlainText
|
|
|
|
elide: Text.ElideRight
|
2023-06-02 02:29:05 +03:00
|
|
|
color: palette.text
|
2020-10-08 22:11:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
2021-07-12 01:24:33 +03:00
|
|
|
id: filesize_
|
2020-10-08 22:11:21 +03:00
|
|
|
|
|
|
|
Layout.fillWidth: true
|
2023-08-13 12:30:41 +03:00
|
|
|
Layout.maximumWidth: implicitWidth + 1
|
2023-10-26 02:51:45 +03:00
|
|
|
text: evRoot.filesize
|
2020-10-08 22:11:21 +03:00
|
|
|
textFormat: Text.PlainText
|
|
|
|
elide: Text.ElideRight
|
2023-06-02 02:29:05 +03:00
|
|
|
color: palette.text
|
2020-10-08 22:11:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-08-13 12:30:41 +03:00
|
|
|
background: Rectangle {
|
2023-06-02 02:29:05 +03:00
|
|
|
color: palette.alternateBase
|
2023-08-13 12:30:41 +03:00
|
|
|
radius: fontMetrics.lineSpacing / 2 + 2 * Nheko.paddingSmall
|
2022-02-14 23:07:03 +03:00
|
|
|
visible: !Settings.bubbles // the bubble in a bubble looks odd
|
2020-10-08 22:11:21 +03:00
|
|
|
}
|
2020-04-09 00:38:58 +03:00
|
|
|
|
2019-10-04 02:10:46 +03:00
|
|
|
}
|