[vlc-devel] [PATCH 09/28] qml: show dragged playlist item when selection count is 1
Fatih Uzunoglu
fuzun54 at outlook.com
Tue Jul 21 19:28:39 CEST 2020
---
modules/gui/qt/playlist/qml/PLItem.qml | 1 +
modules/gui/qt/widgets/qml/DNDLabel.qml | 78 ++++++++++++++++++++++++-
2 files changed, 77 insertions(+), 2 deletions(-)
diff --git a/modules/gui/qt/playlist/qml/PLItem.qml b/modules/gui/qt/playlist/qml/PLItem.qml
index 5ed3995347..51735fa48d 100644
--- a/modules/gui/qt/playlist/qml/PLItem.qml
+++ b/modules/gui/qt/playlist/qml/PLItem.qml
@@ -89,6 +89,7 @@ Rectangle {
return
if (target.active) {
root.dragStarting()
+ dragItem.model = model
dragItem.count = plmodel.getSelection().length
dragItem.visible = true
} else {
diff --git a/modules/gui/qt/widgets/qml/DNDLabel.qml b/modules/gui/qt/widgets/qml/DNDLabel.qml
index 1f90f9e03f..83176537d2 100644
--- a/modules/gui/qt/widgets/qml/DNDLabel.qml
+++ b/modules/gui/qt/widgets/qml/DNDLabel.qml
@@ -16,14 +16,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
import QtQuick 2.11
+import QtQuick.Controls 2.4
+import QtQuick.Layouts 1.3
+
+import "qrc:///widgets/" as Widgets
import "qrc:///style/"
Rectangle {
property alias text: label.text
+ property alias model: plitem.model
z: 1
- width: label.implicitWidth
- height: label.implicitHeight
+ width: plitem.visible ? plitem.implicitWidth : label.implicitWidth
+ height: plitem.visible ? plitem.implicitHeight : label.implicitHeight
color: VLCStyle.colors.button
border.color : VLCStyle.colors.buttonBorder
visible: false
@@ -43,5 +48,74 @@ Rectangle {
font.pixelSize: VLCStyle.fontSize_normal
color: VLCStyle.colors.text
text: i18n.qtr("%1 tracks selected").arg(count)
+ visible: count > 1 || !model
+ }
+
+ Item {
+ id: plitem
+ opacity: 0.7
+ visible: count === 1 && model
+
+ property var model
+
+ RowLayout {
+ id: content
+ anchors.fill: parent
+
+ Item {
+ Layout.preferredHeight: VLCStyle.icon_normal
+ Layout.preferredWidth: VLCStyle.icon_normal
+ Layout.leftMargin: VLCStyle.margin_xsmall
+
+ Image {
+ id: artwork
+ anchors.fill: parent
+ fillMode: Image.PreserveAspectFit
+ source: (model.artwork && model.artwork.toString()) ? model.artwork : VLCStyle.noArtCover
+ visible: !statusIcon.visible
+ }
+
+ Widgets.IconLabel {
+ id: statusIcon
+ anchors.fill: parent
+ visible: (model.isCurrent && text !== "")
+ width: height
+ height: VLCStyle.icon_normal
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ color: VLCStyle.colors.accent
+ text: player.playingState === PlayerController.PLAYING_STATE_PLAYING ? VLCIcons.volume_high :
+ player.playingState === PlayerController.PLAYING_STATE_PAUSED ? VLCIcons.pause :
+ player.playingState === PlayerController.PLAYING_STATE_STOPPED ? VLCIcons.stop : ""
+ }
+ }
+
+ Column {
+ Widgets.ListLabel {
+ id: textInfo
+ Layout.fillWidth: true
+ Layout.leftMargin: VLCStyle.margin_small
+
+ font.weight: model.isCurrent ? Font.DemiBold : Font.Normal
+ text: model.title
+ }
+
+ Widgets.ListSubtitleLabel {
+ id: textArtist
+ Layout.fillWidth: true
+ Layout.leftMargin: VLCStyle.margin_small
+
+ font.weight: model.isCurrent ? Font.DemiBold : Font.Normal
+ text: (model.artist ? model.artist : i18n.qtr("Unknown Artist"))
+ }
+ }
+
+ Widgets.ListLabel {
+ id: textDuration
+ Layout.rightMargin: VLCStyle.margin_xsmall
+
+ text: model.duration
+ }
+ }
}
}
--
2.25.1
More information about the vlc-devel
mailing list