Warning, /multimedia/audiotube/src/contents/ui/AlbumPage.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2021 Jonah Brüchert <jbb@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 org.kde.kirigami 2.14 as Kirigami
0007 import QtQuick.Controls 2.14 as Controls
0008 import QtQuick.Layouts 1.3
0009
0010 import org.kde.ytmusic 1.0
0011
0012 import "components"
0013
0014 Kirigami.ScrollablePage {
0015 id: root
0016 property string browseId
0017 title: albumModel.title
0018
0019 DoubleActionButton {
0020 id: action
0021 visible: false
0022 property bool shown
0023 shown: !root.flickable.atYBeginning
0024 onShownChanged:
0025 if(shown){
0026 visible = true
0027 appear.running = true
0028 } else {
0029 disappear.running = true
0030 }
0031
0032 parent: overlay
0033 x: root.width - width - margin
0034 y: root.height - height - margin
0035 NumberAnimation on y {
0036 id: appear
0037 easing.type: Easing.InCubic
0038 running: false
0039 from: root.height
0040 to: root.height - action.height - action.margin
0041 duration: 100
0042 }
0043 NumberAnimation on y {
0044 id: disappear
0045 easing.type: Easing.OutCubic
0046 running: false
0047 from: root.height - action.height - action.margin
0048 to: root.height
0049 duration: 100
0050 onFinished: action.visible = false
0051 }
0052 rightAction: Kirigami.Action {
0053 icon.name: "media-playlist-shuffle"
0054 onTriggered: applicationWindow().playShufflePlaylist(albumModel.playlistId)
0055 text: "Shuffle"
0056 }
0057 leftAction: Kirigami.Action {
0058 icon.name: "media-playback-start"
0059 onTriggered: applicationWindow().playPlaylist(albumModel.playlistId)
0060 text: "Play"
0061 }
0062 }
0063
0064 ListView {
0065 id: songList
0066 footer: Item { height: 60 }
0067 header: ListHeader {
0068 visibleActions: [
0069 Kirigami.Action {
0070 icon.name: "media-playback-start"
0071 text: i18n("Play")
0072 onTriggered: {
0073 applicationWindow().playPlaylist(albumModel.playlistId)
0074 }
0075 },
0076 Kirigami.Action {
0077 icon.name: "media-playlist-shuffle"
0078 text: i18n("Shuffle")
0079 onTriggered: {
0080 applicationWindow().playShufflePlaylist(albumModel.playlistId)
0081 }
0082 }
0083 ]
0084 overflowActions: [
0085 Kirigami.Action {
0086 text: i18n("Append to queue")
0087 icon.name: "media-playlist-append"
0088 onTriggered: UserPlaylistModel.appendAlbum(albumModel)
0089 },
0090 Kirigami.Action {
0091 text: i18n("Open in Browser")
0092 icon.name: "internet-services"
0093 onTriggered: Qt.openUrlExternally(albumModel.webUrl)
0094 },
0095 Kirigami.Action {
0096 text: i18n("Share")
0097 icon.name: "emblem-shared-symbolic"
0098 onTriggered:{
0099 openShareMenu(albumModel.title, albumModel.webUrl)
0100 }
0101 }
0102
0103 ]
0104 title: albumModel.title
0105 imageSourceURL: albumModel.thumbnailUrl
0106 subtitle: i18n("Album • %1" , albumModel.artists)
0107 width: songList.width
0108 }
0109
0110
0111 reuseItems: true
0112
0113 model: AlbumModel {
0114 id: albumModel
0115
0116 browseId: root.browseId
0117 }
0118 SongMenu {
0119 id: menu
0120 }
0121 delegate: Controls.ItemDelegate {
0122 id: delegateItem
0123
0124 required property string title
0125 required property string videoId
0126 required property var artists
0127 required property string thumbnailUrl
0128 required property string artistsDisplayString
0129 required property int index
0130
0131 width: parent.width
0132
0133 contentItem: MouseArea {
0134 implicitHeight: content.implicitHeight
0135 acceptedButtons: Qt.LeftButton | Qt.RightButton
0136 onClicked: if (mouse.button === Qt.RightButton) {
0137 menu.openForSong(delegateItem.videoId, delegateItem.title, delegateItem.artists, delegateItem.artistsDisplayString)
0138 } else if (mouse.button === Qt.LeftButton) {
0139 play(delegateItem.videoId)
0140 }
0141 RowLayout {
0142 id: content
0143 anchors.fill: parent
0144 Controls.Label {
0145 text: (delegateItem.index + 1)
0146 font.bold: true
0147 leftPadding: 5
0148 color: Kirigami.Theme.disabledTextColor
0149 Layout.preferredWidth: 30
0150 }
0151
0152 Controls.Label {
0153 Layout.fillWidth: true
0154 text: delegateItem.title
0155 elide: Qt.ElideRight
0156 }
0157
0158 Controls.ToolButton {
0159 icon.name: "overflow-menu"
0160 text: i18n("More")
0161 display: Controls.AbstractButton.IconOnly
0162 onClicked: menu.openForSong(delegateItem.videoId, delegateItem.title, delegateItem.artists, delegateItem.artistsDisplayString)
0163 }
0164 }
0165 }
0166 }
0167
0168 Controls.BusyIndicator {
0169 anchors.centerIn: parent
0170 visible: albumModel.loading
0171 }
0172 }
0173 }