[UI] Added volume slider hiding when mouse not in area.
This commit is contained in:
parent
c8cf58df5f
commit
51508d96a4
|
@ -533,7 +533,6 @@ MpvPlayerBackend::handle_mpv_event(mpv_event* event)
|
||||||
}
|
}
|
||||||
} else if (strcmp(prop->name, "mute") == 0 ||
|
} else if (strcmp(prop->name, "mute") == 0 ||
|
||||||
strcmp(prop->name, "volume") == 0) {
|
strcmp(prop->name, "volume") == 0) {
|
||||||
return;
|
|
||||||
double volume = getProperty("volume").toDouble();
|
double volume = getProperty("volume").toDouble();
|
||||||
bool mute = getProperty("mute").toBool();
|
bool mute = getProperty("mute").toBool();
|
||||||
if (mute || volume == 0) {
|
if (mute || volume == 0) {
|
||||||
|
|
BIN
src/qml/UIComponents/.VolumeButton.qml.kate-swp
Normal file
BIN
src/qml/UIComponents/.VolumeButton.qml.kate-swp
Normal file
Binary file not shown.
|
@ -22,10 +22,8 @@ Button {
|
||||||
}
|
}
|
||||||
background: Item {
|
background: Item {
|
||||||
}
|
}
|
||||||
Connections {
|
|
||||||
target: player
|
function updateStatus(status) {
|
||||||
enabled: true
|
|
||||||
onVolumeStatusChanged: function (status) {
|
|
||||||
if (volumeButton == null)
|
if (volumeButton == null)
|
||||||
console.log("OwO")
|
console.log("OwO")
|
||||||
|
|
||||||
|
@ -37,5 +35,10 @@ Button {
|
||||||
volumeButton.icon.source = "qrc:/icons/" + appearance.themeName + "/volume-up.svg"
|
volumeButton.icon.source = "qrc:/icons/" + appearance.themeName + "/volume-up.svg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: player
|
||||||
|
enabled: true
|
||||||
|
onVolumeStatusChanged: updateStatus
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,19 @@ Item {
|
||||||
icon.width: parent.height / 2
|
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 {
|
VolumeButton {
|
||||||
id: volumeButton
|
id: volumeButton
|
||||||
anchors.left: playlistNextButton.right
|
anchors.left: playlistNextButton.right
|
||||||
|
@ -53,6 +66,8 @@ Item {
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
visible: mouseAreaVolumeArea.containsMouse || volumeButton.hovered
|
||||||
|
width: visible ? implicitWidth : 0
|
||||||
}
|
}
|
||||||
TimeLabel {
|
TimeLabel {
|
||||||
anchors.left: volumeSlider.right
|
anchors.left: volumeSlider.right
|
||||||
|
|
Loading…
Reference in a new issue