Warning, /plasma/plank-player/app/qml/main.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2021 Aditya Mehra <aix.m@outlook.com> 0002 // 0003 // SPDX-License-Identifier: GPL-2.0-or-later 0004 0005 import QtQuick 2.15 0006 import QtQuick.Window 2.15 0007 import QtQuick.Layouts 1.15 0008 import org.kde.kirigami 2.19 as Kirigami 0009 import QtQuick.Controls 2.15 as Controls 0010 import QtMultimedia 0011 0012 Kirigami.AbstractApplicationWindow { 0013 id: window 0014 visible: true 0015 title: i18n("PlankPlayer") 0016 color: Kirigami.Theme.backgroundColor 0017 width: Screen.desktopAvailableWidth 0018 height: Screen.desktopAvailableHeight 0019 visibility: "FullScreen" 0020 property var videoSource: argumentFileUrl ? argumentFileUrl : "" 0021 0022 Component.onCompleted: { 0023 console.log(HomeDirectory) 0024 playerOSDItem.opened = true 0025 if(videoSource !== "") { 0026 video.source = videoSource 0027 video.play() 0028 } 0029 } 0030 0031 onVideoSourceChanged: { 0032 if(videoSource !== ""){ 0033 video.source = Qt.resolvedUrl(videoSource) 0034 playerOSDItem.opened = true 0035 video.play() 0036 } 0037 } 0038 0039 Rectangle { 0040 anchors.fill: parent 0041 color: "black" 0042 0043 Menu { 0044 id: mainMenu 0045 onClosed: { 0046 playerOSDItem.opened = true 0047 } 0048 } 0049 0050 Video { 0051 id: video 0052 anchors.top: parent.top 0053 anchors.left: parent.left 0054 anchors.right: parent.right 0055 anchors.bottom: playerOSDItem.opened ? playerOSDItem.top : parent.bottom 0056 focus: true 0057 0058 Keys.onDownPressed: (event)=> { 0059 playerOSDItem.opened = true 0060 } 0061 0062 MouseArea { 0063 anchors.fill: parent 0064 onClicked: (mouse)=> { 0065 if(!playerOSDItem.pinned){ 0066 playerOSDItem.opened = !playerOSDItem.opened 0067 } 0068 } 0069 } 0070 0071 onPlaybackStateChanged: { 0072 if(video.playbackState == MediaPlayer.StoppedState){ 0073 video.stop() 0074 } 0075 } 0076 } 0077 0078 PlayerOSD { 0079 id: playerOSDItem 0080 anchors.bottom: parent.bottom 0081 height: parent.height * 0.10 0082 videoItem: video 0083 menuOpened: mainMenu.opened 0084 } 0085 } 0086 }