summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2022-03-21 00:48:27 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2022-03-21 00:48:27 +0100
commitfd83858715dfde7ad61284200821c0357d68ebf8 (patch)
tree4cbee7e3ef8d97d00f1d7280b6587c5ffc44f16f /resources/qml
parentMove uploads to InputBar (diff)
downloadnheko-fd83858715dfde7ad61284200821c0357d68ebf8.tar.xz
Add duration and resolution to files
Diffstat (limited to 'resources/qml')
-rw-r--r--resources/qml/MessageView.qml2
-rw-r--r--resources/qml/TimelineRow.qml3
-rw-r--r--resources/qml/delegates/MessageDelegate.qml3
-rw-r--r--resources/qml/delegates/PlayableMediaMessage.qml3
-rw-r--r--resources/qml/delegates/Reply.qml2
-rw-r--r--resources/qml/ui/media/MediaControls.qml2
6 files changed, 13 insertions, 2 deletions
diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml
index 4fce9a75..bbe61ee9 100644
--- a/resources/qml/MessageView.qml
+++ b/resources/qml/MessageView.qml
@@ -376,6 +376,7 @@ Item {
             required property string filesize
             required property string url
             required property string thumbnailUrl
+            required property string duration
             required property bool isOnlyEmoji
             required property bool isSender
             required property bool isEncrypted
@@ -492,6 +493,7 @@ Item {
                 filesize: wrapper.filesize
                 url: wrapper.url
                 thumbnailUrl: wrapper.thumbnailUrl
+                duration: wrapper.duration
                 isOnlyEmoji: wrapper.isOnlyEmoji
                 isSender: wrapper.isSender
                 isEncrypted: wrapper.isEncrypted
diff --git a/resources/qml/TimelineRow.qml b/resources/qml/TimelineRow.qml
index bb6514d1..032821ba 100644
--- a/resources/qml/TimelineRow.qml
+++ b/resources/qml/TimelineRow.qml
@@ -41,6 +41,7 @@ Item {
     required property var reactions
     required property int trustlevel
     required property int encryptionError
+    required property int duration
     required property var timestamp
     required property int status
     required property int relatedEventCacheBuster
@@ -128,6 +129,7 @@ Item {
                 userId: r.relatedEventCacheBuster, fromModel(Room.UserId) ?? ""
                 userName: r.relatedEventCacheBuster, fromModel(Room.UserName) ?? ""
                 thumbnailUrl: r.relatedEventCacheBuster, fromModel(Room.ThumbnailUrl) ?? ""
+                duration: r.relatedEventCacheBuster, fromModel(Room.Duration) ?? ""
                 roomTopic: r.relatedEventCacheBuster, fromModel(Room.RoomTopic) ?? ""
                 roomName: r.relatedEventCacheBuster, fromModel(Room.RoomName) ?? ""
                 callType: r.relatedEventCacheBuster, fromModel(Room.CallType) ?? ""
@@ -154,6 +156,7 @@ Item {
                 typeString: r.typeString ?? ""
                 url: r.url
                 thumbnailUrl: r.thumbnailUrl
+                duration: r.duration
                 originalWidth: r.originalWidth
                 isOnlyEmoji: r.isOnlyEmoji
                 isStateEvent: r.isStateEvent
diff --git a/resources/qml/delegates/MessageDelegate.qml b/resources/qml/delegates/MessageDelegate.qml
index 08b2098e..0e211ded 100644
--- a/resources/qml/delegates/MessageDelegate.qml
+++ b/resources/qml/delegates/MessageDelegate.qml
@@ -18,6 +18,7 @@ Item {
     required property int type
     required property string typeString
     required property int originalWidth
+    required property int duration
     required property string blurhash
     required property string body
     required property string formattedBody
@@ -161,6 +162,7 @@ Item {
                 url: d.url
                 body: d.body
                 filesize: d.filesize
+                duration: d.duration
                 metadataWidth: d.metadataWidth
             }
 
@@ -178,6 +180,7 @@ Item {
                 url: d.url
                 body: d.body
                 filesize: d.filesize
+                duration: d.duration
                 metadataWidth: d.metadataWidth
             }
 
diff --git a/resources/qml/delegates/PlayableMediaMessage.qml b/resources/qml/delegates/PlayableMediaMessage.qml
index 5d7beaad..40572704 100644
--- a/resources/qml/delegates/PlayableMediaMessage.qml
+++ b/resources/qml/delegates/PlayableMediaMessage.qml
@@ -17,6 +17,7 @@ Item {
     required property double proportionalHeight
     required property int type
     required property int originalWidth
+    required property int duration
     required property string thumbnailUrl
     required property string eventId
     required property string url
@@ -85,7 +86,7 @@ Item {
         anchors.bottom: fileInfoLabel.top
         playingVideo: type == MtxEvent.VideoMessage
         positionValue: mxcmedia.position
-        duration: mxcmedia.duration
+        duration: mediaLoaded ? mxcmedia.duration : content.duration
         mediaLoaded: mxcmedia.loaded
         mediaState: mxcmedia.state
         onPositionChanged: mxcmedia.position = position
diff --git a/resources/qml/delegates/Reply.qml b/resources/qml/delegates/Reply.qml
index 513b7c0b..27fb4e07 100644
--- a/resources/qml/delegates/Reply.qml
+++ b/resources/qml/delegates/Reply.qml
@@ -34,6 +34,7 @@ Item {
     property string roomTopic
     property string roomName
     property string callType
+    property int duration
     property int encryptionError
     property int relatedEventCacheBuster
     property int maxWidth
@@ -112,6 +113,7 @@ Item {
             typeString: r.typeString ?? ""
             url: r.url
             thumbnailUrl: r.thumbnailUrl
+            duration: r.duration
             originalWidth: r.originalWidth
             isOnlyEmoji: r.isOnlyEmoji
             isStateEvent: r.isStateEvent
diff --git a/resources/qml/ui/media/MediaControls.qml b/resources/qml/ui/media/MediaControls.qml
index 1844af73..d73957ee 100644
--- a/resources/qml/ui/media/MediaControls.qml
+++ b/resources/qml/ui/media/MediaControls.qml
@@ -214,7 +214,7 @@ Rectangle {
 
             Label {
                 Layout.alignment: Qt.AlignRight
-                text: (!control.mediaLoaded) ? "-- / --" : (durationToString(control.positionValue) + " / " + durationToString(control.duration))
+                text: (!control.mediaLoaded ? "-- " : durationToString(control.positionValue)) + " / " + durationToString(control.duration)
                 color: Nheko.colors.text
             }