Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F140024
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/contents/ui/Bubble.qml b/src/contents/ui/Bubble.qml
index 4924278..7615f2c 100644
--- a/src/contents/ui/Bubble.qml
+++ b/src/contents/ui/Bubble.qml
@@ -1,33 +1,50 @@
/*
* This file is part of kazv.
* SPDX-FileCopyrightText: 2020-2021 Tusooa Zhu <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import QtQuick 2.2
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import org.kde.kirigami 2.13 as Kirigami
+import '.' as Kazv
+
Kirigami.AbstractCard {
id: upper
default property var children
+ property var kazvIO
+ property var url
+
readonly property var bubbleSpacing: leftPadding + rightPadding
Layout.fillWidth: false
contentItem: RowLayout {
anchors.left: parent.left
anchors.right: parent.right
property var encryptedIcon: Kirigami.Icon {
source: 'emblem-encrypted-locked'
Layout.preferredHeight: inlineBadgeSize
Layout.preferredWidth: inlineBadgeSize
}
data: [
...(event && event.encrypted ? [encryptedIcon] : []),
...(Array.isArray(upper.children) ? upper.children :
upper.children ? [upper.children] : [])
]
}
+
+ property var menu: Kazv.MediaFileMenu {
+ kazvIO: upper.kazvIO
+ url: upper.url
+ onStartDownload: {
+ progressBar.visible = true
+ }
+ }
+
+ property var progressBar: Kazv.ProgressBar {
+ kazvIO: upper.kazvIO
+ }
}
diff --git a/src/contents/ui/ProgressBar.qml b/src/contents/ui/ProgressBar.qml
index 497bc04..b475ab0 100644
--- a/src/contents/ui/ProgressBar.qml
+++ b/src/contents/ui/ProgressBar.qml
@@ -1,52 +1,57 @@
/*
* This file is part of kazv.
* SPDX-FileCopyrightText: 2020 Tusooa Zhu <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.13 as Kirigami
import moe.kazv.mxc.kazv 0.0 as MK
RowLayout {
id: progressBarLayout
property var kazvIO
visible: false
Layout.preferredWidth: image.width
ProgressBar {
id: progressBar
Layout.fillWidth: true
value: kazvIO.progress
}
Kirigami.Action {
id: pauseAction
iconName: "media-playback-pause"
property var suspended: false
onTriggered: {
if (suspended) {
+ suspended = false
kazvIO.resume()
} else {
kazvIO.suspend()
suspended = true
+ iconName: "media-playback-start"
+ pauseBtn.icon.name = "media-playback-start"
}
}
}
Kirigami.Action {
id: cancelAction
iconName: "dialog-cancel"
onTriggered: {
+ pauseAction.suspended = false
kazvIO.cancel()
}
}
RoundButton {
+ id: pauseBtn
icon.name: "media-playback-pause"
onClicked: pauseAction.trigger()
}
RoundButton {
icon.name: "dialog-cancel"
onClicked: cancelAction.trigger()
}
}
diff --git a/src/contents/ui/event-types/Image.qml b/src/contents/ui/event-types/Image.qml
index 8c95e0e..f147a70 100644
--- a/src/contents/ui/event-types/Image.qml
+++ b/src/contents/ui/event-types/Image.qml
@@ -1,70 +1,68 @@
/*
* This file is part of kazv.
* SPDX-FileCopyrightText: 2020-2021 Tusooa Zhu <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import moe.kazv.mxc.kazv 0.0 as MK
import org.kde.kirigami 2.13 as Kirigami
import '..' as Kazv
Simple {
id: upper
property var gender: 'neutral'
property var body: event.content.body
property var mxcUri: event.content.url
property var imageUri: matrixSdk.mxcUriToHttp(mxcUri)
property var imageInfo: event.content.info || {}
property var imageWidth: image.implicitWidth || imageInfo.w || 1 // lest we divide by 0
property var imageHeight: image.implicitHeight || imageInfo.h || 1
property var innerContentWidth: upper.contentMaxWidth - bubble.bubbleSpacing
property var kazvIO: MK.KazvIO {
url: imageUri
manager: root.kazvIOManager
onResult: {
- progressBar.visible = false
+ bubble.progressBar.visible = false
}
}
Kazv.Bubble {
id: bubble
- ColumnLayout {
- id: layout
- Label {
- Layout.fillWidth: false
- Layout.maximumWidth: innerContentWidth
- wrapMode: Text.Wrap
+ kazvIO: upper.kazvIO
+ url: upper.imageUri
- text: l10n.get('event-message-image-sent', { gender, body })
- }
- Image {
- id: image
- source: imageUri
- Layout.maximumWidth: innerContentWidth
- Layout.preferredWidth: imageWidth
- Layout.preferredHeight: imageHeight / imageWidth * width
- fillMode: Image.PreserveAspectFit
+ property var label: Label {
+ Layout.fillWidth: false
+ Layout.maximumWidth: innerContentWidth
+ wrapMode: Text.Wrap
+
+ text: l10n.get('event-message-image-sent', { gender, body })
+ }
- Kazv.MediaFileMenu {
- kazvIO: upper.kazvIO
- url: imageUri
- onStartDownload: {
- progressBar.visible = true
- }
- }
- }
- Kazv.ProgressBar {
- id: progressBar
- kazvIO: upper.kazvIO
- }
+ property var image: Image {
+ id: image
+ source: imageUri
+ Layout.maximumWidth: innerContentWidth
+ Layout.preferredWidth: imageWidth
+ Layout.preferredHeight: imageHeight / imageWidth * width
+ fillMode: Image.PreserveAspectFit
+ data: [bubble.menu]
+ }
+ ColumnLayout {
+ id: layout
+ data: [
+ bubble.label,
+ bubble.image,
+ bubble.progressBar
+ ]
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Jan 19, 10:22 AM (3 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
55102
Default Alt Text
(5 KB)
Attached To
Mode
rK kazv
Attached
Detach File
Event Timeline
Log In to Comment