[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [elisa] src: remove all hover actions on PlayListEntry and allow to select entries
From: Matthieu Gallien <matthieu_gallien () yahoo ! fr>
Date: 2016-10-24 20:45:19
Message-ID: E1bym7T-0003xo-MD () code ! kde ! org
[Download RAW message or body]
Git commit 679ff9221cc63aed50131985555705bce0944a73 by Matthieu Gallien.
Committed on 24/10/2016 at 14:06.
Pushed by mgallien into branch 'master'.
remove all hover actions on PlayListEntry and allow to select entries
the selection will be used to provide a way to act on content of play
list: remove, ...
M +9 -9 src/MediaPlayListView.qml
M +127 -167 src/PlayListEntry.qml
http://commits.kde.org/elisa/679ff9221cc63aed50131985555705bce0944a73
diff --git a/src/MediaPlayListView.qml b/src/MediaPlayListView.qml
index f11221a..0881f80 100644
--- a/src/MediaPlayListView.qml
+++ b/src/MediaPlayListView.qml
@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA.
*/
-import QtQuick 2.4
+import QtQuick 2.5
import QtQuick.Controls 1.3
import QtQuick.Controls.Styles 1.3
import QtQuick.Layouts 1.1
@@ -116,7 +116,13 @@ Item {
model: DelegateModel {
model: playListModel
+ groups: [
+ DelegateModelGroup { name: "selected" }
+ ]
+
delegate: DraggableItem {
+ id: item
+
PlayListEntry {
height: (model.hasAlbumHeader ? Screen.pixelDensity * 22.5 : \
Screen.pixelDensity * 6.) width: playListView.width
@@ -149,15 +155,9 @@ Item {
else
''
isPlaying: model.isPlaying
- showHoverButtons: false
-
- hoverAction: Action {
- id: playListRemove
-
- iconSource: 'image://icon/list-remove'
+ isSelected: item.DelegateModel.inSelected
- onTriggered: playListModel.removeRows(index, 1, \
playListView.model.rootIndex)
- }
+ onClicked: item.DelegateModel.inSelected = \
!item.DelegateModel.inSelected }
draggedItemParent: topItem
diff --git a/src/PlayListEntry.qml b/src/PlayListEntry.qml
index 7b8e9c2..e9f2214 100644
--- a/src/PlayListEntry.qml
+++ b/src/PlayListEntry.qml
@@ -34,225 +34,185 @@ Item {
property alias duration : durationLabel.text
property int trackNumber
property alias isPlaying : playIcon.visible
- property bool showHoverButtons
+ property bool isSelected
property bool hasAlbumHeader
- property Action hoverAction
- ColumnLayout {
- spacing: 0
+ signal clicked()
- anchors.fill: parent
- anchors.leftMargin: Screen.pixelDensity * 1.5
- anchors.rightMargin: Screen.pixelDensity * 5.5
- anchors.topMargin: 0
- anchors.bottomMargin: 1
-
- RowLayout {
- id: headerRow
-
- spacing: Screen.pixelDensity * 1.5
-
- Layout.fillWidth: true
- Layout.preferredHeight: Screen.pixelDensity * 15.
- Layout.minimumHeight: Screen.pixelDensity * 15.
- Layout.maximumHeight: Screen.pixelDensity * 15.
+ Rectangle {
+ id: contentLayout
- visible: hasAlbumHeader
+ anchors.top: viewAlbumDelegate.top
+ anchors.left: viewAlbumDelegate.left
+ anchors.right: viewAlbumDelegate.right
+ anchors.bottom: viewAlbumDelegate.bottom
- Image {
- id: mainIcon
- source: itemDecoration
- Layout.preferredWidth: parent.height - 2
- Layout.preferredHeight: parent.height - 2
- width: parent.height - 2
- height: parent.height - 2
- sourceSize.width: parent.height - 2
- sourceSize.height: parent.height - 2
- fillMode: Image.PreserveAspectFit
- Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
+ SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
- Loader {
- id: hoverLoader
- active: false
+ color: (isSelected ? myPalette.highlight : myPalette.base)
- anchors.fill: parent
+ ColumnLayout {
+ spacing: 0
- sourceComponent: Rectangle {
- id: hoverLayer
+ anchors.fill: parent
+ anchors.leftMargin: Screen.pixelDensity * 1.5
+ anchors.rightMargin: Screen.pixelDensity * 5.5
+ anchors.topMargin: 0
+ anchors.bottomMargin: 1
- anchors.fill: parent
+ RowLayout {
+ id: headerRow
- color: 'black'
- opacity: 0.7
+ spacing: Screen.pixelDensity * 1.5
- BrightnessContrast {
- anchors.fill: playAction
- source: playAction
- brightness: 1.0
- contrast: 1.0
+ Layout.fillWidth: true
+ Layout.preferredHeight: Screen.pixelDensity * 15.
+ Layout.minimumHeight: Screen.pixelDensity * 15.
+ Layout.maximumHeight: Screen.pixelDensity * 15.
+
+ visible: hasAlbumHeader
+
+ Image {
+ id: mainIcon
+ source: itemDecoration
+ Layout.preferredWidth: parent.height - 2
+ Layout.preferredHeight: parent.height - 2
+ width: parent.height - 2
+ height: parent.height - 2
+ sourceSize.width: parent.height - 2
+ sourceSize.height: parent.height - 2
+ fillMode: Image.PreserveAspectFit
+ Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
+ }
- MouseArea {
- id: clickHandle
+ ColumnLayout {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
- anchors.fill: parent
- acceptedButtons: Qt.LeftButton
+ spacing: 0
- onClicked: hoverAction.trigger(clickHandle)
- }
- }
+ Item {
+ height: Screen.pixelDensity * 1.5
+ }
- Image {
- id: playAction
- source: hoverAction.iconSource
+ Label {
+ id: mainLabel
+ text: album
+ font.weight: Font.Bold
+ horizontalAlignment: "AlignHCenter"
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignCenter
+ elide: "ElideRight"
+ }
- anchors.centerIn: parent
+ Item {
+ Layout.fillHeight: true
+ }
- opacity: 1
- visible: false
+ Label {
+ id: authorLabel
+ text: artist
+ font.weight: Font.Light
+ horizontalAlignment: "AlignHCenter"
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignCenter
+ elide: "ElideRight"
+ }
- width: Screen.pixelDensity * 10
- height: Screen.pixelDensity * 10
- sourceSize.width: width
- sourceSize.height: width
- fillMode: Image.PreserveAspectFit
- }
+ Item {
+ height: Screen.pixelDensity * 1.5
}
}
}
- ColumnLayout {
- Layout.fillWidth: true
- Layout.fillHeight: true
+ Item {
+ Layout.preferredHeight: (hasAlbumHeader ? Screen.pixelDensity * 1.5 \
: 0) + Layout.minimumHeight: (hasAlbumHeader ? Screen.pixelDensity * \
1.5 : 0) + Layout.maximumHeight: (hasAlbumHeader ? Screen.pixelDensity \
* 1.5 : 0)
- spacing: 0
+ visible: hasAlbumHeader
+ }
- Item {
- height: Screen.pixelDensity * 1.5
- }
+
+ RowLayout {
+ id: trackRow
+
+ Layout.fillWidth: true
+ Layout.preferredHeight: Screen.pixelDensity * 5.
+ Layout.minimumHeight: Screen.pixelDensity * 5.
+ Layout.maximumHeight: Screen.pixelDensity * 5.
+
+ spacing: Screen.pixelDensity * 1.
Label {
- id: mainLabel
- text: album
+ id: mainCompactLabel
+
+ text: trackNumber + ' - ' + title
font.weight: Font.Bold
- horizontalAlignment: "AlignHCenter"
+
Layout.fillWidth: true
- Layout.alignment: Qt.AlignCenter
+ Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
+
elide: "ElideRight"
}
- Item {
- Layout.fillHeight: true
+ Image {
+ id: playIcon
+
+ Layout.preferredWidth: parent.height * 1
+ Layout.preferredHeight: parent.height * 1
+ Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
+ Layout.maximumWidth: parent.height * 1
+ Layout.maximumHeight: parent.height * 1
+
+ source: 'image://icon/media-playback-start'
+ width: parent.height * 1.
+ height: parent.height * 1.
+ sourceSize.width: parent.height * 1.
+ sourceSize.height: parent.height * 1.
+ fillMode: Image.PreserveAspectFit
+ visible: isPlaying
}
Label {
- id: authorLabel
- text: artist
- font.weight: Font.Light
- horizontalAlignment: "AlignHCenter"
- Layout.fillWidth: true
- Layout.alignment: Qt.AlignCenter
+ id: durationLabel
+ text: duration
+ font.weight: Font.Bold
elide: "ElideRight"
- }
-
- Item {
- height: Screen.pixelDensity * 1.5
+ Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
}
}
}
+ }
- Item {
- Layout.preferredHeight: (hasAlbumHeader ? Screen.pixelDensity * 1.5 : 0)
- Layout.minimumHeight: (hasAlbumHeader ? Screen.pixelDensity * 1.5 : 0)
- Layout.maximumHeight: (hasAlbumHeader ? Screen.pixelDensity * 1.5 : 0)
-
- visible: hasAlbumHeader
- }
-
-
- RowLayout {
- id: trackRow
-
- Layout.fillWidth: true
- Layout.preferredHeight: Screen.pixelDensity * 5.
- Layout.minimumHeight: Screen.pixelDensity * 5.
- Layout.maximumHeight: Screen.pixelDensity * 5.
-
- spacing: Screen.pixelDensity * 1.
-
- Label {
- id: mainCompactLabel
-
- text: trackNumber + ' - ' + title
- font.weight: Font.Bold
-
- Layout.fillWidth: true
- Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
-
- elide: "ElideRight"
- }
-
- Image {
- id: playIcon
-
- Layout.preferredWidth: parent.height * 1
- Layout.preferredHeight: parent.height * 1
- Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
- Layout.maximumWidth: parent.height * 1
- Layout.maximumHeight: parent.height * 1
-
- source: 'image://icon/media-playback-start'
- width: parent.height * 1.
- height: parent.height * 1.
- sourceSize.width: parent.height * 1.
- sourceSize.height: parent.height * 1.
- fillMode: Image.PreserveAspectFit
- visible: isPlaying
- }
-
- Label {
- id: durationLabel
- text: duration
- font.weight: Font.Bold
- elide: "ElideRight"
- Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
- }
- }
-
- Rectangle {
- id: entrySeparatorItem
-
- border.width: 0.5
- border.color: "#DDDDDD"
- color: "#DDDDDD"
- visible: true
+ Rectangle {
+ id: entrySeparatorItem
- Layout.leftMargin: Screen.pixelDensity * 0.5
- Layout.rightMargin: Screen.pixelDensity * 0.5
+ border.width: 0.5
+ border.color: "#DDDDDD"
+ color: "#DDDDDD"
+ visible: true
- Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
- Layout.preferredWidth: parent.width - Screen.pixelDensity * 3.
- Layout.minimumWidth: parent.width - Screen.pixelDensity * 3.
- Layout.maximumWidth: parent.width - Screen.pixelDensity * 3.
+ anchors.leftMargin: Screen.pixelDensity * 0.5
+ anchors.rightMargin: Screen.pixelDensity * 0.5
- Layout.preferredHeight: 1
- Layout.minimumHeight: 1
- Layout.maximumHeight: 1
- }
+ height: 1
}
MouseArea {
id: hoverHandle
- acceptedButtons: Qt.NoButton
+ acceptedButtons: Qt.LeftButton
- hoverEnabled: true
+ propagateComposedEvents: true
anchors.fill: parent
- propagateComposedEvents: true
- onEntered: hoverLoader.active = true
- onExited: hoverLoader.active = false
+ onClicked: viewAlbumDelegate.clicked()
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic