mirror of https://github.com/KDE/kasts.git
Queue is functional again
This commit is contained in:
parent
5e0772eb63
commit
4f11060a41
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2021 (c) Bart De Vries <bart@mogwai.be>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
// Includes relevant modules used by the QML
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0 as Controls
|
||||
import QtQuick.Layouts 1.2
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
import QtMultimedia 5.15
|
||||
import org.kde.alligator 1.0
|
||||
|
||||
|
||||
Kirigami.SwipeListItem {
|
||||
id: listItem
|
||||
|
||||
contentItem: RowLayout {
|
||||
Kirigami.ListItemDragHandle {
|
||||
listItem: listItem
|
||||
listView: queueList
|
||||
onMoveRequested: DataManager.moveQueueItem(oldIndex, newIndex)
|
||||
}
|
||||
ColumnLayout {
|
||||
spacing: 0
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Controls.Label {
|
||||
text: model.entry.title
|
||||
Layout.fillWidth: true
|
||||
elide: Text.ElideRight
|
||||
font.weight: model.entry.read ? Font.Normal : Font.Bold
|
||||
opacity: 1
|
||||
}
|
||||
Loader {
|
||||
sourceComponent: entry.enclosure && entry.enclosure.status === Enclosure.Downloading ? downloadProgress : subtitle
|
||||
Layout.fillWidth: true
|
||||
Component {
|
||||
id: subtitle
|
||||
Controls.Label {
|
||||
text: model.entry.updated.toLocaleString(Qt.locale(), Locale.ShortFormat) + (model.entry.authors.length === 0 ? "" : " " + i18nc("by <author(s)>", "by") + " " + model.entry.authors[0].name)
|
||||
Layout.fillWidth: true
|
||||
elide: Text.ElideRight
|
||||
font: Kirigami.Theme.smallFont
|
||||
opacity: model.entry.read ? 0.7 : 0.9
|
||||
visible: !downloadProgress.visible
|
||||
}
|
||||
}
|
||||
Component {
|
||||
id: downloadProgress
|
||||
Controls.ProgressBar {
|
||||
from: 0
|
||||
to: 100
|
||||
value: model.entry.enclosure.downloadProgress
|
||||
visible: model.entry.enclosure && model.entry.enclosure.status === Enclosure.Downloading
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
model.entry.read = true
|
||||
pageStack.push("qrc:/EntryPage.qml", {"entry": model.entry})
|
||||
}
|
||||
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
iconName: "media-playback-start"
|
||||
text: "Play"
|
||||
onTriggered: {
|
||||
audio.entry = model.entry
|
||||
audio.play()
|
||||
}
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Download")
|
||||
icon.name: "download"
|
||||
onTriggered: model.entry.enclosure.download()
|
||||
visible: model.entry.enclosure && model.entry.enclosure.status === Enclosure.Downloadable
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Cancel download")
|
||||
icon.name: "edit-delete-remove"
|
||||
onTriggered: model.entry.enclosure.cancelDownload()
|
||||
visible: model.entry.enclosure && model.entry.enclosure.status === Enclosure.Downloading
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Delete download")
|
||||
icon.name: "delete"
|
||||
onTriggered: model.entry.enclosure.deleteFile()
|
||||
visible: model.entry.enclosure && model.entry.enclosure.status === Enclosure.Downloaded
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -15,50 +15,33 @@ import org.kde.alligator 1.0
|
|||
Kirigami.ScrollablePage {
|
||||
id: queuepage
|
||||
title: i18n("Queue")
|
||||
Component {
|
||||
id: delegateComponent
|
||||
Kirigami.SwipeListItem {
|
||||
id: listItem
|
||||
contentItem: RowLayout {
|
||||
Kirigami.ListItemDragHandle {
|
||||
listItem: listItem
|
||||
listView: mainList
|
||||
onMoveRequested: DataManager.moveQueueItem(oldIndex, newIndex)
|
||||
|
||||
Kirigami.PlaceholderMessage {
|
||||
visible: queueList.count === 0
|
||||
|
||||
width: Kirigami.Units.gridUnit * 20
|
||||
anchors.centerIn: parent
|
||||
|
||||
text: i18n("Nothing added to the queue yet")
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
Layout.fillWidth: true
|
||||
height: Math.max(implicitHeight, Kirigami.Units.iconSizes.smallMedium)
|
||||
text: model.entry.title
|
||||
color: listItem.checked || (listItem.pressed && !listItem.checked && !listItem.sectionDelegate) ? listItem.activeTextColor : listItem.textColor
|
||||
}
|
||||
}
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
iconName: "media-playback-start"
|
||||
text: "Play"
|
||||
onTriggered: {
|
||||
audio.entry = model.entry
|
||||
audio.play()
|
||||
}
|
||||
},
|
||||
Kirigami.Action {
|
||||
iconName: "delete"
|
||||
text: i18n("Delete download")
|
||||
onTriggered: model.entry.enclosure.deleteFile()
|
||||
visible: model.entry.enclosure && model.entry.enclosure.status === Enclosure.Downloaded
|
||||
}
|
||||
]
|
||||
onClicked: {
|
||||
pageStack.push("qrc:/EntryPage.qml", {"entry": model.entry})
|
||||
}
|
||||
}
|
||||
Component {
|
||||
id: delegateComponent
|
||||
QueueDelegate { }
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: mainList
|
||||
id: queueList
|
||||
visible: count !== 0
|
||||
|
||||
model: root.queueModel
|
||||
model: QueueModel {
|
||||
id: queueModel
|
||||
}
|
||||
delegate: Kirigami.DelegateRecycler {
|
||||
width: queueList.width
|
||||
sourceComponent: delegateComponent
|
||||
}
|
||||
anchors.fill: parent
|
||||
|
||||
moveDisplaced: Transition {
|
||||
YAnimator {
|
||||
|
@ -66,10 +49,6 @@ Kirigami.ScrollablePage {
|
|||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
delegate: Kirigami.DelegateRecycler {
|
||||
width: mainList.width
|
||||
sourceComponent: delegateComponent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,10 +70,6 @@ Kirigami.ApplicationWindow {
|
|||
id: feedList
|
||||
}
|
||||
|
||||
QueueModel {
|
||||
id: queueModel
|
||||
}
|
||||
|
||||
QueuePage {
|
||||
id: queuelist
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<file alias="PlayerControls.qml">qml/PlayerControls.qml</file>
|
||||
<file alias="FooterBar.qml">qml/FooterBar.qml</file>
|
||||
<file alias="QueuePage.qml">qml/QueuePage.qml</file>
|
||||
<file alias="QueueDelegate.qml">qml/QueueDelegate.qml</file>
|
||||
<file>qtquickcontrols2.conf</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Loading…
Reference in New Issue