Commit a76d2377 authored by Shantanu Tushar's avatar Shantanu Tushar
Browse files

Implement change volume on mouse wheel when top of the voulume icon.

Patch by Rukshan Chathuranga <rcrukshan17@gmail.com>.
Welcome to KDE :)

REVIEW: 116517
BUG: 322821
parent 618dbc09
......@@ -20,6 +20,7 @@
import QtQuick 1.1
import org.kde.plasma.core 0.1 as PlasmaCore
import org.kde.plasma.components 0.1 as PlasmaComponents
import org.kde.qtextracomponents 0.1 as QtExtraComponents
FocusScope {
id: controlBarFrame
......@@ -153,10 +154,11 @@ FocusScope {
}
}
PlasmaComponents.Slider {
id: volumeSlider
height: parent.height
width: volumeButton.checked ? parent.width * 0.1 : 1
width: volumeButton.checked ? parent.width * 0.1 : 1
visible: volumeButton.checked
minimumValue: 0
maximumValue: 100
......@@ -177,6 +179,7 @@ FocusScope {
}
}
PlasmaComponents.ToolButton {
id: volumeButton
width: parent.height
......@@ -190,6 +193,25 @@ FocusScope {
else "audio-volume-high"
}
checkable: true
QtExtraComponents.MouseEventListener {
anchors.fill: parent
onReleased: {
volumeButton.checked=!volumeButton.checked
}
onWheelMoved: {
if (wheel.delta < 0) {
volumeSlider.value=volumeSlider.value-3;
runtimeDataObject.volume=volumeSlider.value/100
} else {
volumeSlider.value=volumeSlider.value+3;
runtimeDataObject.volume=volumeSlider.value/100
}
}
}
}
PlasmaComponents.ToolButton {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment