mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-29 14:18:49 +03:00
Make it possible to unhide the controls on mobile
This commit is contained in:
parent
ffc60180de
commit
435047b1ba
2 changed files with 21 additions and 19 deletions
|
@ -49,6 +49,12 @@ Item {
|
||||||
height: parent.height - fileInfoLabel.height
|
height: parent.height - fileInfoLabel.height
|
||||||
|
|
||||||
|
|
||||||
|
TapHandler {
|
||||||
|
onTapped: mediaControls.showControls();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: thumbnailUrl.replace("mxc://", "image://MxcImage/")
|
source: thumbnailUrl.replace("mxc://", "image://MxcImage/")
|
||||||
|
|
|
@ -21,16 +21,21 @@ Rectangle {
|
||||||
property var duration
|
property var duration
|
||||||
property var positionValue: 0
|
property var positionValue: 0
|
||||||
property var position
|
property var position
|
||||||
property bool shouldShowControls: !playingVideo || playerMouseArea.shouldShowControls || volumeSlider.controlsVisible
|
property bool shouldShowControls: !playingVideo || playerMouseArea.shouldShowControls || volumeSlider.state == "shown"
|
||||||
color: {
|
color: {
|
||||||
var wc = Nheko.colors.alternateBase;
|
var wc = Nheko.colors.alternateBase;
|
||||||
return Qt.rgba(wc.r, wc.g, wc.b, 0.5);
|
return Qt.rgba(wc.r, wc.g, wc.b, 0.5);
|
||||||
}
|
}
|
||||||
|
opacity: control.shouldShowControls ? 1 : 0
|
||||||
height: controlLayout.implicitHeight
|
height: controlLayout.implicitHeight
|
||||||
|
|
||||||
signal playPauseActivated()
|
signal playPauseActivated()
|
||||||
signal loadActivated()
|
signal loadActivated()
|
||||||
|
|
||||||
|
function showControls() {
|
||||||
|
controlHideTimer.restart();
|
||||||
|
}
|
||||||
|
|
||||||
function durationToString(duration) {
|
function durationToString(duration) {
|
||||||
function maybeZeroPrepend(time) {
|
function maybeZeroPrepend(time) {
|
||||||
return (time < 10) ? "0" + time.toString() : time.toString();
|
return (time < 10) ? "0" + time.toString() : time.toString();
|
||||||
|
@ -50,26 +55,18 @@ Rectangle {
|
||||||
return hh + ":" + mm + ":" + ss;
|
return hh + ":" + mm + ":" + ss;
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
HoverHandler {
|
||||||
id: playerMouseArea
|
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: {
|
onHoveredChanged: showControls();
|
||||||
control.mediaLoaded ? control.playPauseActivated() : control.loadActivated();
|
|
||||||
}
|
|
||||||
hoverEnabled: true
|
|
||||||
onPositionChanged: controlHideTimer.start()
|
|
||||||
onExited: controlHideTimer.start()
|
|
||||||
onEntered: controlHideTimer.start()
|
|
||||||
anchors.fill: control
|
|
||||||
propagateComposedEvents: true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
|
||||||
id: controlLayout
|
id: controlLayout
|
||||||
opacity: control.shouldShowControls ? 1 : 0
|
enabled: control.shouldShowControls
|
||||||
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
anchors.bottom: control.bottom
|
anchors.bottom: control.bottom
|
||||||
|
@ -219,13 +216,12 @@ Rectangle {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Fade controls in/out
|
// Fade controls in/out
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
OpacityAnimator {
|
OpacityAnimator {
|
||||||
duration: 100
|
duration: 100
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue