[vlc-commits] [Git][videolan/vlc][master] 4 commits: qml/NetworkThumbnailItem: Add 'title' and 'subCriterias' support
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Wed Feb 22 07:29:21 UTC 2023
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
2fec9594 by Benjamin Arnaud at 2023-02-22T07:10:50+00:00
qml/NetworkThumbnailItem: Add 'title' and 'subCriterias' support
- - - - -
d5979ee2 by Benjamin Arnaud at 2023-02-22T07:10:50+00:00
qml/BrowseDeviceView: Add a small TableView model
- - - - -
20894ed3 by Benjamin Arnaud at 2023-02-22T07:10:50+00:00
qml/BrowseTreeDisplay: Add a small TableView model
- - - - -
0eb30937 by Benjamin Arnaud at 2023-02-22T07:10:50+00:00
qml/BrowseDeviceView: Remove 'foregroundColor' on header
- - - - -
3 changed files:
- modules/gui/qt/network/qml/BrowseDeviceView.qml
- modules/gui/qt/network/qml/BrowseTreeDisplay.qml
- modules/gui/qt/network/qml/NetworkThumbnailItem.qml
Changes:
=====================================
modules/gui/qt/network/qml/BrowseDeviceView.qml
=====================================
@@ -261,31 +261,44 @@ FocusScope {
Widgets.KeyNavigableTableView {
id: listView
+ // Properties
+
readonly property int maximumCount: root.maximumRows
readonly property int nbItemPerRow: 1
- readonly property int _nbCols: VLCStyle.gridColumnsForWidth(listView.availableRowWidth)
+ readonly property int _nbCols: VLCStyle.gridColumnsForWidth(availableRowWidth)
- readonly property int _nameColSpan: Math.max((_nbCols - 1) / 2, 1)
+ readonly property int _size: (_nbCols - 1) / 2
- rowHeight: VLCStyle.tableCoverRow_height
+ property var _modelSmall: [{
+ size: Math.max(2, _nbCols),
- displayMarginEnd: root.displayMarginEnd
+ model: ({
+ criteria: "name",
- model: modelFilter
+ title: "name",
+
+ subCriterias: [ "mrl" ],
+
+ text: I18n.qtr("Name"),
+
+ headerDelegate: artworkHeader,
+ colDelegate: artworkColumn
+ })
+ }]
- sortModel: [{
+ property var _modelMedium: [{
size: 1,
model: {
criteria: "artwork",
headerDelegate: artworkHeader,
- colDelegate : artworkColumn
+ colDelegate: artworkColumn
}
}, {
- size: listView._nameColSpan,
+ size: _size,
model: {
criteria: "name",
@@ -293,7 +306,7 @@ FocusScope {
text: I18n.qtr("Name")
}
}, {
- size: Math.max(listView._nbCols - listView._nameColSpan - 1, 1),
+ size: Math.max(_nbCols - _size - 1, 1),
model: {
criteria: "mrl",
@@ -304,6 +317,17 @@ FocusScope {
}
}]
+ // Settings
+
+ rowHeight: VLCStyle.tableCoverRow_height
+
+ displayMarginEnd: root.displayMarginEnd
+
+ model: modelFilter
+
+ sortModel: (availableRowWidth < VLCStyle.colWidth(4)) ? _modelSmall
+ : _modelMedium
+
header: root.header
headerColor: VLCStyle.colors.bg
@@ -327,8 +351,6 @@ FocusScope {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: VLCStyle.icon_tableHeader
-
- color: parent.foregroundColor
}
}
=====================================
modules/gui/qt/network/qml/BrowseTreeDisplay.qml
=====================================
@@ -259,10 +259,61 @@ FocusScope {
onPlayClicked: playAt(index)
}
+ property var _modelSmall: [{
+ size: Math.max(2, _nbCols),
+
+ model: ({
+ criteria: "name",
+
+ title: "name",
+
+ subCriterias: [ "mrl" ],
+
+ text: I18n.qtr("Name"),
+
+ headerDelegate: thumbnailHeader,
+ colDelegate: thumbnailColumn
+ })
+ }]
+
+ property var _modelMedium: [{
+ size: 1,
+
+ model: {
+ criteria: "thumbnail",
+
+ headerDelegate: thumbnailHeader,
+ colDelegate: thumbnailColumn
+ }
+ }, {
+ size: tableView._nameColSpan,
+
+ model: {
+ criteria: "name",
+
+ text: I18n.qtr("Name")
+ }
+ }, {
+ size: Math.max(_nbCols - _nameColSpan - 1, 1),
+
+ model: {
+ criteria: "mrl",
+
+ text: I18n.qtr("Url"),
+
+ showContextButton: true
+ }
+ }]
+
dragItem: networkDragItem
height: view.height
width: view.width
+
model: filterModel
+
+ sortModel: (availableRowWidth < VLCStyle.colWidth(4)) ? _modelSmall
+ : _modelMedium
+
selectionDelegateModel: selectionModel
focus: true
headerColor: VLCStyle.colors.bg
@@ -315,35 +366,6 @@ FocusScope {
}
}
- sortModel: [{
- size: 1,
-
- model: {
- criteria: "thumbnail",
-
- headerDelegate: tableView.thumbnailHeader,
- colDelegate: tableView.thumbnailColumn
- }
- }, {
- size: tableView._nameColSpan,
-
- model: {
- criteria: "name",
-
- text: I18n.qtr("Name")
- }
- }, {
- size: Math.max(tableView._nbCols - tableView._nameColSpan - 1, 1),
-
- model: {
- criteria: "mrl",
-
- text: I18n.qtr("Url"),
-
- showContextButton: true
- }
- }]
-
onActionForSelection: _actionAtIndex(selection[0].row)
onItemDoubleClicked: _actionAtIndex(index)
onContextMenuButtonClicked: contextMenu.popup(filterModel.mapIndexesToSource(selectionModel.selectedIndexes), globalMousePos)
=====================================
modules/gui/qt/network/qml/NetworkThumbnailItem.qml
=====================================
@@ -26,53 +26,154 @@ import org.videolan.vlc 0.1
import "qrc:///widgets/" as Widgets
import "qrc:///style/"
-Item {
- id: item
+Row {
+ id: root
+
+ // Properties
+
+ readonly property bool containsMouse: parent.containsMouse
+ readonly property bool currentlyFocused: parent.currentlyFocused
property var rowModel: parent.rowModel
property var model: parent.colModel
- readonly property bool currentlyFocused: parent.currentlyFocused
- readonly property bool containsMouse: parent.containsMouse
+
readonly property int index: parent.index
readonly property string artworkSource: !!rowModel ? rowModel.artwork : ""
+ readonly property color foregroundColor: parent.foregroundColor
+
+ // Private
+
readonly property bool _showPlayCover: (currentlyFocused || containsMouse)
&& !!rowModel
&& (rowModel.type !== NetworkMediaModel.TYPE_NODE)
&& (rowModel.type !== NetworkMediaModel.TYPE_DIRECTORY)
- readonly property bool _showCustomCover: (!artworkSource) || (artwork.status != Image.Ready)
+ readonly property bool _showCustomCover: (!artworkSource) || (artwork.status !== Image.Ready)
+
+ // Signals
signal playClicked(int index)
- Widgets.ListCoverShadow {
- x: artwork.x
- y: artwork.y
+ // Settings
+
+ spacing: VLCStyle.margin_normal
+
+ // Functions
+
+ function getCriterias(colModel, rowModel) {
+ if (colModel === null || rowModel === null)
+ return ""
+
+ var criterias = colModel.subCriterias
+
+ if (criterias === undefined || criterias.length === 0)
+ return ""
+
+ var string = ""
+
+ for (var i = 0; i < criterias.length; i++) {
+ var criteria = criterias[i]
+
+ var value = rowModel[criteria]
+
+ if (value.toString() === "vlc://nop")
+ continue
+
+ if (i) string += " • "
+
+ string += value
+ }
+
+ return string
+ }
+
+ // Children
+
+ Item {
+ id: itemCover
+
+ anchors.verticalCenter: parent.verticalCenter
+
width: artwork.width
height: artwork.height
+
+ Widgets.ListCoverShadow { anchors.fill: parent }
+
+ NetworkCustomCover {
+ id: artwork
+
+ width: VLCStyle.listAlbumCover_width
+ height: VLCStyle.listAlbumCover_height
+
+ //radius: VLCStyle.listAlbumCover_radius
+
+ networkModel: rowModel
+
+ bgColor: VLCStyle.colors.bg
+
+ Widgets.PlayCover {
+ x: Math.round((artwork.width - width) / 2)
+ y: Math.round((artwork.height - height) / 2)
+
+ width: VLCStyle.play_cover_small
+
+ visible: root._showPlayCover
+
+ onClicked: playClicked(root.index)
+ }
+ }
}
- NetworkCustomCover {
- id: artwork
+ Column {
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
- anchors.verticalCenter: parent.verticalCenter
- bgColor: VLCStyle.colors.bg
- width: VLCStyle.listAlbumCover_width
- height: VLCStyle.listAlbumCover_height
+ anchors.topMargin: VLCStyle.margin_xxsmall
+ anchors.bottomMargin: VLCStyle.margin_xxsmall
+
+ width: Math.max(0, parent.width - x)
+
+ Widgets.ScrollingText {
+ id: itemText
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ height: (itemCriterias.visible) ? Math.round(parent.height / 2)
+ : parent.height
+
+ visible: (listLabel.text)
+
+ clip: scrolling
+
+ label: listLabel
+
+ forceScroll: root.currentlyFocused
+
+ Widgets.ListLabel {
+ id: listLabel
+
+ anchors.verticalCenter: parent.verticalCenter
+
+ text: (root.rowModel && model.title) ? root.rowModel[model.title] : ""
+
+ color: root.foregroundColor
+ }
+ }
- networkModel: rowModel
- //radius: VLCStyle.listAlbumCover_radius
+ Widgets.MenuCaption {
+ id: itemCriterias
- Widgets.PlayCover {
- x: Math.round((artwork.width - width) / 2)
- y: Math.round((artwork.height - height) / 2)
+ anchors.left: parent.left
+ anchors.right: parent.right
- width: VLCStyle.play_cover_small
+ height: itemText.height
- visible: item._showPlayCover
+ visible: (text)
- onClicked: playClicked(item.index)
+ text: root.getCriterias(root.model, root.rowModel)
}
}
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e6cf68a5326d3e91fec81623b726b6104a803dbc...0eb309375a15fa4890879dbadb190ccb6fdf5e5d
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e6cf68a5326d3e91fec81623b726b6104a803dbc...0eb309375a15fa4890879dbadb190ccb6fdf5e5d
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list