2018-12-22 14:07:44 +00:00
|
|
|
import QtQuick 2.0
|
2018-12-22 14:13:53 +00:00
|
|
|
import QtQuick.Controls 2.3
|
2020-05-02 12:35:56 +01:00
|
|
|
import player 1.0
|
2018-11-28 18:41:54 +00:00
|
|
|
|
2018-11-29 08:25:54 +00:00
|
|
|
Slider {
|
2020-05-06 12:43:01 +01:00
|
|
|
id: volumeBar
|
|
|
|
to: 100
|
|
|
|
value: 100
|
|
|
|
palette.dark: "#f00"
|
|
|
|
hoverEnabled: true
|
2018-11-28 18:41:54 +00:00
|
|
|
|
2020-05-06 12:43:01 +01:00
|
|
|
implicitWidth: Math.max(
|
|
|
|
background ? background.implicitWidth : 0,
|
|
|
|
(handle ? handle.implicitWidth : 0) + leftPadding + rightPadding)
|
|
|
|
implicitHeight: Math.max(
|
|
|
|
background ? background.implicitHeight : 0,
|
|
|
|
(handle ? handle.implicitHeight : 0) + topPadding + bottomPadding)
|
|
|
|
onMoved: {
|
|
|
|
player.playerCommand(Enums.Commands.SetVolume,
|
|
|
|
Math.round(volumeBar.value).toString())
|
|
|
|
}
|
|
|
|
Connections {
|
|
|
|
target: player
|
|
|
|
onVolumeChanged: function (volume) {
|
|
|
|
volumeBar.value = volume
|
2018-11-29 08:25:54 +00:00
|
|
|
}
|
2020-05-06 12:43:01 +01:00
|
|
|
}
|
|
|
|
handle: Rectangle {
|
|
|
|
x: volumeBar.leftPadding + volumeBar.visualPosition * (volumeBar.availableWidth - width)
|
|
|
|
y: volumeBar.topPadding + volumeBar.availableHeight / 2 - height / 2
|
|
|
|
implicitWidth: height
|
|
|
|
implicitHeight: layout.height / 2.6
|
|
|
|
radius: height
|
|
|
|
visible: appearance.themeName == "Niconico" ? false : true
|
|
|
|
color: "#f6f6f6"
|
|
|
|
border.color: "#f6f6f6"
|
|
|
|
}
|
2018-11-28 18:41:54 +00:00
|
|
|
|
2020-05-06 12:43:01 +01:00
|
|
|
background: Rectangle {
|
|
|
|
x: volumeBar.leftPadding
|
|
|
|
y: volumeBar.topPadding + volumeBar.availableHeight / 2 - height / 2
|
|
|
|
implicitWidth: layout.width / 11
|
|
|
|
implicitHeight: appearance.themeName == "Niconico" ? layout.height / 6 : layout.height / 10
|
|
|
|
width: volumeBar.availableWidth
|
|
|
|
height: implicitHeight
|
|
|
|
color: getAppearanceValueForTheme(appearance.themeName,
|
|
|
|
"progressBackgroundColor")
|
|
|
|
Rectangle {
|
|
|
|
width: volumeBar.visualPosition * parent.width
|
|
|
|
height: parent.height
|
|
|
|
color: getAppearanceValueForTheme(appearance.themeName,
|
|
|
|
"volumeSliderBackground")
|
|
|
|
}
|
2020-05-03 18:06:06 +01:00
|
|
|
|
|
|
|
MouseArea {
|
2020-05-06 12:43:01 +01:00
|
|
|
acceptedButtons: Qt.NoButton
|
|
|
|
z: 10
|
|
|
|
anchors.fill: parent
|
|
|
|
propagateComposedEvents: true
|
|
|
|
onWheel: {
|
|
|
|
if (wheel.angleDelta.y < 0) {
|
|
|
|
volumeBar.value -= 5
|
|
|
|
} else {
|
|
|
|
volumeBar.value += 5
|
2020-05-03 18:06:06 +01:00
|
|
|
}
|
2020-05-06 12:43:01 +01:00
|
|
|
}
|
2020-05-03 18:06:06 +01:00
|
|
|
}
|
2020-05-06 12:43:01 +01:00
|
|
|
}
|
2018-11-29 08:25:54 +00:00
|
|
|
}
|