[vlc-commits] qml: fix artwork info behavior on toolbareditor

Fatih Uzunoglu git at videolan.org
Mon Dec 7 10:08:22 UTC 2020


vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Fri Dec  4 02:01:41 2020 +0300| [9aab6d87c930099d7e2c712d6a333b57a50144c6] | committer: Pierre Lamot

qml: fix artwork info behavior on toolbareditor

with this patch, artwork info control does not show current playing track information when it is placed in toolbareditor, instead it shows dummy text. Previously it was causing problems on toolbareditor because clipping is undefined in toolbareditor.

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

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

 modules/gui/qt/player/qml/ControlButtons.qml | 44 +++++++++++++++++++++++-----
 1 file changed, 36 insertions(+), 8 deletions(-)

diff --git a/modules/gui/qt/player/qml/ControlButtons.qml b/modules/gui/qt/player/qml/ControlButtons.qml
index 8e736c894a..f0f8b36bbd 100644
--- a/modules/gui/qt/player/qml/ControlButtons.qml
+++ b/modules/gui/qt/player/qml/ControlButtons.qml
@@ -828,9 +828,14 @@ Item{
                     Image {
                         id: cover
 
-                        source: (mainPlaylistController.currentItem.artwork && mainPlaylistController.currentItem.artwork.toString())
-                                ? mainPlaylistController.currentItem.artwork
-                                : VLCStyle.noArtAlbum
+                        source: {
+                            if (paintOnly)
+                                VLCStyle.noArtAlbum
+                            else
+                                (mainPlaylistController.currentItem.artwork && mainPlaylistController.currentItem.artwork.toString())
+                                                                ? mainPlaylistController.currentItem.artwork
+                                                                : VLCStyle.noArtAlbum
+                        }
                         fillMode: Image.PreserveAspectFit
 
                         width: VLCStyle.dp(60)
@@ -842,6 +847,8 @@ Item{
                     anchors.verticalCenter: parent.verticalCenter
                     leftPadding: VLCStyle.margin_xsmall
 
+                    width: implicitWidth + VLCStyle.margin_xsmall
+
                     ToolTip {
                         text: i18n.qtr("%1\n%2").arg(titleLabel.text).arg(artistLabel.text)
                         visible: (titleLabel.implicitWidth > titleLabel.width || artistLabel.implicitWidth > titleLabel.width)
@@ -860,23 +867,44 @@ Item{
 
                     Widgets.MenuLabel {
                         id: titleLabel
-                        width: implicitWidth < VLCStyle.artworkInfoTextWidth ? implicitWidth : VLCStyle.artworkInfoTextWidth
-                        text: mainPlaylistController.currentItem.title
+                        width: {
+                            if (!paintOnly)
+                                implicitWidth < VLCStyle.artworkInfoTextWidth ? implicitWidth : VLCStyle.artworkInfoTextWidth
+                        }
+                        text: {
+                            if (paintOnly)
+                                i18n.qtr("Title")
+                            else
+                                mainPlaylistController.currentItem.title
+                        }
                         visible: text !== ""
                         color: _colors.text
                     }
 
                     Widgets.MenuCaption {
                         id: artistLabel
-                        width: implicitWidth < VLCStyle.artworkInfoTextWidth ? implicitWidth : VLCStyle.artworkInfoTextWidth
-                        text: mainPlaylistController.currentItem.artist
+                        width: {
+                            if (!paintOnly)
+                                implicitWidth < VLCStyle.artworkInfoTextWidth ? implicitWidth : VLCStyle.artworkInfoTextWidth
+                        }
+                        text: {
+                            if (paintOnly)
+                                i18n.qtr("Artist")
+                            else
+                                mainPlaylistController.currentItem.artist
+                        }
                         visible: text !== ""
                         color: _colors.menuCaption
                     }
 
                     Widgets.MenuCaption {
                         id: progressIndicator
-                        text: player.time.toString() + " / " + player.length.toString()
+                        text: {
+                            if (paintOnly)
+                                " -- / -- "
+                            else
+                                player.time.toString() + " / " + player.length.toString()
+                        }
                         visible: text !== ""
                         color: _colors.menuCaption
                     }



More information about the vlc-commits mailing list