diff --git a/src/DraggableItem.qml b/src/DraggableItem.qml --- a/src/DraggableItem.qml +++ b/src/DraggableItem.qml @@ -50,6 +50,7 @@ signal clicked() signal rightClicked() + signal doubleClicked() width: contentItem.width height: topPlaceholder.height + wrapperParent.height + bottomPlaceholder.height @@ -117,6 +118,10 @@ if (mouse.button == Qt.RightButton) root.rightClicked() } + + onDoubleClicked: { + root.doubleClicked() + } } } } diff --git a/src/MediaPlayListView.qml b/src/MediaPlayListView.qml --- a/src/MediaPlayListView.qml +++ b/src/MediaPlayListView.qml @@ -269,14 +269,20 @@ draggedItemParent: topItem - onClicked: - { + onClicked: { playListView.currentIndex = index entry.forceActiveFocus() } onRightClicked: contentItem.contextMenu.popup() + onDoubleClicked: { + if (model.isValid) { + topItem.playListControler.switchTo(model.index) + topItem.startPlayback() + } + } + onMoveItemRequested: { playListModel.move(from, to, 1); } diff --git a/src/PlayListEntry.qml b/src/PlayListEntry.qml --- a/src/PlayListEntry.qml +++ b/src/PlayListEntry.qml @@ -25,7 +25,7 @@ import org.mgallien.QmlExtension 1.0 FocusScope { - id: viewAlbumDelegate + id: playListEntry property string title property string artist @@ -57,18 +57,18 @@ text: i18nc("Remove current track from play list", "Remove") iconName: "list-remove" onTriggered: { - playListModel.removeRows(viewAlbumDelegate.index, 1) + playListModel.removeRows(playListEntry.index, 1) } } Action { id: playNow text: i18nc("Play now current track from play list", "Play Now") iconName: "media-playback-start" - enabled: !isPlaying && isValid + enabled: !(isPlaying == MediaPlayList.IsPlaying) && isValid onTriggered: { - playListControler.switchTo(viewAlbumDelegate.index) - viewAlbumDelegate.startPlayback() + playListControler.switchTo(playListEntry.index) + playListEntry.startPlayback() } } @@ -110,7 +110,7 @@ Image { id: mainIcon - source: (isValid ? (viewAlbumDelegate.itemDecoration ? viewAlbumDelegate.itemDecoration : Qt.resolvedUrl(elisaTheme.albumCover)) : Qt.resolvedUrl(elisaTheme.errorIcon)) + source: (isValid ? (playListEntry.itemDecoration ? playListEntry.itemDecoration : Qt.resolvedUrl(elisaTheme.albumCover)) : Qt.resolvedUrl(elisaTheme.errorIcon)) Layout.minimumWidth: headerRow.height - 4 Layout.maximumWidth: headerRow.height - 4 @@ -202,7 +202,7 @@ anchors.fill: parent - spacing: elisaTheme.layoutHorizontalMargin + spacing: 0 LabelWithToolTip { id: mainCompactLabel @@ -212,6 +212,7 @@ font.weight: (isPlaying ? Font.Bold : Font.Normal) color: myPalette.text + Layout.maximumWidth: mainCompactLabel.implicitWidth + 1 Layout.fillWidth: true Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft @@ -229,46 +230,20 @@ color: myPalette.text Layout.fillWidth: true + Layout.leftMargin: elisaTheme.layoutHorizontalMargin Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft visible: !isValid elide: Text.ElideRight } - Item { Layout.fillWidth: true } - - ToolButton { - id: playNowButton - - implicitHeight: elisaTheme.smallDelegateToolButtonSize - implicitWidth: elisaTheme.smallDelegateToolButtonSize - - opacity: 0 - - visible: opacity > 0.1 - action: playNow - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - } - - ToolButton { - id: removeButton - - implicitHeight: elisaTheme.smallDelegateToolButtonSize - implicitWidth: elisaTheme.smallDelegateToolButtonSize - - opacity: 0 - - visible: opacity > 0.1 - action: removeFromPlayList - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - } - Image { id: playIcon Layout.preferredWidth: parent.height * 1 Layout.preferredHeight: parent.height * 1 + Layout.leftMargin: elisaTheme.layoutHorizontalMargin Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Layout.maximumWidth: elisaTheme.smallDelegateToolButtonSize Layout.maximumHeight: elisaTheme.smallDelegateToolButtonSize @@ -314,10 +289,45 @@ } } + Item { + Layout.fillWidth: true + Layout.preferredWidth: 0 + } + + ToolButton { + id: playNowButton + + implicitHeight: elisaTheme.smallDelegateToolButtonSize + implicitWidth: elisaTheme.smallDelegateToolButtonSize + + opacity: 0 + + visible: opacity > 0.1 + action: playNow + Layout.leftMargin: elisaTheme.layoutHorizontalMargin + Layout.alignment: Qt.AlignVCenter | Qt.AlignRight + } + + ToolButton { + id: removeButton + + implicitHeight: elisaTheme.smallDelegateToolButtonSize + implicitWidth: elisaTheme.smallDelegateToolButtonSize + + opacity: 0 + + visible: opacity > 0.1 + action: removeFromPlayList + Layout.leftMargin: elisaTheme.layoutHorizontalMargin + Layout.alignment: Qt.AlignVCenter | Qt.AlignRight + } + RatingStar { id: ratingWidget starSize: elisaTheme.ratingStarSize + + Layout.leftMargin: elisaTheme.layoutHorizontalMargin } LabelWithToolTip { @@ -327,6 +337,7 @@ color: myPalette.text elide: Text.ElideRight + Layout.leftMargin: elisaTheme.layoutHorizontalMargin Layout.alignment: Qt.AlignVCenter | Qt.AlignRight } } @@ -337,9 +348,9 @@ states: [ State { name: 'notSelected' - when: !containsMouse && (!viewAlbumDelegate.activeFocus || !isSelected) + when: !containsMouse && (!playListEntry.activeFocus || !isSelected) PropertyChanges { - target: viewAlbumDelegate + target: playListEntry height: (hasAlbumHeader ? elisaTheme.delegateWithHeaderHeight : elisaTheme.delegateHeight) } PropertyChanges { @@ -357,9 +368,9 @@ }, State { name: 'hoveredOrSelected' - when: containsMouse || (viewAlbumDelegate.activeFocus && isSelected) + when: containsMouse || (playListEntry.activeFocus && isSelected) PropertyChanges { - target: viewAlbumDelegate + target: playListEntry height: (hasAlbumHeader ? elisaTheme.delegateWithHeaderHeight : elisaTheme.delegateHeight) } PropertyChanges {