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 @@ -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 @@ -236,7 +237,10 @@ elide: Text.ElideRight } - Item { Layout.fillWidth: true } + Item { + Layout.fillWidth: true + Layout.preferredWidth: 0 + } ToolButton { id: playNowButton @@ -337,9 +341,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 +361,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 {