Warning, /plasma/plank-player/app/qml/Menu.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 Qt.labs.folderlistmodel 2.4
0011 import QtMultimedia
0012
0013 Controls.Popup {
0014 id: menuPopupArea
0015 width: parent.width / 2
0016 height: parent.height / 2
0017 x: (parent.width - width) / 2
0018 y: (parent.height - height) / 2
0019 dim: true
0020
0021 onOpened: {
0022 if(testModelView.count > 0){
0023 testModelView.forceActiveFocus()
0024 } else {
0025 fileModelFolderSelector.forceActiveFocus()
0026 }
0027 }
0028
0029 Controls.Overlay.modeless: Rectangle {
0030 color: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.77)
0031 }
0032
0033 background: Rectangle {
0034 Kirigami.Theme.colorSet: Kirigami.Theme.View
0035 color: Kirigami.Theme.backgroundColor
0036 border.color: "black"
0037 }
0038
0039 FolderListModel {
0040 id: folderModel
0041 folder: Qt.resolvedUrl("file://" + HomeDirectory)
0042 rootFolder: Qt.resolvedUrl("file:///")
0043 showDirs: true
0044 showFiles: false
0045 showDotAndDotDot: true
0046 nameFilters: [".*"]
0047 }
0048
0049 FolderListModel {
0050 id: fileModel
0051 folder: folderModel.folder
0052 showDirs: false
0053 showDotAndDotDot: false
0054 showOnlyReadable: true
0055 nameFilters: ["*.WEBM", "*.MPG", "*.MP2", "*.MPEG", "*.MPE", "*.MPV", "*.OGG", "*.MP4", "*.M4P", "*.M4V", "*.MKV", "*.AVI", "*.WMV", "*.MOV", "*.QT", "*.FLV", "*.SWF", "*.AVCHD", "*.264", "*.3G2", "*.3GP", "*.3MM", "*.3P2", "*.DIVX", "*.DVM", "*.DVR", "*.DVX", "*.F4V", "*.M2V", "*.M4E", "*.M4U", "*.M4V", "*.MJP", "*.MJ2", "*.MK3D", "*.MP4V", "*.MPG2", "*.MQV", "*.OGV", "*.TS", "*.VP6", "*.VP7", "*.VP8", "*.VP9", "*.VRO", "*.XVID", "*.webm", "*.mpg", "*.mp2", "*.mpeg", "*.mpe", "*.mpv", "*.ogg", "*.mp4", "*.m4p", "*.m4v", "*.mkv", "*.avi", "*.wmv", "*.mov", "*.qt", "*.flv", "*.swf", "*.avchd", "*.264", "*.3g2", "*.3gp", "*.3mm", "*.3p2", "*.divx", "*.dvm", "*.dvr", "*.dvx", "*.f4v", "*.m2v", "*.m4e", "*.m4u", "*.m4v", "*.mjp", "*.mj2", "*.mk3d", "*.mp4v", "*.mpg2", "*.mqv", "*.ogv", "*.ts", "*.vp6", "*.vp7", "*.vp8", "*.vp9", "*.vro", "*.xvid"]
0056 }
0057
0058 Item {
0059 width: parent.width
0060 height: parent.height
0061
0062 RowLayout {
0063 id: headerAreaBMLPg1
0064 anchors.top: parent.top
0065 anchors.left: parent.left
0066 anchors.right: parent.right
0067 height: Kirigami.Units.gridUnit * 2
0068
0069 Rectangle {
0070 color: Kirigami.Theme.backgroundColor
0071 radius: 10
0072 Layout.fillWidth: true
0073 Layout.fillHeight: true
0074 Layout.margins: Kirigami.Units.smallSpacing
0075
0076 Controls.Label {
0077 anchors.fill: parent
0078 anchors.leftMargin: Kirigami.Units.largeSpacing
0079 anchors.topMargin: Kirigami.Units.smallSpacing
0080 anchors.bottomMargin: Kirigami.Units.smallSpacing
0081 anchors.rightMargin: Kirigami.Units.largeSpacing
0082 color: Kirigami.Theme.textColor
0083 elide: Text.ElideRight
0084 maximumLineCount: 1
0085 text: folderModel.folder.toString().replace("file://", "")
0086 }
0087 }
0088
0089 Controls.Label {
0090 id: backbtnlabelHeading
0091 text: i18n("Press 'esc' or the [←] Back button to close")
0092 Layout.alignment: Qt.AlignRight
0093 }
0094 }
0095
0096 Kirigami.Separator {
0097 id: headrSeptBml
0098 anchors.top: headerAreaBMLPg1.bottom
0099 width: parent.width
0100 height: 1
0101 }
0102
0103 RowLayout {
0104 anchors.top: headrSeptBml.bottom
0105 anchors.left: parent.left
0106 anchors.right: parent.right
0107 anchors.bottom: parent.bottom
0108 anchors.margins: Kirigami.Units.largeSpacing
0109
0110 ListView {
0111 id: fileModelFolderSelector
0112 model: folderModel
0113 Layout.preferredWidth: parent.width * 0.30
0114 Layout.fillHeight: true
0115 keyNavigationEnabled: true
0116 highlightFollowsCurrentItem: true
0117 highlightRangeMode: GridView.ApplyRange
0118 spacing: Kirigami.Units.smallSpacing
0119 clip: true
0120 KeyNavigation.right: testModelView
0121 delegate: MenuButton {
0122 iconSource: "folder"
0123 text: i18n(fileName)
0124
0125 onClicked: (mouse)=> {
0126 folderModel.folder = fileUrl
0127 }
0128 }
0129 }
0130
0131 GridView {
0132 id: testModelView
0133 model: fileModel
0134 Layout.fillWidth: true
0135 Layout.fillHeight: true
0136 cellWidth: parent.width / 6
0137 cellHeight: cellWidth
0138 keyNavigationEnabled: true
0139 highlightFollowsCurrentItem: true
0140 highlightRangeMode: GridView.ApplyRange
0141 snapMode: GridView.SnapToRow
0142 cacheBuffer: width
0143 highlightMoveDuration: Kirigami.Units.longDuration
0144 clip: true
0145 KeyNavigation.left: fileModelFolderSelector
0146 enabled: fileModel.count > 0 ? 1 :0
0147 delegate: FileItemDelegate {
0148 onClicked: (mouse)=> {
0149 window.videoSource = fileUrl
0150 menuPopupArea.close()
0151 }
0152 }
0153
0154 onCountChanged: {
0155 if(testModelView.count > 0){
0156 testModelView.forceActiveFocus()
0157 testModelView.currentIndex = 0
0158 fileModelFolderSelector.currentIndex = 0
0159 } else {
0160 fileModelFolderSelector.forceActiveFocus()
0161 fileModelFolderSelector.currentIndex = 0
0162 }
0163 }
0164
0165 move: Transition {
0166 SmoothedAnimation {
0167 property: "x"
0168 duration: Kirigami.Units.longDuration
0169 }
0170 }
0171 }
0172 }
0173 }
0174 }