[vlc-commits] qml: clip artwork info when title or artist name is too long
Fatih Uzunoglu
git at videolan.org
Mon Nov 16 10:04:16 CET 2020
vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Fri Aug 14 18:54:18 2020 +0300| [59d0a4506c83ea428956aa2917dd8db2cf1e5657] | committer: Pierre Lamot
qml: clip artwork info when title or artist name is too long
+ show tooltip in such a case when hovered or focused
Signed-off-by: Pierre Lamot <pierre at videolabs.io>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=59d0a4506c83ea428956aa2917dd8db2cf1e5657
---
modules/gui/qt/player/qml/ControlButtons.qml | 13 ++++++++++++-
modules/gui/qt/style/VLCStyle.qml | 2 ++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/modules/gui/qt/player/qml/ControlButtons.qml b/modules/gui/qt/player/qml/ControlButtons.qml
index ffaf37192d..25f7b8b114 100644
--- a/modules/gui/qt/player/qml/ControlButtons.qml
+++ b/modules/gui/qt/player/qml/ControlButtons.qml
@@ -779,10 +779,13 @@ Item{
id: artworkInfoDelegate
Widgets.FocusBackground {
+ id: artworkInfoItem
property bool paintOnly: false
- implicitWidth: playingItemInfoRow.implicitWidth
+ readonly property bool isClipped: implicitWidth < playingItemInfoRow.implicitWidth
+ implicitWidth: Math.min(playingItemInfoRow.implicitWidth, VLCStyle.artworkInfoMaxWidth)
implicitHeight: playingItemInfoRow.implicitHeight
+ clip: isClipped
Keys.onPressed: {
if (KeyHelper.matchOk(event) ) {
@@ -795,9 +798,11 @@ Item{
}
MouseArea {
+ id: artworkInfoMouseArea
anchors.fill: parent
visible: !paintOnly
onClicked: history.push(["player"])
+ hoverEnabled: true
}
Row {
@@ -840,6 +845,12 @@ Item{
anchors.verticalCenter: parent.verticalCenter
leftPadding: VLCStyle.margin_xsmall
+ ToolTip {
+ text: i18n.qtr("%1\n%2").arg(titleLabel.text).arg(artistLabel.text)
+ visible: artworkInfoItem.isClipped && (artworkInfoMouseArea.containsMouse || artworkInfoItem.active)
+ delay: 500
+ }
+
Widgets.MenuLabel {
id: titleLabel
text: mainPlaylistController.currentItem.title
diff --git a/modules/gui/qt/style/VLCStyle.qml b/modules/gui/qt/style/VLCStyle.qml
index 648076c947..562c91d071 100644
--- a/modules/gui/qt/style/VLCStyle.qml
+++ b/modules/gui/qt/style/VLCStyle.qml
@@ -124,6 +124,8 @@ Item {
property int expandAlbumTracksHeight: dp(200, scale)
+ property int artworkInfoMaxWidth: dp(350, scale)
+
//combobox
property int combobox_width_small: dp(64, scale)
property int combobox_width_normal: dp(96, scale)
More information about the vlc-commits
mailing list