Warning, /maui/clip/src/views/player/Playlist.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick 2.14
0002 import QtQml 2.14
0003 import QtQuick.Controls 2.14
0004 import QtQuick.Layouts 1.3
0005 import org.mauikit.controls 1.3 as Maui
0006 import org.maui.clip 1.0 as Clip
0007 
0008 import ".."
0009 
0010 Maui.ListBrowser
0011 {
0012     id: control
0013 
0014     property alias list : _collectionList
0015     property alias listModel: _collectionModel
0016 
0017     clip: true
0018 
0019     holder.visible: list.count === 0
0020     holder.emoji: "qrc:/img/assets/media-playlist-append.svg"
0021     holder.title: i18n("No Videos!")
0022     holder.body: i18n("Add videos to the playlist.")
0023 
0024     Binding on currentIndex
0025     {
0026         value: _playerView.currentVideoIndex
0027         restoreMode: Binding.RestoreBindingOrValue
0028     }
0029 
0030     model: Maui.BaseModel
0031     {
0032         id: _collectionModel
0033         recursiveFilteringEnabled: true
0034         sortCaseSensitivity: Qt.CaseInsensitive
0035         filterCaseSensitivity: Qt.CaseInsensitive
0036         list: Clip.Videos
0037         {
0038             id: _collectionList
0039         }
0040     }
0041 
0042     ItemMenu
0043     {
0044         id: _menu
0045         index: control.currentIndex
0046         model: control.model
0047     }
0048 
0049     delegate: Maui.ListBrowserDelegate
0050     {
0051         id: _listDelegate
0052         width: ListView.view.width
0053 
0054         isCurrentItem: ListView.isCurrentItem
0055         draggable: true
0056         tooltipText: model.url
0057 
0058         label1.text: model.label
0059         label2.text: Qt.formatDateTime(new Date(model.modified), "d MMM yyyy")
0060         imageSource: model.thumbnail
0061         template.fillMode: Image.PreserveAspectCrop
0062 
0063         ToolButton
0064         {
0065             Layout.fillHeight: true
0066             Layout.preferredWidth: implicitWidth
0067             visible: (Maui.Handy.isTouch ? true : _listDelegate.hovered)
0068             icon.name: "edit-clear"
0069             onClicked:
0070             {
0071                 if(index === _playerView.currentVideoIndex)
0072                     player.video.stop()
0073 
0074                 _collectionList.remove(index)
0075             }
0076 
0077             opacity: _listDelegate.hovered ? 0.8 : 0.6
0078         }
0079 
0080 
0081         onToggled:
0082         {
0083             control.currentView.itemsSelected([index])
0084         }
0085 
0086         onClicked: (mouse) =>
0087         {
0088             control.currentIndex = index
0089 
0090             if(selectionMode || (mouse.button == Qt.LeftButton && (mouse.modifiers & Qt.ControlModifier)))
0091             {
0092                 control.currentView.itemsSelected([index])
0093             }else if(Maui.Handy.singleClick)
0094             {
0095                 playAt(index)
0096             }
0097         }
0098 
0099         onDoubleClicked:
0100         {
0101             control.currentIndex = index
0102 
0103             if(!Maui.Handy.singleClick && !selectionMode)
0104             {
0105                 playAt(index)
0106             }
0107         }
0108 
0109         //        onPressAndHold:
0110         //        {
0111         //            control.currentIndex = index
0112         //            _menu.popup()
0113         //        }
0114 
0115         //        onRightClicked:
0116         //        {
0117         //            control.currentIndex = index
0118         //            _menu.popup()
0119         //        }
0120     }
0121 
0122     function append(item)
0123     {
0124         console.log("Queue item<<" , item, item.url)
0125 
0126         control.list.append(item)
0127     }
0128 }
0129