1
0
Fork 0

[UI] Added volume slider hiding when mouse not in area.

This commit is contained in:
NamedKitten 2018-12-05 12:13:28 +00:00
parent c8cf58df5f
commit 51508d96a4
4 changed files with 22 additions and 5 deletions

View file

@ -533,7 +533,6 @@ MpvPlayerBackend::handle_mpv_event(mpv_event* event)
}
} else if (strcmp(prop->name, "mute") == 0 ||
strcmp(prop->name, "volume") == 0) {
return;
double volume = getProperty("volume").toDouble();
bool mute = getProperty("mute").toBool();
if (mute || volume == 0) {

Binary file not shown.

View file

@ -22,10 +22,8 @@ Button {
}
background: Item {
}
Connections {
target: player
enabled: true
onVolumeStatusChanged: function (status) {
function updateStatus(status) {
if (volumeButton == null)
console.log("OwO")
@ -37,5 +35,10 @@ Button {
volumeButton.icon.source = "qrc:/icons/" + appearance.themeName + "/volume-up.svg"
}
}
Connections {
target: player
enabled: true
onVolumeStatusChanged: updateStatus
}
}

View file

@ -39,6 +39,19 @@ Item {
icon.width: parent.height / 2
}
MouseArea {
id: mouseAreaVolumeArea
anchors.bottom: parent.bottom
anchors.left: volumeButton.left
anchors.right: volumeSlider.right
anchors.top: parent.top
width: volumeButton.width
+ (volumeSlider.visible ? volumeSlider.width : 0)
hoverEnabled: true
propagateComposedEvents: true
acceptedButtons: Qt.NoButton
}
VolumeButton {
id: volumeButton
anchors.left: playlistNextButton.right
@ -53,6 +66,8 @@ Item {
anchors.top: parent.top
anchors.bottom: parent.bottom
height: parent.height
visible: mouseAreaVolumeArea.containsMouse || volumeButton.hovered
width: visible ? implicitWidth : 0
}
TimeLabel {
anchors.left: volumeSlider.right