[vlc-commits] [Git][videolan/vlc][master] 4 commits: qml/ExpandGridView: remove updateSelection signal
François Cartegnie (@fcartegnie)
gitlab at videolan.org
Sat Jan 8 13:25:40 UTC 2022
François Cartegnie pushed to branch master at VideoLAN / VLC
Commits:
98ee5092 by Prince Gupta at 2022-01-08T13:06:32+00:00
qml/ExpandGridView: remove updateSelection signal
ExpandGridView already has selectionModel just update it directly
- - - - -
217c97be by Prince Gupta at 2022-01-08T13:06:32+00:00
qml/ExpandGridView: remove selectAll signal
ExpandGridView already has selectionModel just update it directly
- - - - -
6d486490 by Prince Gupta at 2022-01-08T13:06:32+00:00
qml/ExpandGridView: rename delegateModel to selectionDelegateModel
defines property more accurately, also mirrors similar
property in KeyNavigableTableView
- - - - -
d053352f by Prince Gupta at 2022-01-08T13:06:32+00:00
qml/ExpandGridView: improve error reporting
- - - - -
12 changed files:
- modules/gui/qt/medialibrary/qml/MediaGroupList.qml
- modules/gui/qt/medialibrary/qml/MusicAlbums.qml
- modules/gui/qt/medialibrary/qml/MusicAllArtists.qml
- modules/gui/qt/medialibrary/qml/MusicArtist.qml
- modules/gui/qt/medialibrary/qml/MusicGenres.qml
- modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
- modules/gui/qt/medialibrary/qml/VideoAll.qml
- modules/gui/qt/medialibrary/qml/VideoDisplayRecentVideos.qml
- modules/gui/qt/network/qml/NetworkBrowseDisplay.qml
- modules/gui/qt/network/qml/NetworkHomeDeviceListView.qml
- modules/gui/qt/network/qml/ServicesHomeDisplay.qml
- modules/gui/qt/widgets/qml/ExpandGridView.qml
Changes:
=====================================
modules/gui/qt/medialibrary/qml/MediaGroupList.qml
=====================================
@@ -224,7 +224,7 @@ FocusScope {
model: root.model
- delegateModel: modelSelect
+ selectionDelegateModel: modelSelect
activeFocusOnTab: true
@@ -311,10 +311,6 @@ FocusScope {
modelSelect.select(model.index(0,0), ItemSelectionModel.ClearAndSelect)
}
- onSelectAll: modelSelect.selectAll()
-
- onSelectionUpdated: modelSelect.updateSelection(keyModifiers, oldIndex, newIndex)
-
onActionAtIndex: _actionAtIndex()
//-------------------------------------------------------------------------------------
=====================================
modules/gui/qt/medialibrary/qml/MusicAlbums.qml
=====================================
@@ -130,7 +130,7 @@ FocusScope {
headerDelegate: root.header
- delegateModel: selectionModel
+ selectionDelegateModel: selectionModel
model: albumModelId
Widgets.GridShadows {
@@ -197,9 +197,6 @@ FocusScope {
}
}
- onSelectAll: selectionModel.selectAll()
- onSelectionUpdated: selectionModel.updateSelection( keyModifiers, oldIndex, newIndex )
-
Navigation.parentItem: root
Navigation.cancelAction: root._onNavigationCancel
=====================================
modules/gui/qt/medialibrary/qml/MusicAllArtists.qml
=====================================
@@ -107,7 +107,7 @@ FocusScope {
anchors.fill: parent
topMargin: VLCStyle.margin_large
- delegateModel: selectionModel
+ selectionDelegateModel: selectionModel
model: artistModel
focus: true
cellWidth: VLCStyle.colWidth(1)
@@ -116,8 +116,6 @@ FocusScope {
Navigation.parentItem: root
Navigation.cancelAction: root._onNavigationCancel
- onSelectAll: selectionModel.selectAll()
- onSelectionUpdated: selectionModel.updateSelection( keyModifiers, oldIndex, newIndex )
onActionAtIndex: {
if (selectionModel.selectedIndexes.length > 1) {
MediaLib.addAndPlay( artistModel.getIdsForIndexes( selectionModel.selectedIndexes ) )
=====================================
modules/gui/qt/medialibrary/qml/MusicArtist.qml
=====================================
@@ -170,7 +170,7 @@ FocusScope {
}
onSelectAll: albumSelectionModel.selectAll()
- onSelectionUpdated: albumSelectionModel.updateSelection( keyModifiers, oldIndex, newIndex )
+
onActionAtIndex: MediaLib.addAndPlay( albumModel.getIdForIndex( index ) )
Widgets.GridShadows {
@@ -302,7 +302,7 @@ FocusScope {
cellWidth: VLCStyle.gridItem_music_width
cellHeight: VLCStyle.gridItem_music_height
headerDelegate: root.header
- delegateModel: albumSelectionModel
+ selectionDelegateModel: albumSelectionModel
model: albumModel
Connections {
@@ -366,8 +366,6 @@ FocusScope {
}
}
- onSelectAll: albumSelectionModel.selectAll()
- onSelectionUpdated: albumSelectionModel.updateSelection( keyModifiers, oldIndex, newIndex )
Navigation.parentItem: root
Navigation.upAction: function() {
=====================================
modules/gui/qt/medialibrary/qml/MusicGenres.qml
=====================================
@@ -133,7 +133,7 @@ FocusScope {
MainInterface.MainGridView {
id: gridView_id
- delegateModel: selectionModel
+ selectionDelegateModel: selectionModel
model: genreModel
topMargin: VLCStyle.margin_large
@@ -217,8 +217,6 @@ FocusScope {
cellWidth: VLCStyle.colWidth(2)
cellHeight: cellWidth / 2
- onSelectAll: selectionModel.selectAll()
- onSelectionUpdated: selectionModel.updateSelection( keyModifiers, oldIndex, newIndex )
onActionAtIndex: _actionAtIndex(index)
Navigation.parentItem: root
=====================================
modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
=====================================
@@ -239,7 +239,7 @@ FocusScope {
model: root.model
- delegateModel: modelSelect
+ selectionDelegateModel: modelSelect
Navigation.parentItem: root
@@ -304,10 +304,6 @@ FocusScope {
modelSelect.select(model.index(0,0), ItemSelectionModel.ClearAndSelect)
}
- onSelectAll: modelSelect.selectAll()
-
- onSelectionUpdated: modelSelect.updateSelection(keyModifiers, oldIndex, newIndex)
-
onActionAtIndex: _actionAtIndex()
//-------------------------------------------------------------------------------------
=====================================
modules/gui/qt/medialibrary/qml/VideoAll.qml
=====================================
@@ -188,7 +188,7 @@ FocusScope {
model: root.model
- delegateModel: modelSelect
+ selectionDelegateModel: modelSelect
headerDelegate: root.header
@@ -229,10 +229,6 @@ FocusScope {
modelSelect.select(model.index(0,0), ItemSelectionModel.ClearAndSelect);
}
- onSelectAll: modelSelect.selectAll()
-
- onSelectionUpdated: modelSelect.updateSelection(keyModifiers, oldIndex, newIndex)
-
onActionAtIndex: _actionAtIndex()
// Connections
=====================================
modules/gui/qt/medialibrary/qml/VideoDisplayRecentVideos.qml
=====================================
@@ -183,7 +183,6 @@ FocusScope {
width: VLCStyle.margin_normal
}
- onSelectionUpdated: recentVideoSelection.updateSelection( keyModifiers, oldIndex, newIndex )
onActionAtIndex: {
g_mainDisplay.showPlayer()
MediaLib.addAndPlay( model.getIdsForIndexes( recentVideoSelection.selectedIndexes ), [":restore-playback-pos=2"] )
=====================================
modules/gui/qt/network/qml/NetworkBrowseDisplay.qml
=====================================
@@ -144,7 +144,7 @@ FocusScope {
MainInterface.MainGridView {
id: gridView
- delegateModel: selectionModel
+ selectionDelegateModel: selectionModel
model: filterModel
headerDelegate: FocusScope {
@@ -222,8 +222,6 @@ FocusScope {
}
}
- onSelectAll: selectionModel.selectAll()
- onSelectionUpdated: selectionModel.updateSelection( keyModifiers, oldIndex, newIndex )
onActionAtIndex: _actionAtIndex(index)
Navigation.parentItem: root
=====================================
modules/gui/qt/network/qml/NetworkHomeDeviceListView.qml
=====================================
@@ -123,8 +123,6 @@ FocusScope {
}
}
- onSelectAll: deviceSelection.selectAll()
- onSelectionUpdated: deviceSelection.updateSelection( keyModifiers, oldIndex, newIndex )
onActionAtIndex: {
_actionAtIndex(index, deviceModel, deviceSelection)
}
=====================================
modules/gui/qt/network/qml/ServicesHomeDisplay.qml
=====================================
@@ -300,7 +300,7 @@ Widgets.PageLoader {
readonly property bool isViewMultiView: false
- delegateModel: selectionModel
+ selectionDelegateModel: selectionModel
model: sourcesFilterModel
topMargin: VLCStyle.margin_large
cellWidth: VLCStyle.gridItem_network_width
@@ -395,9 +395,6 @@ Widgets.PageLoader {
}
- onSelectAll: selectionModel.selectAll()
- onSelectionUpdated: selectionModel.updateSelection( keyModifiers, oldIndex, newIndex )
-
onActionAtIndex: {
var itemData = sourcesFilterModel.getDataAt(index);
=====================================
modules/gui/qt/widgets/qml/ExpandGridView.qml
=====================================
@@ -16,7 +16,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
import QtQuick 2.11
+import QtQml.Models 2.11
import QtQuick.Controls 2.4
+
import org.videolan.vlc 0.1
import "qrc:///style/"
@@ -59,7 +61,7 @@ FocusScope {
/
_effectiveCellWidth), 1)
- property Util.SelectableDelegateModel delegateModel
+ property Util.SelectableDelegateModel selectionDelegateModel
property QtAbstractItemModel model
property int currentIndex: 0
@@ -107,7 +109,6 @@ FocusScope {
// Signals
//signals emitted when selected items is updated from keyboard
- signal selectionUpdated( int keyModifiers, int oldIndex,int newIndex )
signal selectAll()
signal actionAtIndex(int index)
@@ -186,7 +187,7 @@ FocusScope {
var oldIndex = currentIndex;
currentIndex = newIndex;
- selectionUpdated(event.modifiers, oldIndex, newIndex);
+ selectionDelegateModel.updateSelection(event.modifiers, oldIndex, newIndex)
// NOTE: We make sure we have the proper visual focus on components.
if (oldIndex < currentIndex)
@@ -206,7 +207,7 @@ FocusScope {
if (event.matches(StandardKey.SelectAll)) {
event.accepted = true
- selectAll()
+ selectionDelegateModel.select(model.index(0, 0), ItemSelectionModel.Select | ItemSelectionModel.Columns)
} else if ( KeyHelper.matchOk(event) ) {
event.accepted = true
actionAtIndex(currentIndex)
@@ -232,7 +233,7 @@ FocusScope {
}
Connections {
- target: delegateModel
+ target: selectionDelegateModel
onSelectionChanged: {
var i
@@ -378,8 +379,8 @@ FocusScope {
}
function leftClickOnItem(modifier, index) {
- delegateModel.updateSelection(modifier, currentIndex, index)
- if (delegateModel.isSelected(model.index(index, 0)))
+ selectionDelegateModel.updateSelection(modifier, currentIndex, index)
+ if (selectionDelegateModel.isSelected(model.index(index, 0)))
currentIndex = index
else if (currentIndex === index) {
if (_containsItem(currentIndex))
@@ -392,7 +393,7 @@ FocusScope {
}
function rightClickOnItem(index) {
- if (!delegateModel.isSelected(model.index(index, 0))) {
+ if (!selectionDelegateModel.isSelected(model.index(index, 0))) {
leftClickOnItem(Qt.NoModifier, index)
}
}
@@ -461,25 +462,23 @@ FocusScope {
function _repositionItem(id, x, y) {
var item = _getItem(id)
- if (item === undefined)
- throw "wrong child: " + id
+ console.assert(item !== undefined, "wrong child: " + id)
//theses properties are always defined in Item
item.x = x
item.y = y
- item.selected = delegateModel.isSelected(model.index(id, 0))
+ item.selected = selectionDelegateModel.isSelected(model.index(id, 0))
return item
}
function _recycleItem(id, x, y) {
var item = _unusedItemList.pop()
- if (item === undefined)
- throw "wrong toRecycle child " + id + ", len " + toUse.length
+ console.assert(item !== undefined, "incorrect _recycleItem call, id" + id + " ununsedItemList size" + _unusedItemList.length)
item.index = id
item.model = model.getDataAt(id)
- item.selected = delegateModel.isSelected(model.index(id, 0))
+ item.selected = selectionDelegateModel.isSelected(model.index(id, 0))
item.x = x
item.y = y
item.visible = true
@@ -491,16 +490,15 @@ FocusScope {
function _createItem(id, x, y) {
var item = delegate.createObject( flickable.contentItem, {
- selected: delegateModel.isSelected(model.index(id, 0)),
+ selected: selectionDelegateModel.isSelected(model.index(id, 0)),
index: id,
model: model.getDataAt(id),
x: x,
y: y,
visible: true
- });
- if (item === undefined)
- throw "wrong unable to instantiate child " + id
+ })
+ console.assert(item !== undefined, "unable to instantiate " + id)
_setItem(id, item)
return item
@@ -576,8 +574,8 @@ FocusScope {
Helpers.enforceFocus(flickable, Qt.MouseFocusReason)
if (!(modifiers & (Qt.ShiftModifier | Qt.ControlModifier))) {
- if (delegateModel)
- delegateModel.clear()
+ if (selectionDelegateModel)
+ selectionDelegateModel.clear()
}
}
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/57c90009a3bd08627da2f59a33b1e4de735707c6...d053352f118c6c07d4445b365c65f9ca5c15da21
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/57c90009a3bd08627da2f59a33b1e4de735707c6...d053352f118c6c07d4445b365c65f9ca5c15da21
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list