Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from videolan:master #346

Merged
merged 7 commits into from
Feb 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contrib/src/get-rust-target.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ case $OS in
android)
case $ARCH in
aarch64|i686|x86_64)
return_triplet $TRIPLET
return_triplet "$ARCH-linux-android"
;;
esac
;;
Expand Down
5 changes: 2 additions & 3 deletions modules/gui/qt/medialibrary/qml/MusicAlbums.qml
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,11 @@ MainViewLoader {
dragItem: albumDragItem
rowHeight: VLCStyle.tableCoverRow_height

rowContextMenu: contextMenu

sortModel: (availableRowWidth < VLCStyle.colWidth(4)) ? _modelSmall
: _modelMedium

onContextMenuButtonClicked: (_,_,globalMousePos) => {
contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
}
onRightClick: (_,_,globalMousePos) => {
contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
}
Expand Down
4 changes: 1 addition & 3 deletions modules/gui/qt/medialibrary/qml/MusicAllArtists.qml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ MainViewLoader {
model: artistModel
focus: true
dragItem: artistsDragItem
rowContextMenu: contextMenu
rowHeight: VLCStyle.tableCoverRow_height

header: root.header
Expand All @@ -221,9 +222,6 @@ MainViewLoader {
root.requestArtistAlbumView(Qt.MouseFocusReason, model.id)
}

onContextMenuButtonClicked: (_,_, globalMousePos) => {
contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
}
onRightClick: (_,_,globalMousePos) => {
contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
}
Expand Down
30 changes: 27 additions & 3 deletions modules/gui/qt/medialibrary/qml/MusicArtist.qml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ FocusScope {
id: gridItem

required property var model
required property int index

y: selectedBorderWidth

Expand All @@ -211,6 +212,11 @@ FocusScope {
textAlignHCenter: true
dragItem: albumDragItem

// updates to selection is manually handled for optimization purpose
Component.onCompleted: _updateSelected()

onIndexChanged: _updateSelected()

onPlayClicked: play()
onItemDoubleClicked: play()

Expand All @@ -223,16 +229,33 @@ FocusScope {
Connections {
target: albumsList.selectionModel

function onSelectionChanged() {
gridItem.selected = albumsList.selectionModel.isSelected(index)
function onSelectionChanged(selected, deselected) {
const idx = albumModel.index(gridItem.index, 0)
const findInSelection = s => s.find(range => range.contains(idx)) !== undefined

// NOTE: we only get diff of the selection
if (findInSelection(selected))
gridItem.selected = true
else if (findInSelection(deselected))
gridItem.selected = false
}
}

onContextMenuButtonClicked: (_, globalMousePos) => {
albumSelectionModel.updateSelection( Qt.NoModifier , albumsList.currentIndex, index )
contextMenu.popup(albumSelectionModel.selectedIndexes
, globalMousePos)
}

function play() {
if ( model.id !== undefined ) {
MediaLib.addAndPlay( model.id )
}
}

function _updateSelected() {
selected = albumSelectionModel.isRowSelected(gridItem.index)
}
}

onActionAtIndex: (index) => { albumModel.addAndPlay( new Array(index) ) }
Expand Down Expand Up @@ -550,6 +573,8 @@ FocusScope {

dragItem: tableDragItem

rowContextMenu: trackContextMenu

Navigation.parentItem: root

Navigation.upAction: function() {
Expand All @@ -559,7 +584,6 @@ FocusScope {
Navigation.cancelAction: root._onNavigationCancel

onItemDoubleClicked: MediaLib.addAndPlay(model.id)
onContextMenuButtonClicked: trackContextMenu.popup(tableView_id.selectionModel.selectedIndexes, globalMousePos)
onRightClick: trackContextMenu.popup(tableView_id.selectionModel.selectedIndexes, globalMousePos)

onDragItemChanged: console.assert(tableView_id.dragItem === tableDragItem)
Expand Down
6 changes: 2 additions & 4 deletions modules/gui/qt/medialibrary/qml/MusicGenres.qml
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,12 @@ MainViewLoader {

header: root.header

rowContextMenu: contextMenu

onItemDoubleClicked: (index, model) => {
root.showAlbumView(model.id, model.name, Qt.MouseFocusReason)
}

onContextMenuButtonClicked: (_,_,globalMousePos) => {
contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
}

onRightClick: (_,_,globalMousePos) => {
contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
}
Expand Down
5 changes: 2 additions & 3 deletions modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,10 @@ Widgets.TableViewExt {

onDragItemChanged: console.assert(root.dragItem === tableDragItem)

rowContextMenu: contextMenu

onActionForSelection: (selection) => model.addAndPlay(selection)
onItemDoubleClicked: (index, model) => MediaLib.addAndPlay(model.id)
onContextMenuButtonClicked: (_,_, globalMousePos) => {
contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
}
onRightClick: (_,_, globalMousePos) => {
contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
}
Expand Down
10 changes: 6 additions & 4 deletions modules/gui/qt/medialibrary/qml/PlaylistMediaDisplay.qml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ FocusScope {

model: root.model
ctx: MainCtx

function tableView_popup(index, selectedIndexes, globalPos) {
popup(selectedIndexes, globalPos)
}
}

PlaylistMedia
Expand All @@ -200,6 +204,8 @@ FocusScope {

dragItem: root.dragItem

rowContextMenu: contextMenu

isMusic: root.isMusic

header: Widgets.ViewHeader {
Expand All @@ -222,10 +228,6 @@ FocusScope {

// Events

onContextMenuButtonClicked: (_,_,globalMousePos) => {
contextMenu.popup(selectionModel.selectedRows(), globalMousePos)
}

onRightClick: (_,_,globalMousePos) => {
contextMenu.popup(selectionModel.selectedRows(), globalMousePos)
}
Expand Down
10 changes: 6 additions & 4 deletions modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ MainViewLoader {
model: root.model

ctx: MainCtx

function tableView_popup(index, selectedIndexes, globalPos) {
popup(selectedIndexes, globalPos)
}
}

// TBD: Refactor this with MusicGenres ?
Expand Down Expand Up @@ -414,6 +418,8 @@ MainViewLoader {

header: root.header

rowContextMenu: contextMenu

listView.isDropAcceptableFunc: function(drag, index) {
root._adjustDragAccepted(drag)
return drag.accepted
Expand All @@ -434,10 +440,6 @@ MainViewLoader {

onItemDoubleClicked: (_, model) => showList(model, Qt.MouseFocusReason)

onContextMenuButtonClicked: (_, _, globalMousePos) => {
contextMenu.popup(selectionModel.selectedRows(), globalMousePos)
}

onRightClick: (_, _, globalMousePos) => {
contextMenu.popup(selectionModel.selectedRows(), globalMousePos)
}
Expand Down
6 changes: 3 additions & 3 deletions modules/gui/qt/medialibrary/qml/UrlListDisplay.qml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ Widgets.TableViewExt {

rowHeight: VLCStyle.listAlbumCover_height + VLCStyle.margin_xxsmall * 2

rowContextMenu: contextMenu

onActionForSelection: (selection) => model.addAndPlay( selection )
onItemDoubleClicked: (index, model) => MediaLib.addAndPlay(model.id)
onContextMenuButtonClicked: (_,_,globalMousePos) => {
contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
}

onRightClick: (_,_,globalMousePos) => {
contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
}
Expand Down
6 changes: 2 additions & 4 deletions modules/gui/qt/medialibrary/qml/VideoAll.qml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ MainViewLoader {

selectionModel: root.selectionModel

rowContextMenu: root.contextMenu

dragItem: root.dragItem

header: root.header
Expand All @@ -210,10 +212,6 @@ MainViewLoader {

onItemDoubleClicked: (index, model) => root.onDoubleClick(model)

onContextMenuButtonClicked: (_,_,globalMousePos) => {
root.contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
}

onRightClick: (_,_,globalMousePos) => {
root.contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
}
Expand Down
Loading