[vlc-devel] [PATCH 12/21] qml: clip artwork info when title or artist name is too long
Fatih Uzunoglu
fuzun54 at outlook.com
Sat Nov 7 17:53:31 CET 2020
+ show tooltip in such a case when hovered or focused
---
modules/gui/qt/player/qml/ControlButtons.qml | 24 ++++++++++++++++++++
modules/gui/qt/style/VLCStyle.qml | 2 ++
2 files changed, 26 insertions(+)
diff --git a/modules/gui/qt/player/qml/ControlButtons.qml b/modules/gui/qt/player/qml/ControlButtons.qml
index ffaf37192d..f9b41cacdd 100644
--- a/modules/gui/qt/player/qml/ControlButtons.qml
+++ b/modules/gui/qt/player/qml/ControlButtons.qml
@@ -779,6 +779,7 @@ Item{
id: artworkInfoDelegate
Widgets.FocusBackground {
+ id: artworkInfoItem
property bool paintOnly: false
implicitWidth: playingItemInfoRow.implicitWidth
@@ -795,9 +796,11 @@ Item{
}
MouseArea {
+ id: artworkInfoMouseArea
anchors.fill: parent
visible: !paintOnly
onClicked: history.push(["player"])
+ hoverEnabled: true
}
Row {
@@ -840,19 +843,40 @@ Item{
anchors.verticalCenter: parent.verticalCenter
leftPadding: 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)
+ && (artworkInfoMouseArea.containsMouse || artworkInfoItem.active)
+ delay: 500
+
+ contentItem: Text {
+ text: i18n.qtr("%1\n%2").arg(titleLabel.text).arg(artistLabel.text)
+ color: VLCStyle.colors.tooltipTextColor
+ }
+
+ background: Rectangle {
+ color: VLCStyle.colors.tooltipColor
+ }
+ }
+
Widgets.MenuLabel {
id: titleLabel
+ width: implicitWidth < VLCStyle.artworkInfoTextWidth ? implicitWidth : VLCStyle.artworkInfoTextWidth
text: mainPlaylistController.currentItem.title
+ visible: text !== ""
}
Widgets.MenuCaption {
id: artistLabel
+ width: implicitWidth < VLCStyle.artworkInfoTextWidth ? implicitWidth : VLCStyle.artworkInfoTextWidth
text: mainPlaylistController.currentItem.artist
+ visible: text !== ""
}
Widgets.MenuCaption {
id: progressIndicator
text: player.time.toString() + " / " + player.length.toString()
+ visible: text !== ""
}
}
}
diff --git a/modules/gui/qt/style/VLCStyle.qml b/modules/gui/qt/style/VLCStyle.qml
index 648076c947..d32d24086f 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)
+ readonly property real artworkInfoTextWidth: (appWidth / 6)
+
//combobox
property int combobox_width_small: dp(64, scale)
property int combobox_width_normal: dp(96, scale)
--
2.25.1
More information about the vlc-devel
mailing list