[vlc-commits] qml: show play and pause icons in playlist item according to the player state

Fatih Uzunoglu git at videolan.org
Fri Jul 3 14:59:21 CEST 2020


vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Fri Jun 26 21:07:32 2020 +0300| [609935e3082a00235d1fb75ff838af62010f6897] | committer: Pierre Lamot

qml: show play and pause icons in playlist item according to the player state

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

 modules/gui/qt/playlist/qml/PLItem.qml | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/modules/gui/qt/playlist/qml/PLItem.qml b/modules/gui/qt/playlist/qml/PLItem.qml
index fef3444c9c..69e56ee58a 100644
--- a/modules/gui/qt/playlist/qml/PLItem.qml
+++ b/modules/gui/qt/playlist/qml/PLItem.qml
@@ -20,6 +20,7 @@ import QtQuick 2.11
 import QtQuick.Controls 2.4
 import QtQuick.Layouts 1.3
 
+import org.videolan.vlc 0.1
 
 import "qrc:///widgets/" as Widgets
 import "qrc:///style/"
@@ -111,24 +112,28 @@ Rectangle {
                 rightMargin: root.rightPadding
             }
 
-            /* Cover of the associated album */
-            Image {
-                id: cover
-
+            Item {
                 Layout.preferredHeight: VLCStyle.icon_normal
                 Layout.preferredWidth: VLCStyle.icon_normal
                 Layout.leftMargin: VLCStyle.margin_xsmall
 
-                fillMode: Image.PreserveAspectFit
-                source: (model.artwork && model.artwork.toString()) ? model.artwork : VLCStyle.noArtCover
-            }
+                Image {
+                    id: artwork
+                    anchors.fill: parent
+                    fillMode: Image.PreserveAspectFit
+                    source: (model.artwork && model.artwork.toString()) ? model.artwork : VLCStyle.noArtCover
+                    visible: !statusIcon.visible
+                }
 
-            Image {
-                id: isVisible
-                visible: model.isCurrent
-                Layout.preferredHeight: VLCStyle.icon_small
-                Layout.preferredWidth: VLCStyle.icon_small
-                source:  "qrc:///toolbar/play_b.svg"
+                Image {
+                    id: statusIcon
+                    anchors.centerIn: parent
+                    visible: (model.isCurrent && source !== "")
+                    width: VLCStyle.play_cover_small
+                    height: VLCStyle.play_cover_small
+                    source: player.playingState === PlayerController.PLAYING_STATE_PLAYING ? "qrc:///toolbar/play_b.svg" :
+                                                        player.playingState === PlayerController.PLAYING_STATE_PAUSED ? "qrc:///toolbar/pause_b.svg" : ""
+                }
             }
 
             Column {



More information about the vlc-commits mailing list