summary refs log tree commit diff
path: root/resources
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-11-11 19:56:51 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-11-11 19:56:51 +0100
commit435047b1baeb9a6fa33034f855393c0064f69b2c (patch)
treee23f32505cea22d7b4f299f723f8f0b3bd3251b5 /resources
parentCleanup positioning of player elements (diff)
downloadnheko-435047b1baeb9a6fa33034f855393c0064f69b2c.tar.xz
Make it possible to unhide the controls on mobile
Diffstat (limited to 'resources')
-rw-r--r--resources/qml/delegates/PlayableMediaMessage.qml6
-rw-r--r--resources/qml/ui/media/MediaControls.qml34
2 files changed, 21 insertions, 19 deletions
diff --git a/resources/qml/delegates/PlayableMediaMessage.qml b/resources/qml/delegates/PlayableMediaMessage.qml
index 67214dd7..99c82a9b 100644
--- a/resources/qml/delegates/PlayableMediaMessage.qml
+++ b/resources/qml/delegates/PlayableMediaMessage.qml
@@ -48,6 +48,12 @@ Item {
         width: parent.width
         height: parent.height - fileInfoLabel.height
 
+        
+    TapHandler {
+        onTapped: mediaControls.showControls();
+    }
+
+
 
         Image {
             anchors.fill: parent
diff --git a/resources/qml/ui/media/MediaControls.qml b/resources/qml/ui/media/MediaControls.qml
index f5321dca..00ccdd26 100644
--- a/resources/qml/ui/media/MediaControls.qml
+++ b/resources/qml/ui/media/MediaControls.qml
@@ -21,16 +21,21 @@ Rectangle {
     property var duration
     property var positionValue: 0
     property var position
-    property bool shouldShowControls: !playingVideo || playerMouseArea.shouldShowControls || volumeSlider.controlsVisible
+    property bool shouldShowControls: !playingVideo || playerMouseArea.shouldShowControls || volumeSlider.state == "shown"
     color: {
         var wc = Nheko.colors.alternateBase;
         return Qt.rgba(wc.r, wc.g, wc.b, 0.5);
     }
+    opacity: control.shouldShowControls ? 1 : 0
     height: controlLayout.implicitHeight
 
     signal playPauseActivated()
     signal loadActivated()
 
+    function showControls() {
+        controlHideTimer.restart();
+    }
+
     function durationToString(duration) {
         function maybeZeroPrepend(time) {
             return (time < 10) ? "0" + time.toString() : time.toString();
@@ -50,26 +55,18 @@ Rectangle {
         return hh + ":" + mm + ":" + ss;
     }
 
-    MouseArea {
+    HoverHandler {
         id: playerMouseArea
 
-        property bool shouldShowControls: (containsMouse && controlHideTimer.running) || (control.mediaState != MediaPlayer.PlayingState) || controlLayout.contains(mapToItem(controlLayout, mouseX, mouseY))
+        property bool shouldShowControls: hovered || controlHideTimer.running || control.mediaState != MediaPlayer.PlayingState
 
-        onClicked: {
-            control.mediaLoaded ? control.playPauseActivated() : control.loadActivated();
-        }
-        hoverEnabled: true
-        onPositionChanged: controlHideTimer.start()
-        onExited: controlHideTimer.start()
-        onEntered: controlHideTimer.start()
-        anchors.fill: control
-        propagateComposedEvents: true
+        onHoveredChanged: showControls();
     }
 
     ColumnLayout {
 
         id: controlLayout
-        opacity: control.shouldShowControls ? 1 : 0
+        enabled: control.shouldShowControls
 
         spacing: 0
         anchors.bottom: control.bottom
@@ -219,13 +216,12 @@ Rectangle {
 
         }
 
+    }
 
-        // Fade controls in/out
-        Behavior on opacity {
-            OpacityAnimator {
-                duration: 100
-            }
-
+    // Fade controls in/out
+    Behavior on opacity {
+        OpacityAnimator {
+            duration: 100
         }
 
     }