Consolidate all EntryDelegate actions
QueueDelegates and EntryListDelegates are now using the same actions defined in GenericEntryDelegate.
This commit is contained in:
parent
1ceb5532b2
commit
07afc98978
@ -68,44 +68,6 @@ Kirigami.ScrollablePage {
|
|||||||
id: entryListDelegate
|
id: entryListDelegate
|
||||||
GenericEntryDelegate {
|
GenericEntryDelegate {
|
||||||
listView: entryList
|
listView: entryList
|
||||||
entryActions: [ // TODO: put the actions back into GenericEntryDelegate
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Download")
|
|
||||||
icon.name: "download"
|
|
||||||
onTriggered: {
|
|
||||||
entry.queueStatus = true;
|
|
||||||
entry.enclosure.download();
|
|
||||||
}
|
|
||||||
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloadable
|
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Cancel download")
|
|
||||||
icon.name: "edit-delete-remove"
|
|
||||||
onTriggered: entry.enclosure.cancelDownload()
|
|
||||||
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloading
|
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Add to queue")
|
|
||||||
icon.name: "media-playlist-append"
|
|
||||||
visible: !entry.queueStatus && entry.enclosure && entry.enclosure.status === Enclosure.Downloaded
|
|
||||||
onTriggered: entry.queueStatus = true
|
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Play")
|
|
||||||
icon.name: "media-playback-start"
|
|
||||||
visible: entry.queueStatus && entry.enclosure && entry.enclosure.status === Enclosure.Downloaded && (audio.entry !== entry || audio.playbackState !== Audio.PlayingState)
|
|
||||||
onTriggered: {
|
|
||||||
audio.entry = entry
|
|
||||||
audio.play()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Pause")
|
|
||||||
icon.name: "media-playback-pause"
|
|
||||||
visible: entry.queueStatus && entry.enclosure && entry.enclosure.status === Enclosure.Downloaded && audio.entry === entry && audio.playbackState === Audio.PlayingState
|
|
||||||
onTriggered: audio.pause()
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,45 +19,6 @@ Kirigami.SwipeListItem {
|
|||||||
|
|
||||||
property bool isQueue: false
|
property bool isQueue: false
|
||||||
property var listView: ""
|
property var listView: ""
|
||||||
property list<Controls.Action> entryActions
|
|
||||||
property list<Controls.Action> defaultActions: [
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Download")
|
|
||||||
icon.name: "download"
|
|
||||||
onTriggered: {
|
|
||||||
entry.queueStatus = true;
|
|
||||||
entry.enclosure.download();
|
|
||||||
}
|
|
||||||
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloadable
|
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Cancel download")
|
|
||||||
icon.name: "edit-delete-remove"
|
|
||||||
onTriggered: entry.enclosure.cancelDownload()
|
|
||||||
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloading
|
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Add to queue")
|
|
||||||
icon.name: "media-playlist-append"
|
|
||||||
visible: !entry.queueStatus && entry.enclosure && entry.enclosure.status === Enclosure.Downloaded
|
|
||||||
onTriggered: entry.queueStatus = true
|
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Play")
|
|
||||||
icon.name: "media-playback-start"
|
|
||||||
visible: entry.queueStatus && entry.enclosure && entry.enclosure.status === Enclosure.Downloaded && (audio.entry !== entry || audio.playbackState !== Audio.PlayingState)
|
|
||||||
onTriggered: {
|
|
||||||
audio.entry = entry
|
|
||||||
audio.play()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Pause")
|
|
||||||
icon.name: "media-playback-pause"
|
|
||||||
visible: entry.queueStatus && entry.enclosure && entry.enclosure.status === Enclosure.Downloaded && audio.entry === entry && audio.playbackState === Audio.PlayingState
|
|
||||||
onTriggered: audio.pause()
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
contentItem: RowLayout {
|
contentItem: RowLayout {
|
||||||
Loader {
|
Loader {
|
||||||
@ -192,5 +153,44 @@ Kirigami.SwipeListItem {
|
|||||||
actions = defaultActions;
|
actions = defaultActions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actions: [
|
||||||
|
Kirigami.Action {
|
||||||
|
text: i18n("Download")
|
||||||
|
icon.name: "download"
|
||||||
|
onTriggered: {
|
||||||
|
entry.queueStatus = true;
|
||||||
|
entry.enclosure.download();
|
||||||
|
}
|
||||||
|
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloadable
|
||||||
|
},
|
||||||
|
Kirigami.Action {
|
||||||
|
text: i18n("Cancel download")
|
||||||
|
icon.name: "edit-delete-remove"
|
||||||
|
onTriggered: entry.enclosure.cancelDownload()
|
||||||
|
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloading
|
||||||
|
},
|
||||||
|
Kirigami.Action {
|
||||||
|
text: i18n("Add to queue")
|
||||||
|
icon.name: "media-playlist-append"
|
||||||
|
visible: !entry.queueStatus && entry.enclosure && entry.enclosure.status === Enclosure.Downloaded
|
||||||
|
onTriggered: entry.queueStatus = true
|
||||||
|
},
|
||||||
|
Kirigami.Action {
|
||||||
|
text: i18n("Play")
|
||||||
|
icon.name: "media-playback-start"
|
||||||
|
visible: entry.queueStatus && entry.enclosure && entry.enclosure.status === Enclosure.Downloaded && (audio.entry !== entry || audio.playbackState !== Audio.PlayingState)
|
||||||
|
onTriggered: {
|
||||||
|
audio.entry = entry
|
||||||
|
audio.play()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Kirigami.Action {
|
||||||
|
text: i18n("Pause")
|
||||||
|
icon.name: "media-playback-pause"
|
||||||
|
visible: entry.queueStatus && entry.enclosure && entry.enclosure.status === Enclosure.Downloaded && audio.entry === entry && audio.playbackState === Audio.PlayingState
|
||||||
|
onTriggered: audio.pause()
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,35 +46,6 @@ Kirigami.ScrollablePage {
|
|||||||
GenericEntryDelegate {
|
GenericEntryDelegate {
|
||||||
isQueue: true
|
isQueue: true
|
||||||
listView: queueList
|
listView: queueList
|
||||||
entryActions: [
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Download")
|
|
||||||
icon.name: "download"
|
|
||||||
onTriggered: entry.enclosure.download()
|
|
||||||
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloadable
|
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Cancel download")
|
|
||||||
icon.name: "edit-delete-remove"
|
|
||||||
onTriggered: entry.enclosure.cancelDownload()
|
|
||||||
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloading
|
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Play")
|
|
||||||
icon.name: "media-playback-start"
|
|
||||||
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloaded && (audio.entry !== entry || audio.playbackState !== Audio.PlayingState)
|
|
||||||
onTriggered: {
|
|
||||||
audio.entry = entry
|
|
||||||
audio.play()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Pause")
|
|
||||||
icon.name: "media-playback-pause"
|
|
||||||
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloaded && audio.entry === entry && audio.playbackState === Audio.PlayingState
|
|
||||||
onTriggered: audio.pause()
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user