[vlc-commits] qml: move the grid definition of the VideoExpandableGrid to MCVideoDisplay

Pierre Lamot git at videolan.org
Thu Oct 31 00:54:55 CET 2019


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Tue Oct 29 14:57:13 2019 +0100| [b4bea5ce569fcbd6a6fce8ef644cec0d2260a123] | committer: Jean-Baptiste Kempf

qml: move the grid definition of the VideoExpandableGrid to MCVideoDisplay

most behaviours and customisations related to the gridview where defined
in MCVideoDisplay, and this makes the vide info panel an independant component
(renamed as VideoInfoExpandPanel)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b4bea5ce569fcbd6a6fce8ef644cec0d2260a123
---

 modules/gui/qt/Makefile.am                         |  2 +-
 modules/gui/qt/qml/mediacenter/MCVideoDisplay.qml  | 23 +++++++++++++-
 ...ExpandableGrid.qml => VideoInfoExpandPanel.qml} | 37 ++++------------------
 modules/gui/qt/vlc.qrc                             |  2 +-
 4 files changed, 31 insertions(+), 33 deletions(-)

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 9fa20c4653..f85c9a337a 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -642,7 +642,7 @@ libqt_plugin_la_QML = \
 	gui/qt/qml/mediacenter/MusicTrackListDisplay.qml \
 	gui/qt/qml/mediacenter/NetworkGridItem.qml \
 	gui/qt/qml/mediacenter/NetworkListItem.qml \
-	gui/qt/qml/mediacenter/VideoExpandableGrid.qml \
+	gui/qt/qml/mediacenter/VideoInfoExpandPanel.qml \
 	gui/qt/qml/mediacenter/VideoGridItem.qml \
 	gui/qt/qml/playlist/PlaylistListView.qml \
 	gui/qt/qml/playlist/PlaylistMainView.qml \
diff --git a/modules/gui/qt/qml/mediacenter/MCVideoDisplay.qml b/modules/gui/qt/qml/mediacenter/MCVideoDisplay.qml
index dcddf07513..cad09b0afc 100644
--- a/modules/gui/qt/qml/mediacenter/MCVideoDisplay.qml
+++ b/modules/gui/qt/qml/mediacenter/MCVideoDisplay.qml
@@ -106,7 +106,7 @@ Utils.NavigableFocusScope {
     Component {
         id: gridComponent
 
-        VideoExpandableGrid {
+        Utils.ExpandGridView {
             id: videosGV
             property Item currentItem: Item{}
 
@@ -137,6 +137,21 @@ Utils.NavigableFocusScope {
                 }
             }
 
+            expandDelegate: VideoInfoExpandPanel {
+                visible: !videosGV.isAnimating
+
+                height: implicitHeight
+                width: videosGV.width
+
+                onRetract: videosGV.retract()
+                notchPosition: videosGV.getItemPos(videosGV._expandIndex)[0] + (videosGV.cellWidth / 2)
+
+                navigationParent: videosGV
+                navigationCancel:  function() {  videosGV.retract() }
+                navigationUp: function() {  videosGV.retract() }
+                navigationDown: function() { videosGV.retract() }
+            }
+
             navigationParent: root
 
             /*
@@ -150,6 +165,12 @@ Utils.NavigableFocusScope {
                 }
             }
 
+            cellWidth: (VLCStyle.video_normal_width)
+            cellHeight: (VLCStyle.video_normal_height) + VLCStyle.margin_xlarge + VLCStyle.margin_normal
+
+            onSelectAll: videosGV.model.selectAll()
+            onSelectionUpdated: videosGV.model.updateSelection( keyModifiers, oldIndex, newIndex )
+            onActionAtIndex: switchExpandItem( index )
         }
 
     }
diff --git a/modules/gui/qt/qml/mediacenter/VideoExpandableGrid.qml b/modules/gui/qt/qml/mediacenter/VideoInfoExpandPanel.qml
similarity index 90%
rename from modules/gui/qt/qml/mediacenter/VideoExpandableGrid.qml
rename to modules/gui/qt/qml/mediacenter/VideoInfoExpandPanel.qml
index fe7188aeea..6ae73b647a 100644
--- a/modules/gui/qt/qml/mediacenter/VideoExpandableGrid.qml
+++ b/modules/gui/qt/qml/mediacenter/VideoInfoExpandPanel.qml
@@ -23,36 +23,24 @@ import QtQuick.Layouts 1.3
 import org.videolan.medialib 0.1
 
 import "qrc:///utils/" as Utils
-import "qrc:///dialogs/" as DG
 import "qrc:///style/"
 
-Utils.ExpandGridView {
-    id: expandableGV
-
-    activeFocusOnTab:true
-
-    expandDelegate:  Utils.NavigableFocusScope {
+Utils.NavigableFocusScope {
         id: expandRect
+
         property int currentId: -1
         property var model : ({})
         property alias currentItemY: expandRect.y
         property alias currentItemHeight: expandRect.height
-        height: implicitHeight
-        implicitHeight: arrowRect.implicitHeight
-            + contentRect.implicitHeight
-        width: expandableGV.width
-
-        navigationParent: expandableGV
-        navigationCancel:  function() {  expandableGV.retract() }
-        navigationUp: function() {  expandableGV.retract() }
-        navigationDown: function() { expandableGV.retract() }
+        implicitHeight: arrowRect.implicitHeight + contentRect.implicitHeight
+        property int notchPosition: 0
+        signal retract()
 
         //arrow
         Item {
             id:arrowRect
             y: -(width/2)
-            x: expandableGV.getItemPos(expandableGV._expandIndex)[0] + (expandableGV.cellWidth / 2) - (width/2)
-            visible: !expandableGV.isAnimating
+            x: notchPosition  - (width/2)
             clip: true
             width: Math.sqrt(2) *VLCStyle.icon_normal
             height: width/2
@@ -77,7 +65,6 @@ Utils.ExpandGridView {
             width: parent.width
             clip: true
             color: VLCStyle.colors.bgAlt
-            visible: !expandableGV.isAnimating
 
             RowLayout {
                 id: contentLayout
@@ -276,7 +263,7 @@ Utils.ExpandGridView {
                         color: VLCStyle.colors.lightText
 
                         focus: true
-                        onClicked: expandableGV.retract()
+                        onClicked: expandRect.retract()
                     }
 
                     Keys.priority: Keys.AfterItem
@@ -287,13 +274,3 @@ Utils.ExpandGridView {
             }
         }
     }
-
-
-    cellWidth: (VLCStyle.video_normal_width)
-    cellHeight: (VLCStyle.video_normal_height) + VLCStyle.margin_xlarge + VLCStyle.margin_normal
-
-    onSelectAll: expandableGV.model.selectAll()
-    onSelectionUpdated: expandableGV.model.updateSelection( keyModifiers, oldIndex, newIndex )
-    onActionAtIndex: switchExpandItem( index )
-
-}
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index daf12bd2f5..52c9600aa4 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -224,7 +224,7 @@
         <file alias="MCMainDisplay.qml">qml/mediacenter/MCMainDisplay.qml</file>
         <file alias="NetworkGridItem.qml">qml/mediacenter/NetworkGridItem.qml</file>
         <file alias="NetworkListItem.qml">qml/mediacenter/NetworkListItem.qml</file>
-        <file alias="VideoExpandableGrid.qml">qml/mediacenter/VideoExpandableGrid.qml</file>
+        <file alias="VideoInfoExpandPanel.qml">qml/mediacenter/VideoInfoExpandPanel.qml</file>
         <file alias="MCVideoListDisplay.qml">qml/mediacenter/MCVideoListDisplay.qml</file>
         <file alias="VideoGridItem.qml">qml/mediacenter/VideoGridItem.qml</file>
         <file alias="AudioGridItem.qml">qml/mediacenter/AudioGridItem.qml</file>



More information about the vlc-commits mailing list