<div dir="ltr">My bad, I'll add it right now</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 17, 2019 at 8:41 PM <<a href="mailto:pierre@videolabs.io">pierre@videolabs.io</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
License header is missing in VolumeWidget.qml<br>
<br>
On 2019-06-17 16:55, Rohan Rajpal wrote:<br>
> Add the volume widget for the player controlbar<br>
> ---<br>
>  modules/gui/qt/Makefile.am                   |   1 +<br>
>  modules/gui/qt/qml/player/ControlButtons.qml |   5 +<br>
>  modules/gui/qt/qml/player/VolumeWidget.qml   | 138 +++++++++++++++++++<br>
>  modules/gui/qt/qml/style/VLCColors.qml       |   5 +<br>
>  modules/gui/qt/vlc.qrc                       |   1 +<br>
>  5 files changed, 150 insertions(+)<br>
>  create mode 100644 modules/gui/qt/qml/player/VolumeWidget.qml<br>
> <br>
> diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am<br>
> index d48f469132..1503a93000 100644<br>
> --- a/modules/gui/qt/Makefile.am<br>
> +++ b/modules/gui/qt/Makefile.am<br>
> @@ -536,6 +536,7 @@ libqt_plugin_la_QML = \<br>
>       gui/qt/qml/player/TrackSelector.qml \<br>
>       gui/qt/qml/player/ControlBar.qml \<br>
>       gui/qt/qml/player/ControlButtons.qml \<br>
> +     gui/qt/qml/player/VolumeWidget.qml \<br>
>       gui/qt/qml/player/ModalControlBar.qml \<br>
>       gui/qt/qml/player/SliderBar.qml \<br>
>       gui/qt/qml/dialogs/Dialogs.qml \<br>
> diff --git a/modules/gui/qt/qml/player/ControlButtons.qml<br>
> b/modules/gui/qt/qml/player/ControlButtons.qml<br>
> index 8b8c05439e..a293d8d386 100644<br>
> --- a/modules/gui/qt/qml/player/ControlButtons.qml<br>
> +++ b/modules/gui/qt/qml/player/ControlButtons.qml<br>
> @@ -55,6 +55,7 @@ Item{<br>
>          case PlayerControlBarModel.SKIP_FW_BUTTON: return <br>
> stepFwdBtnDelegate<br>
>          case PlayerControlBarModel.SKIP_BACK_BUTTON: return <br>
> stepBackBtnDelegate<br>
>          case PlayerControlBarModel.QUIT_BUTTON: return quitBtnDelegate<br>
> +        case PlayerControlBarModel.VOLUME: return volumeBtnDelegate<br>
>          }<br>
>          console.log("button delegate id " + inpID +  " doesn't <br>
> exists")<br>
>          return spacerDelegate<br>
> @@ -389,4 +390,8 @@ Item{<br>
>          }<br>
>      }<br>
> <br>
> +    Component{<br>
> +        id: volumeBtnDelegate<br>
> +        VolumeWidget{}<br>
> +    }<br>
>  }<br>
> diff --git a/modules/gui/qt/qml/player/VolumeWidget.qml<br>
> b/modules/gui/qt/qml/player/VolumeWidget.qml<br>
> new file mode 100644<br>
> index 0000000000..a49131ee68<br>
> --- /dev/null<br>
> +++ b/modules/gui/qt/qml/player/VolumeWidget.qml<br>
> @@ -0,0 +1,138 @@<br>
> +import QtQuick 2.11<br>
> +import QtQuick.Layouts 1.3<br>
> +import QtQuick.Controls 2.4<br>
> +import QtGraphicalEffects 1.0<br>
> +<br>
> +import "qrc:///utils/" as Utils<br>
> +import "qrc:///style/"<br>
> +<br>
> +FocusScope{<br>
> +    id: widgetfscope<br>
> +    x: volumeWidget.x<br>
> +    y: volumeWidget.y<br>
> +    width: volumeWidget.width<br>
> +    height: volumeWidget.height<br>
> +<br>
> +    property bool acceptFocus: true<br>
> +<br>
> +    RowLayout{<br>
> +        id: volumeWidget<br>
> +        Utils.IconToolButton{<br>
> +            id: volumeBtn<br>
> +            size: VLCStyle.icon_normal<br>
> +            text:<br>
> +                if( player.muted )<br>
> +                    VLCIcons.volume_muted<br>
> +                else if ( player.volume < .33 )<br>
> +                    VLCIcons.volume_low<br>
> +                else if( player.volume <= .66 )<br>
> +                    VLCIcons.volume_medium<br>
> +                else<br>
> +                    VLCIcons.volume_high<br>
> +            onClicked: player.muted = !player.muted<br>
> +            KeyNavigation.right: volControl<br>
> +        }<br>
> +<br>
> +        Slider<br>
> +        {<br>
> +            id: volControl<br>
> +            width: 100 * scale<br>
> +            height: parent.height<br>
> +<br>
> +            anchors.margins: 5 * scale<br>
> +            from: 0<br>
> +            to: maxvolpos<br>
> +            stepSize: 0.05<br>
> +            value: player.volume<br>
> +            opacity: player.muted ? 0.5 : 1<br>
> +            focus: true<br>
> +<br>
> +            Keys.onSpacePressed: player.muted = !player.muted<br>
> +            Keys.onUpPressed: volControl.increase()<br>
> +            Keys.onDownPressed: volControl.decrease()<br>
> +            Keys.onRightPressed:<br>
> widgetfscope.KeyNavigation.right.forceActiveFocus()<br>
> +            Keys.onLeftPressed:<br>
> widgetfscope.KeyNavigation.left.forceActiveFocus()<br>
> +<br>
> +            property color sliderColor: (volControl.position ><br>
> fullvolpos) ? VLCStyle.colors.volmax : VLCStyle.colors.buttonText<br>
> +            property int maxvol: 125<br>
> +            property double fullvolpos: 100 / maxvol<br>
> +            property double maxvolpos: maxvol / 100<br>
> +<br>
> +            onValueChanged: {<br>
> +                if (player.muted) player.muted = false<br>
> +                player.volume = volControl.value<br>
> +            }<br>
> +<br>
> +            background: Rectangle {<br>
> +                x: volControl.leftPadding<br>
> +                y: volControl.topPadding + volControl.availableHeight<br>
> / 2 - height / 2<br>
> +                implicitWidth: parent.width<br>
> +                implicitHeight: 4 * scale<br>
> +                radius: 4 * scale<br>
> +                color: VLCStyle.colors.volsliderbg<br>
> +<br>
> +                MouseArea {<br>
> +                    id: sliderMouseArea<br>
> +                    property bool isEntered: false<br>
> +<br>
> +                    width: parent.width<br>
> +                    height: parent.height + 60<br>
> +                    anchors.verticalCenter: parent.verticalCenter<br>
> +                    hoverEnabled: true<br>
> +<br>
> +                    onPressed: function (event) {<br>
> +                        volControl.forceActiveFocus()<br>
> +                        volControl.value = volControl.maxvolpos *<br>
> event.x / (volControl.width)<br>
> +                    }<br>
> +                    onPositionChanged: function (event) {<br>
> +                        if(pressed)<br>
> +                            volControl.value = volControl.maxvolpos *<br>
> event.x / (volControl.width)<br>
> +                    }<br>
> +                    onWheel: {<br>
> +                        if(wheel.angleDelta.y > 0)<br>
> +                            volControl.increase()<br>
> +                        else<br>
> +                            volControl.decrease()<br>
> +                    }<br>
> +                }<br>
> +                Rectangle {<br>
> +                    id: filled<br>
> +                    width: volControl.visualPosition * parent.width<br>
> +                    height: parent.height<br>
> +                    radius: 4 * scale<br>
> +                    color: VLCStyle.colors.buttonText<br>
> +                    layer.enabled: (volControl.hovered ||<br>
> volControl.activeFocus)<br>
> +                    layer.effect: LinearGradient {<br>
> +                        start: Qt.point(0, 0)<br>
> +                        end: Qt.point(volControl.width, 0)<br>
> +                        gradient: Gradient {<br>
> +                            GradientStop { position: 0.30; color:<br>
> VLCStyle.colors.volbelowmid }<br>
> +                            GradientStop { position: 0.80; color:<br>
> VLCStyle.colors.volabovemid }<br>
> +                            GradientStop { position: 0.85; color:<br>
> VLCStyle.colors.volhigh }<br>
> +                            GradientStop { position: 1.00; color:<br>
> VLCStyle.colors.volmax }<br>
> +                        }<br>
> +                    }<br>
> +                }<br>
> +                Rectangle{<br>
> +                    id: tickmark<br>
> +                    x : parent.width * volControl.fullvolpos<br>
> +                    width: 1 * scale<br>
> +                    height: parent.height<br>
> +                    radius: 2 * scale<br>
> +                    color: VLCStyle.colors.buttonText<br>
> +                }<br>
> +            }<br>
> +<br>
> +            handle: Rectangle {<br>
> +                x: volControl.leftPadding + volControl.visualPosition<br>
> * (volControl.availableWidth - width)<br>
> +                y: volControl.topPadding + volControl.availableHeight<br>
> / 2 - height / 2<br>
> +<br>
> +                implicitWidth: 8 * scale<br>
> +                implicitHeight: implicitWidth<br>
> +                radius: width * 0.5<br>
> +                visible: (volControl.hovered || <br>
> volControl.activeFocus)<br>
> +                color: volControl.sliderColor<br>
> +            }<br>
> +        }<br>
> +    }<br>
> +}<br>
> diff --git a/modules/gui/qt/qml/style/VLCColors.qml<br>
> b/modules/gui/qt/qml/style/VLCColors.qml<br>
> index a1be281883..8d3cb5d080 100644<br>
> --- a/modules/gui/qt/qml/style/VLCColors.qml<br>
> +++ b/modules/gui/qt/qml/style/VLCColors.qml<br>
> @@ -69,6 +69,11 @@ Item {<br>
> <br>
>      property color banner: activePalette.window;<br>
>      property color bannerHover: activePalette.highlight;<br>
> +    property color volsliderbg: "#bdbebf"<br>
> +    property color volbelowmid: "#99d299"<br>
> +    property color volabovemid: "#14d214"<br>
> +    property color volhigh: "#ffc70f"<br>
> +    property color volmax: "#f5271d"<br>
> <br>
>      //vlc orange<br>
>      property color accent: "#FFFF950D";<br>
> diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc<br>
> index 40a8be1c9c..2b1466f970 100644<br>
> --- a/modules/gui/qt/vlc.qrc<br>
> +++ b/modules/gui/qt/vlc.qrc<br>
> @@ -250,6 +250,7 @@<br>
>          <file <br>
> alias="TrackSelector.qml">qml/player/TrackSelector.qml</file><br>
>          <file <br>
> alias="ModalControlBar.qml">qml/player/ModalControlBar.qml</file><br>
>          <file <br>
> alias="ControlButtons.qml">qml/player/ControlButtons.qml</file><br>
> +        <file <br>
> alias="VolumeWidget.qml">qml/player/VolumeWidget.qml</file><br>
>      </qresource><br>
>      <qresource prefix="/about"><br>
>          <file alias="About.qml">qml/about/About.qml</file><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr">Rohan Rajpal</div></div></div></div>