Warning, /multimedia/kasts/src/qml/QueuePage.qml is written in an unsupported language. File is not indexed.

0001 /**
0002  * SPDX-FileCopyrightText: 2021-2022 Bart De Vries <bart@mogwai.be>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 import QtQuick
0008 import QtQuick.Controls as Controls
0009 import QtQuick.Layouts
0010 import QtQml.Models
0011 
0012 import org.kde.kirigami as Kirigami
0013 
0014 import org.kde.kasts
0015 
0016 Kirigami.ScrollablePage {
0017     id: queuepage
0018     title: i18nc("@title:column Page showing the list queued items", "Queue")
0019 
0020     property var lastEntry: ""
0021     property string pageName: "queuepage"
0022     property alias queueList: queueList
0023 
0024     LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
0025     LayoutMirroring.childrenInherit: true
0026 
0027     supportsRefreshing: true
0028     onRefreshingChanged: {
0029         if(refreshing)  {
0030             updateAllFeeds.run();
0031             refreshing = false;
0032         }
0033     }
0034 
0035     readonly property list<Kirigami.Action> pageActions: [
0036         Kirigami.Action {
0037             icon.name: "view-refresh"
0038             text: i18nc("@action:intoolbar", "Refresh All Podcasts")
0039             onTriggered: refreshing = true
0040         }
0041     ]
0042 
0043     Component.onCompleted: {
0044         for (var i in queueList.defaultActionList) {
0045             pageActions.push(queueList.defaultActionList[i]);
0046         }
0047     }
0048 
0049     actions: pageActions
0050 
0051     GenericEntryListView {
0052         id: queueList
0053         reuseItems: true
0054         isQueue: true
0055 
0056         Kirigami.PlaceholderMessage {
0057             visible: queueList.count === 0
0058 
0059             width: Kirigami.Units.gridUnit * 20
0060             anchors.centerIn: parent
0061 
0062             text: i18nc("@info", "Queue is empty")
0063         }
0064 
0065         header: ColumnLayout {
0066             anchors.right: parent.right
0067             anchors.left: parent.left
0068             Controls.Label {
0069                 Layout.fillWidth: true
0070                 horizontalAlignment: Text.AlignHCenter
0071                 text: i18ncp("@info:progress", "1 Episode", "%1 Episodes", queueModel.rowCount()) + "  ยท  " + i18nc("@info:progress", "Time Left") + ": " + queueModel.formattedTimeLeft
0072             }
0073             Kirigami.Separator {
0074                 Layout.fillWidth: true
0075             }
0076         }
0077 
0078         model: QueueModel {
0079             id: queueModel
0080         }
0081 
0082         delegate: FocusScope {
0083             width: queueList.width
0084             height: entryDelegate.height
0085             GenericEntryDelegate {
0086                 id: entryDelegate
0087                 width: parent.width
0088                 isQueue: true
0089                 listView: queueList
0090                 listViewObject: queueList
0091                 focus: parent.visualFocus || parent.activeFocus
0092             }
0093         }
0094 
0095         moveDisplaced: Transition {
0096             YAnimator {
0097                 duration: Kirigami.Units.longDuration
0098                 easing.type: Easing.InOutQuad
0099             }
0100         }
0101     }
0102 }