[vlc-devel] [PATCH 10/10] qml: remove obsolete TrackSelector and ModalControlBar

Pierre Lamot pierre at videolabs.io
Mon Nov 18 18:14:13 CET 2019


  track selector was reimplented using PlayerMenu and is now unused
  without the modal track selector, there is no use for the ModalControlBar
---
 modules/gui/qt/Makefile.am                    |   2 -
 modules/gui/qt/qml/player/ModalControlBar.qml |  67 ----------
 modules/gui/qt/qml/player/Player.qml          |   6 +-
 modules/gui/qt/qml/player/TrackSelector.qml   | 125 ------------------
 modules/gui/qt/vlc.qrc                        |   2 -
 5 files changed, 3 insertions(+), 199 deletions(-)
 delete mode 100644 modules/gui/qt/qml/player/ModalControlBar.qml
 delete mode 100644 modules/gui/qt/qml/player/TrackSelector.qml

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 6985785cdb..e4a97a205f 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -565,14 +565,12 @@ libqt_plugin_la_QML = \
 	gui/qt/qml/about/About.qml \
 	gui/qt/qml/player/Player.qml \
 	gui/qt/qml/player/TrackInfo.qml \
-	gui/qt/qml/player/TrackSelector.qml \
 	gui/qt/qml/player/ControlBar.qml \
 	gui/qt/qml/player/ControlButtons.qml \
 	gui/qt/qml/player/PlayerButtonsLayout.qml \
 	gui/qt/qml/player/PlayerMenu.qml \
 	gui/qt/qml/player/PlayerMenuItem.qml \
 	gui/qt/qml/player/VolumeWidget.qml \
-	gui/qt/qml/player/ModalControlBar.qml \
 	gui/qt/qml/player/SliderBar.qml \
 	gui/qt/qml/player/TeletextWidget.qml \
 	gui/qt/qml/player/MiniPlayer.qml \
diff --git a/modules/gui/qt/qml/player/ModalControlBar.qml b/modules/gui/qt/qml/player/ModalControlBar.qml
deleted file mode 100644
index 13eb048062..0000000000
--- a/modules/gui/qt/qml/player/ModalControlBar.qml
+++ /dev/null
@@ -1,67 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2019 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.11
-import QtQuick.Controls 2.4
-import QtQuick.Layouts 1.3
-
-import org.videolan.vlc 0.1
-
-import "qrc:///style/"
-import "qrc:///utils/" as Utils
-
-Utils.NavigableFocusScope {
-    id: root
-    property bool forceNoAutoHide: false
-    property bool noAutoHide:  stack_id.currentItem.noAutoHide || forceNoAutoHide
-
-    Component {
-        id: controlbarComp_id
-        ControlBar {
-            focus: true
-
-            onShowTrackBar: root.state = "tracks"
-
-            navigationParent: root
-        }
-    }
-
-    Component {
-        id: trackbarComp_id
-        TrackSelector {
-            focus: true
-
-            navigationParent: root
-            navigationCancel: function() { root.state = "control" }
-        }
-    }
-
-    Utils.StackViewExt {
-        id: stack_id
-        initialItem: controlbarComp_id
-        anchors.fill: parent
-        focus: true
-    }
-
-    state: "control"
-    onStateChanged: {
-        if (state === "tracks")
-            stack_id.replace(trackbarComp_id)
-        else if (state === "control")
-            stack_id.replace(controlbarComp_id)
-    }
-}
diff --git a/modules/gui/qt/qml/player/Player.qml b/modules/gui/qt/qml/player/Player.qml
index f01f4fbe1b..2bbb5bde00 100644
--- a/modules/gui/qt/qml/player/Player.qml
+++ b/modules/gui/qt/qml/player/Player.qml
@@ -269,14 +269,14 @@ Utils.NavigableFocusScope {
                 hoverEnabled: true
                 anchors.fill: parent
 
-                ModalControlBar {
+                ControlBar {
                     id: controllerId
                     focus: true
                     anchors.fill: parent
 
-                    forceNoAutoHide: playlistpopup.state === "visible" || !player.hasVideoOutput || !rootWindow.hasEmbededVideo || controllerMouseArea.containsMouse
+                    property bool disableAutoHide: playlistpopup.state === "visible" || !player.hasVideoOutput || !rootWindow.hasEmbededVideo || controllerMouseArea.containsMouse
                     onNoAutoHideChanged: {
-                        if (!noAutoHide)
+                        if (!noAutoHide && disableAutoHide)
                             toolbarAutoHide.restart()
                     }
 
diff --git a/modules/gui/qt/qml/player/TrackSelector.qml b/modules/gui/qt/qml/player/TrackSelector.qml
deleted file mode 100644
index 15df240b27..0000000000
--- a/modules/gui/qt/qml/player/TrackSelector.qml
+++ /dev/null
@@ -1,125 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2019 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.11
-import QtQuick.Controls 2.4
-import QtQuick.Layouts 1.3
-import org.videolan.vlc 0.1
-
-import "qrc:///style/"
-import "qrc:///utils/" as Utils
-
-Utils.NavigableFocusScope {
-    id: root
-
-    property bool noAutoHide: true
-
-    Component {
-        id: delegateComponent
-
-        Row {
-            focus:  true
-            spacing: VLCStyle.margin_small
-            opacity: 1.0 - Math.abs(Tumbler.displacement) / (Tumbler.tumbler.visibleItemCount / 2)
-            height: VLCStyle.fontHeight_large + VLCStyle.margin_small
-
-            Label {
-                id: checbock_id
-                font.pixelSize: VLCStyle.fontSize_large
-                anchors.verticalCenter:  parent.verticalCenter
-                visible: model.checked
-                color: (Tumbler.tumbler.activeFocus && model.index === Tumbler.tumbler.currentIndex ) ? VLCStyle.colors.accent : VLCStyle.colors.playerFg
-                font.bold: true
-                text: "☑"
-            }
-            Label {
-                id: label_id
-                text: model.display
-                anchors.verticalCenter:  parent.verticalCenter
-                horizontalAlignment: Text.AlignHCenter
-                verticalAlignment: Text.AlignVCenter
-
-                font.pixelSize: (model.index === Tumbler.tumbler.currentIndex) ? VLCStyle.fontSize_large * 1.3 : VLCStyle.fontSize_large
-                color: (Tumbler.tumbler.activeFocus && model.index === Tumbler.tumbler.currentIndex ) ? VLCStyle.colors.accent : VLCStyle.colors.playerFg
-                font.bold: true
-            }
-            Keys.onPressed:  {
-                if (event.key === Qt.Key_Space || event.matches(StandardKey.InsertParagraphSeparator)) { //enter/return/space
-                    model.checked  = !model.checked
-                    event.accepted = true
-                }
-            }
-        }
-    }
-
-    Utils.IconToolButton {
-        id: back
-        anchors.left: parent.left
-        anchors.verticalCenter: parent.verticalCenter
-        size: VLCStyle.icon_large
-        text: VLCIcons.exit
-        onClicked: root.navigationCancel(0)
-        KeyNavigation.right: trackTypeTumbler
-    }
-
-    Tumbler {
-        id: trackTypeTumbler
-        anchors.right: trackTumble.left
-        anchors.verticalCenter: parent.verticalCenter
-        //fixme hardcoded
-        width: 100 * VLCStyle.scale
-        height: parent.height
-
-        //Layout.fillHeight: true
-        //Layout.preferredWidth: root.width/4
-        //Layout.alignment: Qt.AlignCenter
-        focus: true
-        model: ListModel {
-            ListElement { display: qsTr("subtitle") ; checked: false }
-            ListElement { display: qsTr("audio")    ; checked: false }
-            ListElement { display: qsTr("video")    ; checked: false }
-        }
-        delegate: delegateComponent
-        currentIndex: 0
-
-        KeyNavigation.right: trackTumble
-        Keys.forwardTo: [trackTypeTumbler.currentItem]
-    }
-    //
-    Tumbler {
-        id: trackTumble
-
-        anchors.verticalCenter: parent.verticalCenter
-        anchors.horizontalCenter:  parent.horizontalCenter
-        height: parent.height
-        width: parent.width / 2
-
-        //Layout.fillHeight: true
-        //Layout.preferredWidth: root.width/4
-        //Layout.alignment: Qt.AlignCenter
-        model: (trackTypeTumbler.currentIndex === 0)
-               ? player.subtitleTracks
-               : ((trackTypeTumbler.currentIndex === 1)
-                  ? player.audioTracks
-                  : player.videoTracks
-                  )
-        delegate: delegateComponent
-        Keys.forwardTo: [trackTumble.currentItem]
-    }
-
-    Keys.onPressed: defaultKeyAction(event, 0)
-}
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index 1bb063fc68..77b7315059 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -264,8 +264,6 @@
         <file alias="ControlBar.qml">qml/player/ControlBar.qml</file>
         <file alias="SliderBar.qml">qml/player/SliderBar.qml</file>
         <file alias="TrackInfo.qml">qml/player/TrackInfo.qml</file>
-        <file alias="TrackSelector.qml">qml/player/TrackSelector.qml</file>
-        <file alias="ModalControlBar.qml">qml/player/ModalControlBar.qml</file>
         <file alias="ControlButtons.qml">qml/player/ControlButtons.qml</file>
         <file alias="VolumeWidget.qml">qml/player/VolumeWidget.qml</file>
         <file alias="TeletextWidget.qml">qml/player/TeletextWidget.qml</file>
-- 
2.17.1



More information about the vlc-devel mailing list