Enable chapters also when streaming

This commit is contained in:
Bart De Vries 2022-11-29 22:09:37 +01:00
parent 2fcb7af8e1
commit 0e6cac16c9
1 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/**
* SPDX-FileCopyrightText: 2021 Bart De Vries <bart@mogwai.be>
* SPDX-FileCopyrightText: 2021-2022 Bart De Vries <bart@mogwai.be>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
@ -10,6 +10,7 @@ import QtQuick.Layouts 1.14
import QtMultimedia 5.15
import org.kde.kirigami 2.14 as Kirigami
import org.kde.kasts.solidextras 1.0
import org.kde.kasts 1.0
@ -20,6 +21,9 @@ Kirigami.SwipeListItem {
property var entry: undefined
property var overlay: undefined
property bool streamingAllowed: (NetworkStatus.connectivity !== NetworkStatus.No && (SettingsManager.allowMeteredStreaming || NetworkStatus.metered !== NetworkStatus.Yes))
property bool streamingButtonVisible: entry != undefined && entry.enclosure && (entry.enclosure.status !== Enclosure.Downloaded) && streamingAllowed && (SettingsManager.prioritizeStreaming || AudioManager.entry === entry)
contentItem: ColumnLayout {
Controls.Label {
Layout.fillWidth: true
@ -38,13 +42,16 @@ Kirigami.SwipeListItem {
actions: [
Kirigami.Action {
text: i18n("Play")
icon.name: "media-playback-start"
enabled: entry != undefined && entry.enclosure && entry.enclosure.status === Enclosure.Downloaded
icon.name: streamingButtonVisible ? ":/media-playback-start-cloud" : "media-playback-start"
enabled: entry != undefined && entry.enclosure && (entry.enclosure.status === Enclosure.Downloaded || streamingButtonVisible)
onTriggered: {
if (!entry.queueStatus) {
entry.queueStatus = true;
}
if (AudioManager.entry != entry) {
AudioManager.entry = entry;
}
if (AudioManager.playbbackState !== Audio.PlayingState) {
if (AudioManager.playbackState !== Audio.PlayingState) {
AudioManager.play();
}
AudioManager.position = start * 1000;