[vlc-commits] [Git][videolan/vlc][master] 4 commits: qml/MusicArtistsAlbums: remove unnecessary FocusScope
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Mon Sep 20 13:29:30 UTC 2021
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
ab7f6284 by Prince Gupta at 2021-09-20T13:16:38+00:00
qml/MusicArtistsAlbums: remove unnecessary FocusScope
- - - - -
91ed1731 by Prince Gupta at 2021-09-20T13:16:38+00:00
qt/MLBaseModel: fix possible dangling reference
- - - - -
a764c7db by Prince Gupta at 2021-09-20T13:16:38+00:00
qml: fix Artist list to Artist view navigation (list view)
fixup 6b96e6a078b28ebbf3e1e2f8b8f1e50dee6c0a00
- - - - -
43258848 by Prince Gupta at 2021-09-20T13:16:38+00:00
qml/MusicArtistDelegate: rename 'artistModel' property
fixes 'Binding loop detected for property artistModel' errors
- - - - -
4 changed files:
- modules/gui/qt/medialibrary/mlbasemodel.cpp
- modules/gui/qt/medialibrary/qml/MusicArtist.qml
- modules/gui/qt/medialibrary/qml/MusicArtistDelegate.qml
- modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml
Changes:
=====================================
modules/gui/qt/medialibrary/mlbasemodel.cpp
=====================================
@@ -343,7 +343,7 @@ QVariantList MLBaseModel::getItemsForIndexes(const QModelIndexList & indexes) co
if (item == nullptr)
continue;
- const MLItemId & itemId = item->getId();
+ MLItemId itemId = item->getId();
// NOTE: When we have a parent it's a collection of media(s).
if (itemId.type == VLC_ML_PARENT_UNKNOWN)
=====================================
modules/gui/qt/medialibrary/qml/MusicArtist.qml
=====================================
@@ -460,11 +460,6 @@ FocusScope {
id: tableColumns
}
- function setCurrentItemFocus(reason) {
- positionViewAtIndex(currentIndex, ItemView.Contain)
- _currentView.forceActiveFocus(reason)
- }
-
Util.SelectableDelegateModel {
id: trackSelectionModel
=====================================
modules/gui/qt/medialibrary/qml/MusicArtistDelegate.qml
=====================================
@@ -32,7 +32,7 @@ Control {
// Properties
- /* required */ property var artistModel
+ /* required */ property var mlModel
property bool isCurrent: false
@@ -89,7 +89,7 @@ Control {
}
function getSelectedInputItem() {
- return artistModel.getItemsForIndexes([artistModel.index(index, 0)]);
+ return mlModel.getItemsForIndexes([mlModel.index(index, 0)]);
}
}
=====================================
modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml
=====================================
@@ -96,123 +96,123 @@ FocusScope {
model: artistModel
}
- FocusScope {
- visible: artistModel.count > 0
- focus: visible
- anchors.fill: parent
-
- Widgets.AcrylicBackground {
- width: artistList.width
- height: artistList.height
- alternativeColor: VLCStyle.colors.bgAlt
- }
-
- Row {
- anchors.fill: parent
-
- Widgets.KeyNavigableListView {
- id: artistList
-
- spacing: 4
- model: artistModel
- currentIndex: -1
- z: 1
- height: parent.height
- width: Helpers.clamp(root.width / resizeHandle.widthFactor,
- VLCStyle.colWidth(1) + VLCStyle.column_margin_width,
- root.width * .5)
+ Widgets.AcrylicBackground {
+ /* id: artistListBackground */
+
+ visible: artistModel.count > 0
+ width: artistList.width
+ height: artistList.height
+ alternativeColor: VLCStyle.colors.bgAlt
+ focus: false
+ }
- focus: true
- displayMarginEnd: miniPlayer.height // to get blur effect while scrolling in mainview
- Navigation.parentItem: root
+ Row {
+ anchors.fill: parent
+ visible: artistModel.count > 0
- Navigation.rightAction: function() {
- albumSubView.setCurrentItemFocus(Qt.TabFocusReason);
- }
+ Widgets.KeyNavigableListView {
+ id: artistList
+
+ spacing: 4
+ model: artistModel
+ currentIndex: -1
+ z: 1
+ height: parent.height
+ width: Helpers.clamp(root.width / resizeHandle.widthFactor,
+ VLCStyle.colWidth(1) + VLCStyle.column_margin_width,
+ root.width * .5)
+
+ visible: artistModel.count > 0
+ focus: artistModel.count > 0
+ displayMarginEnd: miniPlayer.height // to get blur effect while scrolling in mainview
+ Navigation.parentItem: root
+
+ Navigation.rightAction: function() {
+ albumSubView.setCurrentItemFocus(Qt.TabFocusReason);
+ }
- Navigation.cancelAction: function() {
- if (artistList.currentIndex <= 0)
- root.Navigation.defaultNavigationCancel()
- else
- artistList.currentIndex = 0;
- }
+ Navigation.cancelAction: function() {
+ if (artistList.currentIndex <= 0)
+ root.Navigation.defaultNavigationCancel()
+ else
+ artistList.currentIndex = 0;
+ }
- header: Widgets.SubtitleLabel {
- text: i18n.qtr("Artists")
- font.pixelSize: VLCStyle.fontSize_large
- leftPadding: VLCStyle.margin_normal
- bottomPadding: VLCStyle.margin_small
- topPadding: VLCStyle.margin_xlarge
- }
+ header: Widgets.SubtitleLabel {
+ text: i18n.qtr("Artists")
+ font.pixelSize: VLCStyle.fontSize_large
+ leftPadding: VLCStyle.margin_normal
+ bottomPadding: VLCStyle.margin_small
+ topPadding: VLCStyle.margin_xlarge
+ }
- delegate: MusicArtistDelegate {
- width: artistList.width
+ delegate: MusicArtistDelegate {
+ width: artistList.width
- isCurrent: ListView.isCurrentItem
+ isCurrent: ListView.isCurrentItem
- artistModel: artistModel
+ mlModel: artistModel
- onItemClicked: {
- selectionModel.updateSelection(mouse.modifiers, artistList.currentIndex,
- index);
+ onItemClicked: {
+ selectionModel.updateSelection(mouse.modifiers, artistList.currentIndex,
+ index);
- artistList.currentIndex = index;
+ artistList.currentIndex = index;
- artistList.forceActiveFocus(Qt.MouseFocusReason);
- }
+ artistList.forceActiveFocus(Qt.MouseFocusReason);
+ }
- onItemDoubleClicked: {
- if (mouse.buttons === Qt.LeftButton)
- medialib.addAndPlay(model.id);
- else
- albumSubView.forceActiveFocus();
- }
+ onItemDoubleClicked: {
+ if (mouse.buttons === Qt.LeftButton)
+ medialib.addAndPlay(model.id);
+ else
+ albumSubView.forceActiveFocus();
}
+ }
- Behavior on width {
- SmoothedAnimation {
- easing.type: Easing.InSine
- duration: VLCStyle.ms10
- }
+ Behavior on width {
+ SmoothedAnimation {
+ easing.type: Easing.InSine
+ duration: VLCStyle.ms10
}
+ }
- Rectangle {
- // id: musicArtistLeftBorder
+ Rectangle {
+ // id: musicArtistLeftBorder
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
- width: VLCStyle.border
- color: VLCStyle.colors.border
- }
+ width: VLCStyle.border
+ color: VLCStyle.colors.border
+ }
- Widgets.HorizontalResizeHandle {
- id: resizeHandle
+ Widgets.HorizontalResizeHandle {
+ id: resizeHandle
- anchors {
- top: parent.top
- bottom: parent.bottom
- right: parent.right
+ anchors {
+ top: parent.top
+ bottom: parent.bottom
+ right: parent.right
- rightMargin: -(width / 2)
- }
- sourceWidth: root.width
- targetWidth: artistList.width
+ rightMargin: -(width / 2)
}
+ sourceWidth: root.width
+ targetWidth: artistList.width
}
+ }
- MusicArtist {
- id: albumSubView
+ MusicArtist {
+ id: albumSubView
- height: parent.height
- width: root.width - artistList.width
- focus: true
- initialIndex: root.initialAlbumIndex
- Navigation.parentItem: root
- Navigation.leftItem: artistList
- }
+ height: parent.height
+ width: root.width - artistList.width
+ focus: true
+ initialIndex: root.initialAlbumIndex
+ Navigation.parentItem: root
+ Navigation.leftItem: artistList
}
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/dfdc98f72edafc586f5a531f9071461d0d68a314...432588488f0f90a76f65b4e9d6d047818519e997
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/dfdc98f72edafc586f5a531f9071461d0d68a314...432588488f0f90a76f65b4e9d6d047818519e997
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list