[vlc-commits] qml: add progressBar

Abel Tesfaye git at videolan.org
Tue Jul 30 17:57:05 CEST 2019


vlc | branch: master | Abel Tesfaye <Abeltesfaye45 at gmail.com> | Thu Jul 25 14:38:14 2019 +0300| [b09fba7b15c796e655735369dc33686106c1634d] | committer: Jean-Baptiste Kempf

qml: add progressBar

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b09fba7b15c796e655735369dc33686106c1634d
---

 modules/gui/qt/qml/mediacenter/MCVideoDisplay.qml |  1 +
 modules/gui/qt/qml/utils/GridItem.qml             | 65 ++++++++++++++++-------
 2 files changed, 46 insertions(+), 20 deletions(-)

diff --git a/modules/gui/qt/qml/mediacenter/MCVideoDisplay.qml b/modules/gui/qt/qml/mediacenter/MCVideoDisplay.qml
index 5bf1bcb1dd..6ffdb82e33 100644
--- a/modules/gui/qt/qml/mediacenter/MCVideoDisplay.qml
+++ b/modules/gui/qt/qml/mediacenter/MCVideoDisplay.qml
@@ -47,6 +47,7 @@ Utils.NavigableFocusScope {
                 infoLeft: model.duration
                 isVideo: true
                 isNew: model.playcount < 1
+                progress: Math.max(model.saved_position,0)
 
                 onItemClicked : {
                     delegateModel.updateSelection( modifier , view.currentItem.currentIndex, index)
diff --git a/modules/gui/qt/qml/utils/GridItem.qml b/modules/gui/qt/qml/utils/GridItem.qml
index 0563eb081d..f6a5656a65 100644
--- a/modules/gui/qt/qml/utils/GridItem.qml
+++ b/modules/gui/qt/qml/utils/GridItem.qml
@@ -41,6 +41,7 @@ Rectangle {
     property string infoLeft: ""
     property bool isVideo: false
     property bool isNew: false
+    property double progress: 0.5
 
     signal playClicked
     signal addToPlaylistClicked
@@ -156,27 +157,51 @@ Rectangle {
                                     }
                                 }
                             }
-                            states: [
-                                State {
-                                    name: "visible"
-                                    PropertyChanges { target: overlay; visible: true }
-                                    when: mouseArea.containsMouse
-                                },
-                                State {
-                                    name: "hidden"
-                                    PropertyChanges { target: overlay; visible: false }
-                                    when: !mouseArea.containsMouse
+
+                        ProgressBar {
+                            id: progressBar
+                            value: root.progress
+                            visible: isVideo
+                            anchors{
+                                bottom: parent.bottom
+                                left: parent.left
+                                right: parent.right
+                            }
+                            background: Rectangle {
+                                implicitHeight: 2 * VLCStyle.scale
+                                color: VLCStyle.colors.text
+                            }
+                            contentItem: Item {
+                                Rectangle {
+                                    width: progressBar.visualPosition * parent.width
+                                    height: parent.height
+                                    color: VLCStyle.colors.accent
                                 }
-                            ]
-                            transitions: [
-                                Transition {
-                                    from: "hidden";  to: "visible"
-                                    NumberAnimation  {
-                                        target: overlay
-                                        properties: "opacity"
-                                        from: 0; to: 0.8; duration: 300
-                                    }
+                            }
+                        }
+
+                        }
+                        states: [
+                            State {
+                                name: "visible"
+                                PropertyChanges { target: overlay; visible: true }
+                                when: mouseArea.containsMouse
+                            },
+                            State {
+                                name: "hidden"
+                                PropertyChanges { target: overlay; visible: false }
+                                when: !mouseArea.containsMouse
+                            }
+                        ]
+                        transitions: [
+                            Transition {
+                                from: "hidden";  to: "visible"
+                                NumberAnimation  {
+                                    target: overlay
+                                    properties: "opacity"
+                                    from: 0; to: 0.8; duration: 300
                                 }
+                             }
                             ]
                         }
 
@@ -235,4 +260,4 @@ Rectangle {
         }
     }
 }
-}
+



More information about the vlc-commits mailing list