Add streaming action to entry context menus

This commit is contained in:
Bart De Vries 2023-02-11 21:02:12 +01:00
parent cbc2f0f6bd
commit 49bec856b4
2 changed files with 20 additions and 1 deletions

View File

@ -328,7 +328,7 @@ Kirigami.SwipeListItem {
} }
}, },
Kirigami.Action { Kirigami.Action {
text: i18nc("Action to start playback by streaming the episode rather than downloading it first", "Stream") text: i18nc("@action:inmenu Action to start playback by streaming the episode rather than downloading it first", "Stream")
icon.name: "qrc:/media-playback-start-cloud" icon.name: "qrc:/media-playback-start-cloud"
visible: showStreamingPlayButton visible: showStreamingPlayButton
onTriggered: { onTriggered: {

View File

@ -212,6 +212,19 @@ ListView {
} }
} }
property var streamAction: Kirigami.Action {
text: i18nc("@action:inmenu Action to start playback by streaming the episode rather than downloading it first", "Stream")
icon.name: "qrc:/media-playback-start-cloud"
visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? (singleSelectedEntry.hasEnclosure ? singleSelectedEntry.enclosure.status !== Enclosure.Downloaded : false) : false)
onTriggered: {
if (!singleSelectedEntry.queueStatus) {
singleSelectedEntry.queueStatus = true;
}
AudioManager.entry = singleSelectedEntry;
AudioManager.play();
}
}
property var defaultActionList: [addToQueueAction, property var defaultActionList: [addToQueueAction,
removeFromQueueAction, removeFromQueueAction,
markPlayedAction, markPlayedAction,
@ -220,6 +233,7 @@ ListView {
markNotNewAction, markNotNewAction,
downloadEnclosureAction, downloadEnclosureAction,
deleteEnclosureAction, deleteEnclosureAction,
streamAction,
selectAllAction, selectAllAction,
selectNoneAction] selectNoneAction]
@ -266,6 +280,11 @@ ListView {
visible: singleSelectedEntry ? (singleSelectedEntry.hasEnclosure ? singleSelectedEntry.enclosure.status !== Enclosure.Downloadable : false) : true visible: singleSelectedEntry ? (singleSelectedEntry.hasEnclosure ? singleSelectedEntry.enclosure.status !== Enclosure.Downloadable : false) : true
height: visible ? implicitHeight : 0 // workaround for qqc2-breeze-style height: visible ? implicitHeight : 0 // workaround for qqc2-breeze-style
} }
Controls.MenuItem {
action: listView.streamAction
visible: singleSelectedEntry ? (singleSelectedEntry.hasEnclosure ? singleSelectedEntry.enclosure.status !== Enclosure.Downloaded : false) : false
height: visible ? implicitHeight : 0 // workaround for qqc2-breeze-style
}
onClosed: { onClosed: {
// reset to normal selection if this context menu is closed // reset to normal selection if this context menu is closed
listView.selectionForContextMenu = listView.selectionModel.selectedIndexes; listView.selectionForContextMenu = listView.selectionModel.selectedIndexes;