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

qml/VideoListDisplay: Add configuration for the 'mainCriteria'


This makes the item more versatile. Also a little bit of cleanup.

Signed-off-by: default avatarPierre Lamot <pierre@videolabs.io>
parent e99bca72
No related branches found
No related tags found
Loading
......@@ -29,13 +29,52 @@ import "qrc:///style/"
MainInterface.MainTableView {
id: listView_id
//---------------------------------------------------------------------------------------------
// Properties
//---------------------------------------------------------------------------------------------
// NOTE: This is useful for groups because our main criteria is 'name' instead of 'title'.
property string mainCriteria: "title"
//---------------------------------------------------------------------------------------------
// Private
readonly property int _nbCols: VLCStyle.gridColumnsForWidth(listView_id.availableRowWidth)
sortModel: [
{ type: "image", criteria: "thumbnail", width: VLCStyle.colWidth(1), showSection: "", colDelegate: tableColumns.titleDelegate, headerDelegate: tableColumns.titleHeaderDelegate },
{ isPrimary: true, criteria: "title", width: VLCStyle.colWidth(Math.max(listView_id._nbCols - 2, 1)), text: i18n.qtr("Title"), showSection: "title" },
{ criteria: "duration", width: VLCStyle.colWidth(1), showSection: "", colDelegate: tableColumns.timeColDelegate, headerDelegate: tableColumns.timeHeaderDelegate, showContextButton: true },
]
//---------------------------------------------------------------------------------------------
// Settings
//---------------------------------------------------------------------------------------------
sortModel: [{
type: "image",
criteria: "thumbnail",
width: VLCStyle.colWidth(1),
showSection: "",
headerDelegate: tableColumns.titleHeaderDelegate,
colDelegate : tableColumns.titleDelegate,
}, {
isPrimary: true,
criteria: mainCriteria,
width: VLCStyle.colWidth(Math.max(listView_id._nbCols - 2, 1)),
showSection: "title",
text: i18n.qtr("Title")
}, {
criteria: "duration_short",
width: VLCStyle.colWidth(1),
showSection: "",
headerDelegate: tableColumns.timeHeaderDelegate, showContextButton: true,
colDelegate : tableColumns.timeColDelegate
}]
section.property: "title_first_symbol"
......@@ -43,8 +82,26 @@ MainInterface.MainTableView {
headerColor: VLCStyle.colors.bg
onActionForSelection: medialib.addAndPlay(model.getIdsForIndexes( selection ))
onItemDoubleClicked: medialib.addAndPlay(model.id)
//---------------------------------------------------------------------------------------------
// Connections
//---------------------------------------------------------------------------------------------
Connections {
target: model
onSortCriteriaChanged: {
switch (model.sortCriteria) {
case "title":
listView_id.section.property = "title_first_symbol"
break;
default:
listView_id.section.property = ""
}
}
}
//---------------------------------------------------------------------------------------------
// Childs
//---------------------------------------------------------------------------------------------
Widgets.TableColumns {
id: tableColumns
......@@ -60,17 +117,4 @@ MainInterface.MainTableView {
].filter(function(a) { return a !== "" })
}
}
Connections {
target: model
onSortCriteriaChanged: {
switch (model.sortCriteria) {
case "title":
listView_id.section.property = "title_first_symbol"
break;
default:
listView_id.section.property = ""
}
}
}
}
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