From 49bec856b4714695d2d1e9d9506dce3fc323d363 Mon Sep 17 00:00:00 2001 From: Bart De Vries Date: Sat, 11 Feb 2023 21:02:12 +0100 Subject: [PATCH] Add streaming action to entry context menus --- src/qml/GenericEntryDelegate.qml | 2 +- src/qml/GenericEntryListView.qml | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/qml/GenericEntryDelegate.qml b/src/qml/GenericEntryDelegate.qml index 0b14eea0..48c76b53 100644 --- a/src/qml/GenericEntryDelegate.qml +++ b/src/qml/GenericEntryDelegate.qml @@ -328,7 +328,7 @@ Kirigami.SwipeListItem { } }, 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" visible: showStreamingPlayButton onTriggered: { diff --git a/src/qml/GenericEntryListView.qml b/src/qml/GenericEntryListView.qml index fb3b1e49..9c2c2dab 100644 --- a/src/qml/GenericEntryListView.qml +++ b/src/qml/GenericEntryListView.qml @@ -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, removeFromQueueAction, markPlayedAction, @@ -220,6 +233,7 @@ ListView { markNotNewAction, downloadEnclosureAction, deleteEnclosureAction, + streamAction, selectAllAction, selectNoneAction] @@ -266,6 +280,11 @@ ListView { visible: singleSelectedEntry ? (singleSelectedEntry.hasEnclosure ? singleSelectedEntry.enclosure.status !== Enclosure.Downloadable : false) : true 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: { // reset to normal selection if this context menu is closed listView.selectionForContextMenu = listView.selectionModel.selectedIndexes;