Warning, /multimedia/plasmatube/src/ui/videoplayer/MinimizedVideoPlayer.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
0002 // SPDX-License-Identifier: GPL-3.0-or-later
0003 
0004 import QtQuick
0005 import QtQuick.Controls as QQC2
0006 import QtQuick.Layouts
0007 import Qt5Compat.GraphicalEffects
0008 
0009 import org.kde.kirigami as Kirigami
0010 import org.kde.plasmatube
0011 
0012 Rectangle {
0013     id: root
0014     property alias previewSource: blur.source
0015 
0016     property string videoName
0017     property string channelName
0018 
0019     readonly property bool isPlaying: PlasmaTube.videoController.currentPlayer ? !PlasmaTube.videoController.currentPlayer.paused : false
0020 
0021     signal toggleRequested()
0022     signal stopRequested()
0023     signal openRequested()
0024     signal nextRequested()
0025 
0026     color: Kirigami.Theme.backgroundColor
0027 
0028     Kirigami.Theme.colorSet: Kirigami.Theme.View
0029     Kirigami.Theme.inherit: false
0030 
0031     RowLayout {
0032         anchors.fill: parent
0033         spacing: 0
0034 
0035         Rectangle {
0036             Layout.fillHeight: true
0037             Layout.fillWidth: true
0038 
0039             // press feedback
0040             color: (trackClick.pressed || trackClick.containsMouse) ? Qt.rgba(0, 0, 0, 0.1) : "transparent"
0041 
0042             RowLayout {
0043                 spacing: Kirigami.Units.largeSpacing
0044                 anchors.fill: parent
0045 
0046                 // video preview
0047                 FastBlur {
0048                     id: blur
0049                     radius: 0
0050                     Layout.fillHeight: true
0051                     implicitWidth: Kirigami.Units.gridUnit * 3
0052                 }
0053 
0054                 ColumnLayout {
0055                     spacing: Kirigami.Units.smallSpacing
0056                     Layout.fillWidth: true
0057                     Layout.alignment: Qt.AlignVCenter
0058 
0059                     QQC2.Label {
0060                         Layout.fillWidth: true
0061                         text: root.videoName
0062                         elide: Text.ElideRight
0063                     }
0064 
0065                     QQC2.Label {
0066                         Layout.fillWidth: true
0067                         font: Kirigami.Theme.smallFont
0068                         text: root.channelName
0069                         elide: Text.ElideRight
0070                         opacity: 0.9
0071                     }
0072                 }
0073             }
0074 
0075             MouseArea {
0076                 id: trackClick
0077                 anchors.fill: parent
0078                 hoverEnabled: true
0079                 onClicked: root.openRequested()
0080             }
0081         }
0082 
0083         QQC2.Button {
0084             flat: true
0085             Layout.leftMargin: Kirigami.Units.smallSpacing
0086             Layout.rightMargin: Kirigami.Units.smallSpacing
0087             Layout.fillHeight: true
0088             Layout.alignment: Qt.AlignVCenter
0089             icon.name: root.isPlaying ? "media-playback-pause" : "media-playback-start"
0090             icon.height: Kirigami.Units.iconSizes.small
0091             icon.width: Kirigami.Units.iconSizes.small
0092             onClicked: root.toggleRequested()
0093         }
0094 
0095         QQC2.Button {
0096             flat: true
0097             Layout.leftMargin: Kirigami.Units.smallSpacing
0098             Layout.rightMargin: Kirigami.Units.smallSpacing
0099             Layout.fillHeight: true
0100             Layout.alignment: Qt.AlignVCenter
0101             icon.name: "media-playback-stop"
0102             icon.height: Kirigami.Units.iconSizes.small
0103             icon.width: Kirigami.Units.iconSizes.small
0104             onClicked: root.stopRequested()
0105         }
0106 
0107         QQC2.Button {
0108             flat: true
0109             Layout.leftMargin: Kirigami.Units.smallSpacing
0110             Layout.rightMargin: Kirigami.Units.smallSpacing
0111             Layout.fillHeight: true
0112             Layout.alignment: Qt.AlignVCenter
0113             icon.name: "media-skip-forward"
0114             icon.height: Kirigami.Units.iconSizes.small
0115             icon.width: Kirigami.Units.iconSizes.small
0116             onClicked: root.nextRequested()
0117         }
0118     }
0119 }