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

0001 /**
0002  * SPDX-FileCopyrightText: 2021-2023 Bart De Vries <bart@mogwai.be>
0003  * SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
0004  *
0005  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006  */
0007 
0008 import QtQuick
0009 import QtQuick.Controls as Controls
0010 import QtQuick.Layouts
0011 
0012 import org.kde.kirigami as Kirigami
0013 import org.kde.kmediasession
0014 
0015 import org.kde.kasts
0016 
0017 import ".."
0018 
0019 Item {
0020     property int miniplayerheight: Kirigami.Units.gridUnit * 3
0021     property int progressbarheight: Kirigami.Units.gridUnit / 6
0022     property int buttonsize: Kirigami.Units.gridUnit * 1.5
0023     height: miniplayerheight + progressbarheight
0024 
0025     visible: AudioManager.entry
0026 
0027     // progress bar for limited width (phones)
0028     Rectangle {
0029         id: miniprogressbar
0030         z: 1
0031         anchors.top: parent.top
0032         anchors.left: parent.left
0033         height: parent.progressbarheight
0034         color: Kirigami.Theme.highlightColor
0035         width: parent.width * AudioManager.position / AudioManager.duration
0036         visible: true
0037     }
0038 
0039     ChapterModel {
0040         id: chapterModel
0041         entry: AudioManager.entry ?? undefined
0042     }
0043 
0044     RowLayout {
0045         id: footerrowlayout
0046         anchors.fill: parent
0047         spacing: 0
0048 
0049         Rectangle {
0050             Layout.fillHeight: true
0051             Layout.fillWidth: true
0052 
0053             // press feedback
0054             color: (trackClick.pressed || trackClick.containsMouse) ? Qt.rgba(0, 0, 0, 0.05) : "transparent"
0055 
0056             RowLayout {
0057                 anchors.fill: parent
0058 
0059                 ImageWithFallback {
0060                     imageSource: AudioManager.entry ? ((chapterModel.currentChapter && chapterModel.currentChapter !== undefined) ? chapterModel.currentChapter.cachedImage : AudioManager.entry.cachedImage) : "no-image"
0061                     Layout.fillHeight: true
0062                     Layout.preferredWidth: height
0063                 }
0064 
0065                 // track information
0066                 ColumnLayout {
0067                     Layout.maximumHeight: parent.height
0068                     Layout.fillWidth: true
0069                     Layout.leftMargin: Kirigami.Units.smallSpacing
0070                     spacing: Kirigami.Units.smallSpacing
0071 
0072                     Controls.Label {
0073                         id: mainLabel
0074                         text: AudioManager.entry.title
0075                         wrapMode: Text.Wrap
0076                         Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
0077                         Layout.fillWidth: true
0078                         horizontalAlignment: Text.AlignLeft
0079                         elide: Text.ElideRight
0080                         maximumLineCount: 1
0081                         font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1
0082                         font.weight: Font.Medium
0083                     }
0084 
0085                     Controls.Label {
0086                         id: feedLabel
0087                         text: AudioManager.entry.feed.name
0088                         wrapMode: Text.Wrap
0089                         Layout.alignment: Qt.AlignLeft | Qt.AlignTop
0090                         Layout.fillWidth: true
0091                         horizontalAlignment: Text.AlignLeft
0092                         elide: Text.ElideRight
0093                         maximumLineCount: 1
0094                         opacity: 0.6
0095                         font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1
0096                     }
0097                 }
0098             }
0099             MouseArea {
0100                 id: trackClick
0101                 anchors.fill: parent
0102                 hoverEnabled: true
0103                 onClicked: toOpen.restart()
0104             }
0105         }
0106         Controls.Button {
0107             id: playButton
0108             icon.name: AudioManager.playbackState === KMediaSession.PlayingState ? "media-playback-pause" : "media-playback-start"
0109             icon.height: parent.parent.buttonsize
0110             icon.width: parent.parent.buttonsize
0111             flat: true
0112             Layout.preferredHeight: parent.parent.miniplayerheight - Kirigami.Units.smallSpacing * 2
0113             Layout.preferredWidth: height
0114             Layout.leftMargin: Kirigami.Units.smallSpacing
0115             Layout.rightMargin: Kirigami.Units.smallSpacing
0116             onClicked: AudioManager.playbackState === KMediaSession.PlayingState ? AudioManager.pause() : AudioManager.play()
0117             Layout.alignment: Qt.AlignVCenter
0118         }
0119     }
0120 }
0121