Skip to content
Snippets Groups Projects
Commit 2ad8e300 authored by Benjamin Arnaud's avatar Benjamin Arnaud Committed by Pierre Lamot
Browse files

qml/VideoAll: Add support for different models

qml/VideoGridItem: Remove the static 'onItemDoubleClicked' behavior

Signed-off-by: default avatarPierre Lamot <pierre@videolabs.io>
parent 514f411a
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,8 @@ Widgets.NavigableFocusScope {
property int initialIndex: 0
property var model: MLVideoModel { ml: medialib }
property var sortModel: [
{ text: i18n.qtr("Alphabetic"), criteria: "title" },
{ text: i18n.qtr("Duration"), criteria: "duration" }
......@@ -53,11 +55,6 @@ Widgets.NavigableFocusScope {
// Aliases
//---------------------------------------------------------------------------------------------
// NOTE: This is used to determine which media(s) shall be displayed.
property alias parentId: model.parentId
property alias model: model
property alias currentItem: view.currentItem
//---------------------------------------------------------------------------------------------
......@@ -99,6 +96,16 @@ Widgets.NavigableFocusScope {
}
}
Connections {
target: model
onCountChanged: {
if (count === 0 || modelSelect.hasSelection) return;
resetFocus();
}
}
//---------------------------------------------------------------------------------------------
// Functions
//---------------------------------------------------------------------------------------------
......@@ -122,7 +129,7 @@ Widgets.NavigableFocusScope {
//---------------------------------------------------------------------------------------------
// Private
function _actionAtIndex(index) {
function _actionAtIndex() {
g_mainDisplay.showPlayer();
medialib.addAndPlay(model.getIdsForIndexes(modelSelect.selectedIndexes));
......@@ -132,18 +139,6 @@ Widgets.NavigableFocusScope {
// Childs
//---------------------------------------------------------------------------------------------
MLVideoModel {
id: model
ml: medialib
onCountChanged: {
if (count === 0 || modelSelect.hasSelection) return;
resetFocus();
}
}
Widgets.StackViewExt {
id: view
......@@ -267,6 +262,12 @@ Widgets.NavigableFocusScope {
onItemClicked: gridView.leftClickOnItem(modifier, index)
onItemDoubleClicked: {
g_mainDisplay.showPlayer();
medialib.addAndPlay(model.id);
}
onContextMenuButtonClicked: {
gridView.rightClickOnItem(index);
......@@ -296,7 +297,7 @@ Widgets.NavigableFocusScope {
onSelectionUpdated: modelSelect.updateSelection(keyModifiers, oldIndex, newIndex)
onActionAtIndex: _actionAtIndex(index)
onActionAtIndex: _actionAtIndex()
//-------------------------------------------------------------------------------------
// Connections
......@@ -337,6 +338,8 @@ Widgets.NavigableFocusScope {
//-------------------------------------------------------------------------------------
// Events
onActionForSelection: medialib.addAndPlay(model.getIdsForIndexes(selection))
onContextMenuButtonClicked: contextMenu.popup(modelSelect.selectedIndexes,
menuParent.mapToGlobal(0,0))
......
......@@ -40,12 +40,6 @@ Widgets.GridItem {
playCoverBorder.width: VLCStyle.gridCover_video_border
titleMargin: VLCStyle.margin_xxsmall
showNewIndicator: true
onItemDoubleClicked: {
if ( model.id !== undefined ) {
g_mainDisplay.showPlayer()
medialib.addAndPlay( model.id )
}
}
onPlayClicked: {
if ( model.id !== undefined ) {
g_mainDisplay.showPlayer()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment