Commit d69ad3c8 authored by Nate Graham's avatar Nate Graham
Browse files

Make track ratings editable inline

This commit makes ratings editable inline from the Now Playing page as
well as the Playlist items. For Playlist items, because there is not a
lot of horizontal space available, the stars only become editable when
you click on a new "Rate this track" button on the existing row of
inline buttons.

BUG: 437099
FIXED-IN: 21.12
parent d3553a49
Pipeline #74507 passed with stage
in 8 minutes and 15 seconds
......@@ -234,6 +234,7 @@ Kirigami.Page {
display: model.display
type: model.type
readOnly: true
url: topItem.fileUrl
}
}
}
......
......@@ -21,6 +21,7 @@ RowLayout {
property var display
property bool isRemovable
property bool readOnly
property string url
spacing: 0
......@@ -104,7 +105,7 @@ RowLayout {
sourceComponent: RatingStar {
starRating: display
readOnly: delegateRow.readOnly
readOnly: false
hoverWidgetOpacity: 1
......@@ -114,8 +115,9 @@ RowLayout {
onRatingEdited: {
if (display !== starRating) {
display = starRating
ElisaApplication.musicManager.updateSingleFileMetaData(url, DataTypes.RatingRole, starRating)
edited()
}
}
}
......
......@@ -19,6 +19,7 @@ BasePlayListDelegate {
property bool containsMouse
property bool simpleMode
property bool editingRating: false
Accessible.role: Accessible.ListItem
Accessible.name: title + ' ' + album + ' ' + artist
......@@ -166,7 +167,7 @@ BasePlayListDelegate {
Loader {
id: hoverLoader
active: false
visible: active
visible: active && !playListEntry.editingRating
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
......@@ -204,6 +205,20 @@ BasePlayListDelegate {
}
}
FlatButtonWithToolTip {
id: ratingButton
objectName: 'ratingButton'
enabled: isValid
text: i18nc("Show track rating", "Set track rating")
icon.name: "view-media-favorite"
onClicked: {
playListEntry.editingRating = true;
}
}
FlatButtonWithToolTip {
id: playPauseButton
objectName: 'playPauseButton'
......@@ -236,12 +251,26 @@ BasePlayListDelegate {
}
}
FlatButtonWithToolTip {
visible: playListEntry.editingRating
text: i18nc("Cancel rating this track", "Cancel rating this track")
icon.name: "dialog-cancel"
onClicked: { playListEntry.editingRating = false; }
}
RatingStar {
id: ratingWidget
readOnly: false
starRating: rating
visible: rating > 0 && !containsMouse && !isSelected && !playListEntry.activeFocus && !simpleMode
visible: playListEntry.editingRating || (rating > 0 && !containsMouse && !isSelected && !playListEntry.activeFocus && !simpleMode)
onRatingEdited: {
ElisaApplication.musicManager.updateSingleFileMetaData(playListEntry.fileName, DataTypes.RatingRole, starRating);
playListEntry.editingRating = false;
}
}
LabelWithToolTip {
......
......@@ -25,6 +25,7 @@ FocusScope {
property url fileName
property url imageUrl
property int trackNumber
property url trackUrl
property int discNumber
property int rating
property bool hasValidDiscNumber: true
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment