Warning, /multimedia/audiotube/src/contents/ui/dialogs/PlaylistDialog.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2023 Mathis BrĂ¼chert <mbb@kaidan.im>
0002 //
0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 import QtQuick 2.15
0006 import QtQuick.Controls 2.12 as Controls
0007 import QtQuick.Layouts 1.3
0008 import org.kde.kirigami 2.19 as Kirigami
0009 
0010 import org.kde.ytmusic 1.0
0011 import ".."
0012 
0013 
0014 Kirigami.PromptDialog {
0015     id: playlistsDialog
0016     contentLeftPadding:0
0017     contentRightPadding:0
0018     contentTopPadding:0
0019     contentBottomPadding:0
0020     title:i18n("Add Song to Playlist")
0021 
0022     property string videoId
0023     property string songTitle
0024     property string artists
0025     property string album: ""
0026     standardButtons: Kirigami.Dialog.NoButton
0027     customFooterActions: [
0028         Kirigami.Action {
0029             text: i18n("New Playlist")
0030             icon.name: "list-add"
0031             onTriggered: {
0032                 addPlaylistDialog.open()
0033             }
0034         }
0035     ]
0036 
0037     Item {
0038         AddPlaylistDialog {
0039             id: addPlaylistDialog
0040             model: localPlaylistsModel
0041         }
0042         ImportPlaylistDialog {
0043             id: importPlaylistDialog
0044             model: localPlaylistsModel
0045         }
0046     }
0047 
0048     mainItem: ListView {
0049         reuseItems: true
0050 
0051         implicitHeight: 200
0052         model: LocalPlaylistsModel {
0053             id: localPlaylistsModel
0054         }
0055         delegate: Controls.ItemDelegate {
0056             required property string title
0057             required property string description
0058             required property int playlistId
0059             required property var thumbnailIds
0060             required property int index
0061 
0062             width: parent.width
0063 
0064             contentItem: RowLayout {
0065                 Layout.fillHeight: true
0066                 LocalPlaylistModel{id:localPlaylistModel}
0067                 ThumbnailSource {
0068                     id: thumbnailSource1
0069                     videoId: thumbnailIds[0] ?? ""
0070                 }
0071                 ThumbnailSource {
0072                     id: thumbnailSource2
0073                     videoId: thumbnailIds[1] ?? thumbnailIds[0] ?? ""
0074                 }
0075                 ThumbnailSource {
0076                     id: thumbnailSource3
0077                     videoId: thumbnailIds[2] ?? thumbnailIds[0] ?? ""
0078                 }
0079                 ThumbnailSource {
0080                     id: thumbnailSource4
0081                     videoId: thumbnailIds[3] ?? thumbnailIds[0] ?? ""
0082                 }
0083                 PlaylistCover {
0084                     source1: thumbnailSource1.cachedPath
0085                     source2: thumbnailSource2.cachedPath
0086                     source3: thumbnailSource3.cachedPath
0087                     source4: thumbnailSource4.cachedPath
0088                     height: 35
0089                     width: height
0090                     radius: 5
0091                 }
0092 
0093                 ColumnLayout {
0094                     Controls.Label {
0095                         Layout.fillWidth: true
0096                         text: title
0097                         elide: Qt.ElideRight
0098                     }
0099 
0100                     Controls.Label {
0101                         Layout.fillWidth: true
0102                         visible: description
0103                         color: Kirigami.Theme.disabledTextColor
0104                         text: description
0105                         elide: Qt.ElideRight
0106 
0107                     }
0108                 }
0109             }
0110 
0111             onClicked: {
0112                 localPlaylistsModel.addPlaylistEntry(playlistId, videoId, songTitle, artists, album )
0113                 playlistsDialog.close()
0114             }
0115         }
0116     }
0117 }
0118 
0119