[vlc-commits] qml: refactor artist view from MusicArtistDisplay to separate component
Prince Gupta
git at videolan.org
Mon Aug 10 12:09:32 CEST 2020
vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Wed Jul 22 16:10:04 2020 +0530| [c28d9f43791824038f386d6bf41f03d6080827ef] | committer: Pierre Lamot
qml: refactor artist view from MusicArtistDisplay to separate component
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c28d9f43791824038f386d6bf41f03d6080827ef
---
modules/gui/qt/Makefile.am | 1 +
modules/gui/qt/medialibrary/qml/MusicArtist.qml | 50 ++++++++++++++++++++++
.../qt/medialibrary/qml/MusicArtistsDisplay.qml | 22 ++--------
modules/gui/qt/vlc.qrc | 1 +
4 files changed, 56 insertions(+), 18 deletions(-)
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index b02cb7440d..4ecf090159 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -598,6 +598,7 @@ libqt_plugin_la_QML = \
gui/qt/medialibrary/qml/MusicAlbums.qml \
gui/qt/medialibrary/qml/MusicAlbumsDisplay.qml \
gui/qt/medialibrary/qml/MusicAlbumsGridExpandDelegate.qml \
+ gui/qt/medialibrary/qml/MusicArtist.qml \
gui/qt/medialibrary/qml/MusicArtistsDisplay.qml \
gui/qt/medialibrary/qml/MusicDisplay.qml \
gui/qt/medialibrary/qml/MusicGenres.qml \
diff --git a/modules/gui/qt/medialibrary/qml/MusicArtist.qml b/modules/gui/qt/medialibrary/qml/MusicArtist.qml
new file mode 100644
index 0000000000..32f0d87221
--- /dev/null
+++ b/modules/gui/qt/medialibrary/qml/MusicArtist.qml
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * Copyright (C) 2020 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+import QtQuick.Controls 2.4
+import QtQuick 2.11
+import QtQml.Models 2.2
+import QtQuick.Layouts 1.3
+
+import org.videolan.medialib 0.1
+
+import "qrc:///util/" as Util
+import "qrc:///widgets/" as Widgets
+import "qrc:///style/"
+
+MusicAlbums {
+ id: root
+
+ property var artist: ({})
+
+ gridViewMarginTop: 0
+ focus: true
+ navigationUpItem: headerItem
+
+ header: ArtistTopBanner {
+ id: artistBanner
+
+ width: root.width
+ artist: root.artist
+ navigationParent: root.navigationParent
+ navigationLeftItem: root.navigationLeftItem
+ navigationDown: function() {
+ artistBanner.focus = false
+ root.forceActiveFocus()
+ }
+ }
+}
diff --git a/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml b/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml
index 02e64bbde7..ba31973ef5 100644
--- a/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml
@@ -162,33 +162,19 @@ Widgets.NavigableFocusScope {
}
-
- MusicAlbums {
+ MusicArtist {
id: albumSubView
height: parent.height
width: parent.width * .75
- gridViewMarginTop: 0
focus: true
parentId: root.artistId
initialIndex: root.initialAlbumIndex
navigationParent: root
- navigationUpItem: albumSubView.headerItem
navigationLeftItem: artistList
-
- header: ArtistTopBanner {
- id: artistBanner
- width: albumSubView.width
- artist: (artistList.currentIndex >= 0)
- ? artistModel.getDataAt(artistList.currentIndex)
- : ({})
- navigationParent: root
- navigationLeftItem: artistList
- navigationDown: function() {
- artistBanner.focus = false
- view.forceActiveFocus()
- }
- }
+ artist: (artistList.currentIndex >= 0)
+ ? artistModel.getDataAt(artistList.currentIndex)
+ : ({})
onCurrentIndexChanged: {
history.update(["mc", "music", "artists", {"initialIndex" : root.currentIndex, "initialAlbumIndex": albumSubView.currentIndex }])
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index fb753306ec..51f3a61701 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -242,6 +242,7 @@
<file alias="VideoDisplay.qml">medialibrary/qml/VideoDisplay.qml</file>
<file alias="MusicAlbumsDisplay.qml">medialibrary/qml/MusicAlbumsDisplay.qml</file>
<file alias="MusicAlbumsGridExpandDelegate.qml">medialibrary/qml/MusicAlbumsGridExpandDelegate.qml</file>
+ <file alias="MusicArtist.qml">medialibrary/qml/MusicArtist.qml</file>
<file alias="MusicArtistsDisplay.qml">medialibrary/qml/MusicArtistsDisplay.qml</file>
<file alias="MusicGenresDisplay.qml">medialibrary/qml/MusicGenresDisplay.qml</file>
<file alias="MusicTracksDisplay.qml">medialibrary/qml/MusicTracksDisplay.qml</file>
More information about the vlc-commits
mailing list