[vlc-devel] [PATCH 2/3] qml: move the grid definition of the VideoExpandableGrid to MCVideoDisplay
Pierre Lamot
pierre at videolabs.io
Tue Oct 29 14:57:13 CET 2019
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)
---
modules/gui/qt/Makefile.am | 2 +-
.../gui/qt/qml/mediacenter/MCVideoDisplay.qml | 23 +++++++++++-
...dableGrid.qml => VideoInfoExpandPanel.qml} | 37 ++++---------------
modules/gui/qt/vlc.qrc | 2 +-
4 files changed, 31 insertions(+), 33 deletions(-)
rename modules/gui/qt/qml/mediacenter/{VideoExpandableGrid.qml => VideoInfoExpandPanel.qml} (90%)
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 4a82fa84c8..7a464e26ee 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -646,7 +646,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 bb597752ce..42ecf9582c 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>
--
2.17.1
More information about the vlc-devel
mailing list