[vlc-devel] [PATCH 06/27] qml: fix artwork info behavior on toolbareditor

Fatih Uzunoglu fuzun54 at outlook.com
Fri Dec 4 00:01:41 CET 2020


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.
---
 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
                     }
-- 
2.27.0



More information about the vlc-devel mailing list