[vlc-commits] [Git][videolan/vlc][master] qml: remove PlaylistOverlayMenu

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Oct 20 05:15:31 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
75fdaaa6 by Pierre Lamot at 2023-10-20T04:55:54+00:00
qml: remove PlaylistOverlayMenu

nobody knows this menu exists, modal mode is buggy

- - - - -


6 changed files:

- modules/gui/qt/Makefile.am
- modules/gui/qt/playlist/qml/PlaylistDelegate.qml
- modules/gui/qt/playlist/qml/PlaylistListView.qml
- − modules/gui/qt/playlist/qml/PlaylistOverlayMenu.qml
- modules/gui/qt/vlc.qrc
- po/POTFILES.in


Changes:

=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -974,7 +974,6 @@ libqt_plugin_la_QML = \
 	gui/qt/player/qml/controlbarcontrols/Fallback.qml \
 	gui/qt/playlist/qml/PlaylistDelegate.qml \
 	gui/qt/playlist/qml/PlaylistListView.qml \
-	gui/qt/playlist/qml/PlaylistOverlayMenu.qml \
 	gui/qt/playlist/qml/PlaylistToolbar.qml \
 	gui/qt/playlist/qml/PlaylistDetachedWindow.qml \
 	gui/qt/style/AcrylicController.qml \


=====================================
modules/gui/qt/playlist/qml/PlaylistDelegate.qml
=====================================
@@ -68,9 +68,6 @@ T.ItemDelegate {
     // Optional, but required to drop a drag
     property var acceptDrop
 
-    // Optional, but required for some actions
-    property int mode: -1
-
     // Settings
 
     verticalPadding: VLCStyle.playlistDelegate_verticalPadding
@@ -101,19 +98,6 @@ T.ItemDelegate {
 
     // Functions
 
-    function moveSelected() {
-        const selectedIndexes = view.model.getSelection()
-        if (selectedIndexes.length === 0)
-            return
-        let preTarget = index
-        /* move to _above_ the clicked item if move up, but
-         * _below_ the clicked item if move down */
-        if (preTarget > selectedIndexes[0])
-            preTarget++
-        view.currentIndex = selectedIndexes[0]
-        view.model.moveItemsPre(selectedIndexes, preTarget)
-    }
-
     // Childs
 
     readonly property ColorContext colorContext: ColorContext {
@@ -282,11 +266,7 @@ T.ItemDelegate {
         onClicked: {
             /* to receive keys events */
             view.forceActiveFocus(Qt.MouseFocusReason)
-            if (mode === PlaylistListView.Mode.Move) {
-                moveSelected()
-                return
-            } else if (mode === PlaylistListView.Mode.Select) {
-            } else if (!(view.model.isSelected(index) && mouse.button === Qt.RightButton)) {
+            if (!(view.model.isSelected(index) && mouse.button === Qt.RightButton)) {
                 view.updateSelection(mouse.modifiers, view.currentIndex, index)
                 view.currentIndex = index
             }
@@ -296,7 +276,7 @@ T.ItemDelegate {
         }
 
         onDoubleClicked: {
-            if (mouse.button !== Qt.RightButton && (mode >= 0 && mode === PlaylistListView.Mode.Normal))
+            if (mouse.button !== Qt.RightButton)
                 MainPlaylistController.goTo(index, true)
         }
 
@@ -324,11 +304,7 @@ T.ItemDelegate {
             acceptedDevices: PointerDevice.TouchScreen
             
             onTapped: {
-                if (mode >= 0 && mode === PlaylistListView.Mode.Normal) {
-                    MainPlaylistController.goTo(index, true)
-                } else if (mode >= 0 && mode === PlaylistListView.Mode.Move) {
-                    moveSelected()
-                }
+                MainPlaylistController.goTo(index, true)
             }
 
             onLongPressed: {


=====================================
modules/gui/qt/playlist/qml/PlaylistListView.qml
=====================================
@@ -68,14 +68,6 @@ T.Pane {
         enabled: root.enabled
     }
 
-    property int mode: PlaylistListView.Mode.Normal
-
-    enum Mode {
-        Normal,
-        Select, // Keyboard item selection mode, activated through PlaylistOverlayMenu
-        Move // Keyboard item move mode, activated through PlaylistOverlayMenu
-    }
-
     function isDropAcceptable(drop, index) {
         if (drop.source === dragItem)
             return Helpers.itemsMovable(drop.source.indexes, index)
@@ -118,25 +110,6 @@ T.Pane {
         listView.forceActiveFocus();
     }
 
-    PlaylistOverlayMenu {
-        id: overlayMenu
-
-        anchors.fill: parent
-        parent: root
-        z: 1
-
-        onVisibleChanged: {
-            if (visible)
-                focus = true
-            else
-                listView.focus = true
-        }
-
-        isRight: true
-        rightPadding: VLCStyle.margin_xsmall + VLCStyle.applicationHorizontalMargin
-        bottomPadding: VLCStyle.margin_large + root.bottomPadding
-    }
-
     Widgets.DragItem {
         id: dragItem
 
@@ -190,20 +163,9 @@ T.Pane {
             }
 
             Widgets.CaptionLabel {
-                color: (root.mode === PlaylistListView.Mode.Select || root.mode === PlaylistListView.Mode.Move)
-                       ? theme.accent : theme.fg.secondary
+                color: theme.fg.secondary
                 visible: model.count !== 0
-                text: {
-                    switch (root.mode) {
-                    case PlaylistListView.Mode.Select:
-                        return I18n.qtr("Selected tracks: %1").arg(model.selectedCount)
-                    case PlaylistListView.Mode.Move:
-                        return I18n.qtr("Moving tracks: %1").arg(model.selectedCount)
-                    case PlaylistListView.Mode.Normal:
-                    default:
-                        return I18n.qtr("%1 elements, %2").arg(model.count).arg(model.duration.formatLong())
-                    }
-                }
+                text: I18n.qtr("%1 elements, %2").arg(model.count).arg(model.duration.formatLong())
             }
         }
 
@@ -455,13 +417,6 @@ T.Pane {
                 isDropAcceptable: root.isDropAcceptable
                 acceptDrop: root.acceptDrop
 
-                mode: root.mode
-
-                BindingCompat on T.ToolTip.visible {
-                    value: false
-                    when: overlayMenu.visible
-                }
-
                 onContainsDragChanged: listView.updateItemContainsDrag(this, containsDrag)
             }
 
@@ -493,70 +448,18 @@ T.Pane {
 
             onSelectAll: root.model.selectAll()
             onSelectionUpdated: {
-                if (root.mode === PlaylistListView.Mode.Select) {
-                    console.log("update selection select")
-                } else if (root.mode === PlaylistListView.Mode.Move) {
-                    const selectedIndexes = root.model.getSelection()
-                    if (selectedIndexes.length === 0)
-                        return
-                    /* always move relative to the first item of the selection */
-                    let target = selectedIndexes[0];
-                    if (newIndex > oldIndex) {
-                        /* move down */
-                        target++
-                    } else if (newIndex < oldIndex && target > 0) {
-                        /* move up */
-                        target--
-                    }
-
-                    listView.currentIndex = selectedIndexes[0]
-                    /* the target is the position _after_ the move is applied */
-                    root.model.moveItemsPost(selectedIndexes, target)
-                } else { // normal
-                    updateSelection(keyModifiers, oldIndex, newIndex);
-                }
+                updateSelection(keyModifiers, oldIndex, newIndex);
             }
 
             Keys.onDeletePressed: onDelete()
-            Keys.onMenuPressed: overlayMenu.open()
 
             Navigation.parentItem: root
-            Navigation.rightAction: function() {
-                overlayMenu.open()
-            }
-            Navigation.leftAction: function() {
-                if (mode === PlaylistListView.Mode.Normal) {
-                    root.Navigation.defaultNavigationLeft()
-                } else {
-                    mode = PlaylistListView.Mode.Normal
-                }
-            }
-            Navigation.cancelAction: function() {
-                if (mode === PlaylistListView.Mode.Normal) {
-                    root.Navigation.defaultNavigationCancel()
-                } else {
-                    mode = PlaylistListView.Mode.Normal
-                }
-            }
-
-            Navigation.upAction: function() {
-                if (mode === PlaylistListView.Mode.Normal)
-                    root.Navigation.defaultNavigationUp()
-            }
-
-            Navigation.downAction: function() {
-                if (mode === PlaylistListView.Mode.Normal)
-                    root.Navigation.defaultNavigationDown()
-            }
 
             onActionAtIndex: {
                 if (index < 0)
                     return
 
-                if (mode === PlaylistListView.Mode.Select)
-                    root.model.toggleSelected(index)
-                else if (mode === PlaylistListView.Mode.Normal)
-                    MainPlaylistController.goTo(index, true)
+                MainPlaylistController.goTo(index, true)
             }
 
             function onDelete() {


=====================================
modules/gui/qt/playlist/qml/PlaylistOverlayMenu.qml deleted
=====================================
@@ -1,230 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2020 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * ( at your option ) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-import QtQuick 2.12
-import QtQuick.Controls 2.12
-
-import org.videolan.vlc 0.1
-
-import "qrc:///widgets/" as Widgets
-import "qrc:///style/"
-
-Widgets.OverlayMenu {
-    id: overlayMenu
-
-    Action {
-        id: playAction
-        text: I18n.qtr("Play")
-        onTriggered: MainPlaylistController.goTo(root.model.getSelection()[0], true)
-        readonly property string fontIcon: VLCIcons.play_filled
-    }
-
-    Action {
-        id: streamAction
-        text: I18n.qtr("Stream")
-        onTriggered: DialogsProvider.streamingDialog(root.model.getSelection().map(function(i) { return root.model.itemAt(i).url; }), false)
-        readonly property string fontIcon: VLCIcons.stream
-    }
-
-    Action {
-        id: saveAction
-        text: I18n.qtr("Save")
-        onTriggered: DialogsProvider.streamingDialog(root.model.getSelection().map(function(i) { return root.model.itemAt(i).url; }))
-    }
-
-    Action {
-        id: infoAction
-        text: I18n.qtr("Information")
-        onTriggered: DialogsProvider.mediaInfoDialog(root.model.itemAt(root.model.getSelection()[0]))
-        icon.source: "qrc:/menu/info.svg"
-    }
-
-    Action {
-        id: exploreAction
-        text: I18n.qtr("Show Containing Directory")
-        onTriggered: MainPlaylistController.explore(root.model.itemAt(root.model.getSelection()[0]))
-        icon.source: "qrc:/menu/folder.svg"
-    }
-
-    Action {
-        id: addFileAction
-        text: I18n.qtr("Add File...")
-        onTriggered: DialogsProvider.simpleOpenDialog(false)
-        readonly property string fontIcon: VLCIcons.add
-    }
-
-    Action {
-        id: addDirAction
-        text: I18n.qtr("Add Directory...")
-        onTriggered: DialogsProvider.PLAppendDir()
-        readonly property string fontIcon: VLCIcons.add
-    }
-
-    Action {
-        id: addAdvancedAction
-        text: I18n.qtr("Advanced Open...")
-        onTriggered: DialogsProvider.PLAppendDialog()
-        readonly property string fontIcon: VLCIcons.add
-    }
-
-    Action {
-        id: savePlAction
-        text: I18n.qtr("Save Playlist to File...")
-        onTriggered: DialogsProvider.savePlayingToPlaylist();
-    }
-
-    Action {
-        id: clearAllAction
-        text: I18n.qtr("Clear Playlist")
-        onTriggered: MainPlaylistController.clear()
-        icon.source: "qrc:/menu/clear.svg"
-    }
-
-    Action {
-        id: selectAllAction
-        text: I18n.qtr("Select All")
-        onTriggered: root.model.selectAll()
-    }
-
-    Action {
-        id: shuffleAction
-        text: I18n.qtr("Shuffle Playlist")
-        onTriggered: MainPlaylistController.shuffle()
-        readonly property string fontIcon: VLCIcons.shuffle
-    }
-
-    Action {
-        id: sortAction
-        text: I18n.qtr("Sort")
-        property alias model: overlayMenu.sortMenu
-    }
-
-    Action {
-        id: selectTracksAction
-        text: I18n.qtr("Select Tracks")
-        onTriggered: root.mode = PlaylistListView.Mode.Select
-        enabled: (root.mode !== PlaylistListView.Mode.Select)
-    }
-
-    Action {
-        id: moveTracksAction
-        text: I18n.qtr("Move Selection")
-        onTriggered: root.mode = PlaylistListView.Mode.Move
-        enabled: (root.mode !== PlaylistListView.Mode.Move)
-    }
-
-    Action {
-        id: deleteAction
-        text: I18n.qtr("Remove Selected")
-        onTriggered: listView.onDelete()
-        enabled: (root.mode !== PlaylistListView.Mode.Move)
-    }
-
-    readonly property var rootMenu: ({
-                                         title: I18n.qtr("Playlist Menu"),
-                                         entries: [
-                                             playAction,
-                                             streamAction,
-                                             saveAction,
-                                             infoAction,
-                                             exploreAction,
-                                             addFileAction,
-                                             addDirAction,
-                                             addAdvancedAction,
-                                             savePlAction,
-                                             clearAllAction,
-                                             selectAllAction,
-                                             shuffleAction,
-                                             sortAction,
-                                             selectTracksAction,
-                                             moveTracksAction,
-                                             deleteAction
-                                         ]
-                                    })
-
-    readonly property var rootMenu_PLEmpty: ({
-                                                 title: I18n.qtr("Playlist Menu"),
-                                                 entries: [
-                                                     addFileAction,
-                                                     addDirAction,
-                                                     addAdvancedAction
-                                                 ]
-                                            })
-
-    readonly property var rootMenu_noSelection: ({
-                                                     title: I18n.qtr("Playlist Menu"),
-                                                     entries: [
-                                                         addFileAction,
-                                                         addDirAction,
-                                                         addAdvancedAction,
-                                                         savePlAction,
-                                                         clearAllAction,
-                                                         sortAction,
-                                                         selectTracksAction
-                                                     ]
-                                                })
-
-    model: {
-        if (root.model.count === 0)
-            rootMenu_PLEmpty
-        else if (root.model.selectedCount === 0)
-            rootMenu_noSelection
-        else
-            rootMenu
-    }
-
-    // Sort menu:
-
-    readonly property var sortMenu: ({
-                                         title: I18n.qtr("Sort Menu"),
-                                         entries: []
-                                    })
-
-    Component {
-        id: sortActionDelegate
-
-        Action {
-            property int key
-
-            readonly property string marking: {
-                if (key === MainPlaylistController.sortKey) {
-                    return (MainPlaylistController.sortOrder === PlaylistController.SORT_ORDER_ASC ? "↓" : "↑")
-                } else {
-                    return null
-                }
-            }
-
-            readonly property bool tickMark: (key === MainPlaylistController.sortKey)
-
-            onTriggered: MainPlaylistController.sort(key)
-        }
-    }
-
-    Repeater {
-        model: MainPlaylistController.sortKeyTitleList
-
-        delegate: Loader {
-            sourceComponent: sortActionDelegate
-
-            onLoaded: {
-                item.text = modelData.title
-                item.key = modelData.criteria
-                overlayMenu.sortMenu.entries.push(item)
-            }
-        }
-    }
-}


=====================================
modules/gui/qt/vlc.qrc
=====================================
@@ -292,7 +292,6 @@
     <qresource prefix="/playlist">
         <file alias="PlaylistDelegate.qml">playlist/qml/PlaylistDelegate.qml</file>
         <file alias="PlaylistListView.qml">playlist/qml/PlaylistListView.qml</file>
-        <file alias="PlaylistOverlayMenu.qml">playlist/qml/PlaylistOverlayMenu.qml</file>
         <file alias="PlaylistToolbar.qml">playlist/qml/PlaylistToolbar.qml</file>
         <file alias="PlaylistDetachedWindow.qml">playlist/qml/PlaylistDetachedWindow.qml</file>
     </qresource>


=====================================
po/POTFILES.in
=====================================
@@ -892,7 +892,6 @@ modules/gui/qt/player/qml/controlbarcontrols/VolumeWidget.qml
 modules/gui/qt/playlist/qml/PlaylistDelegate.qml
 modules/gui/qt/playlist/qml/PlaylistDetachedWindow.qml
 modules/gui/qt/playlist/qml/PlaylistListView.qml
-modules/gui/qt/playlist/qml/PlaylistOverlayMenu.qml
 modules/gui/qt/playlist/qml/PlaylistToolbar.qml
 modules/gui/qt/qt.cpp
 modules/gui/qt/qt.hpp



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/75fdaaa69dd2de1e122080c7d29f7ae604fa2e45

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/75fdaaa69dd2de1e122080c7d29f7ae604fa2e45
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list