summary refs log tree commit diff
path: root/resources/qml/delegates
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-11-11 21:32:38 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-11-11 21:32:38 +0100
commitb7b4fd0e9bd7c6a6ec0312014102c479264b3f0f (patch)
tree44f1fd371f43d3e7ab6f1503b220bb371c9ce01e /resources/qml/delegates
parentMake it possible to unhide the controls on mobile (diff)
downloadnheko-b7b4fd0e9bd7c6a6ec0312014102c479264b3f0f.tar.xz
Format qml
Diffstat (limited to 'resources/qml/delegates')
-rw-r--r--resources/qml/delegates/PlayableMediaMessage.qml56
1 files changed, 25 insertions, 31 deletions
diff --git a/resources/qml/delegates/PlayableMediaMessage.qml b/resources/qml/delegates/PlayableMediaMessage.qml
index 99c82a9b..c738e5b4 100644
--- a/resources/qml/delegates/PlayableMediaMessage.qml
+++ b/resources/qml/delegates/PlayableMediaMessage.qml
@@ -21,14 +21,13 @@ Item {
     required property string url
     required property string body
     required property string filesize
+    property double tempWidth: Math.min(parent ? parent.width : undefined, originalWidth < 1 ? 400 : originalWidth)
+    property double tempHeight: tempWidth * proportionalHeight
+    property double divisor: isReply ? 4 : 2
+    property bool tooHigh: tempHeight > timelineRoot.height / divisor
 
-        property double tempWidth: Math.min(parent ? parent.width : undefined, originalWidth < 1 ? 400 : originalWidth)
-        property double tempHeight: tempWidth * proportionalHeight
-        property double divisor: isReply ? 4 : 2
-        property bool tooHigh: tempHeight > timelineRoot.height / divisor
-
-        height: (type == MtxEvent.VideoMessage ? tooHigh ? timelineRoot.height / divisor : tempHeight : 80) + fileInfoLabel.height
-        width: type == MtxEvent.VideoMessage ? tooHigh ? (timelineRoot.height / divisor) / proportionalHeight : tempWidth : 250
+    height: (type == MtxEvent.VideoMessage ? tooHigh ? timelineRoot.height / divisor : tempHeight : 80) + fileInfoLabel.height
+    width: type == MtxEvent.VideoMessage ? tooHigh ? (timelineRoot.height / divisor) / proportionalHeight : tempWidth : 250
 
     MxcMedia {
         id: mxcmedia
@@ -44,16 +43,14 @@ Item {
 
     Rectangle {
         id: videoContainer
+
         color: type == MtxEvent.VideoMessage ? Nheko.colors.window : "transparent"
         width: parent.width
         height: parent.height - fileInfoLabel.height
 
-        
-    TapHandler {
-        onTapped: mediaControls.showControls();
-    }
-
-
+        TapHandler {
+            onTapped: mediaControls.showControls()
+        }
 
         Image {
             anchors.fill: parent
@@ -72,34 +69,31 @@ Item {
                 flushMode: VideoOutput.FirstFrame
             }
 
-
         }
 
     }
 
-            MediaControls {
-                id: mediaControls
-
-                anchors.left: content.left
-                anchors.right: content.right
-                anchors.bottom: fileInfoLabel.top
-
-                playingVideo: type == MtxEvent.VideoMessage
-                positionValue: mxcmedia.position
-                duration: mxcmedia.duration
-                mediaLoaded: mxcmedia.loaded
-                mediaState: mxcmedia.state
-                onPositionChanged: mxcmedia.position = position
-                onPlayPauseActivated: mxcmedia.state == MediaPlayer.PlayingState ? mxcmedia.pause() : mxcmedia.play()
-                onLoadActivated: mxcmedia.eventId = eventId
-            }
+    MediaControls {
+        id: mediaControls
+
+        anchors.left: content.left
+        anchors.right: content.right
+        anchors.bottom: fileInfoLabel.top
+        playingVideo: type == MtxEvent.VideoMessage
+        positionValue: mxcmedia.position
+        duration: mxcmedia.duration
+        mediaLoaded: mxcmedia.loaded
+        mediaState: mxcmedia.state
+        onPositionChanged: mxcmedia.position = position
+        onPlayPauseActivated: mxcmedia.state == MediaPlayer.PlayingState ? mxcmedia.pause() : mxcmedia.play()
+        onLoadActivated: mxcmedia.eventId = eventId
+    }
 
     // information about file name and file size
     Label {
         id: fileInfoLabel
 
         anchors.bottom: content.bottom
-
         text: body + " [" + filesize + "]"
         textFormat: Text.PlainText
         elide: Text.ElideRight