Merge lp:~vthompson/music-app/remix-genres-tab-001 into lp:music-app/remix

Proposed by Victor Thompson
Status: Merged
Approved by: Andrew Hayzen
Approved revision: 683
Merged at revision: 684
Proposed branch: lp:~vthompson/music-app/remix-genres-tab-001
Merge into: lp:music-app/remix
Diff against target: 144 lines (+117/-1)
3 files modified
MusicGenres.qml (+99/-0)
common/CoverGrid.qml (+1/-1)
music-app.qml (+17/-0)
To merge this branch: bzr merge lp:~vthompson/music-app/remix-genres-tab-001
Reviewer Review Type Date Requested Status
Andrew Hayzen Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+239075@code.launchpad.net

Commit message

Add an initial Genres tab

Description of the change

Add an initial Genres tab and CoverGrid for each genre.

To post a comment you must log in.
683. By Victor Thompson

Add MusicGenre component.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrew Hayzen (ahayzen) wrote :

Awesome :) we should investigate using the filter.pattern: /\S+/ for the Albums and Artists models

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'MusicGenres.qml'
2--- MusicGenres.qml 1970-01-01 00:00:00 +0000
3+++ MusicGenres.qml 2014-10-21 15:09:22 +0000
4@@ -0,0 +1,99 @@
5+/*
6+ * Copyright (C) 2013, 2014
7+ * Andrew Hayzen <ahayzen@gmail.com>
8+ * Daniel Holm <d.holmen@gmail.com>
9+ * Victor Thompson <victor.thompson@gmail.com>
10+ *
11+ * This program is free software; you can redistribute it and/or modify
12+ * it under the terms of the GNU General Public License as published by
13+ * the Free Software Foundation; version 3.
14+ *
15+ * This program is distributed in the hope that it will be useful,
16+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+ * GNU General Public License for more details.
19+ *
20+ * You should have received a copy of the GNU General Public License
21+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
22+ */
23+
24+import QtQuick 2.3
25+import Ubuntu.Components 1.1
26+import Ubuntu.MediaScanner 0.1
27+import "common"
28+
29+
30+MusicPage {
31+ id: mainpage
32+ objectName: "genresPage"
33+ title: i18n.tr("Genres")
34+
35+ CardView {
36+ id: genreCardView
37+ itemWidth: units.gu(12)
38+ model: SortFilterModel {
39+ id: genresModelFilter
40+ model: GenresModel {
41+ id: genresModel
42+ store: musicStore
43+ }
44+ filter.property: "genre"
45+ filter.pattern: /\S+/
46+ }
47+
48+ delegate: Card {
49+ id: genreCard
50+ coverSources: []
51+ objectName: "genresPageGridItem" + index
52+ primaryText: model.genre
53+ secondaryTextVisible: false
54+
55+ property string album: ""
56+
57+ AlbumsModel {
58+ id: albumGenreModel
59+ genre: model.genre
60+ store: musicStore
61+ }
62+
63+ Repeater {
64+ id: albumGenreModelRepeater
65+ model: AlbumsModel {
66+ genre: model.genre
67+ store: musicStore
68+ }
69+
70+ delegate: Item {
71+ property string art: model.art
72+ }
73+ property var covers: []
74+ signal finished()
75+
76+ onFinished: {
77+ genreCard.coverSources = covers
78+ }
79+ onItemAdded: {
80+ covers.push({art: item.art});
81+
82+ if (index === count - 1) {
83+ finished();
84+ }
85+ }
86+ }
87+
88+ onClicked: {
89+ songsPage.covers = genreCard.coverSources
90+ songsPage.album = undefined
91+ songsPage.isAlbum = true
92+ songsPage.genre = model.genre;
93+ songsPage.title = i18n.tr("Genre")
94+ songsPage.line2 = model.genre
95+ songsPage.line1 = i18n.tr("Genre")
96+
97+
98+ mainPageStack.push(songsPage)
99+ }
100+ }
101+ }
102+}
103+
104
105=== modified file 'common/CoverGrid.qml'
106--- common/CoverGrid.qml 2014-10-20 15:56:44 +0000
107+++ common/CoverGrid.qml 2014-10-21 15:09:22 +0000
108@@ -60,7 +60,7 @@
109 ? (coverGrid.covers[index].art !== undefined
110 ? coverGrid.covers[index].art
111 : "image://albumart/artist=" + coverGrid.covers[index].author + "&album=" + coverGrid.covers[index].album)
112- : undefined
113+ : ""
114 sourceSize.height: height
115 sourceSize.width: width
116
117
118=== modified file 'music-app.qml'
119--- music-app.qml 2014-10-20 14:09:45 +0000
120+++ music-app.qml 2014-10-21 15:09:22 +0000
121@@ -1041,6 +1041,23 @@
122 }
123 }
124
125+ // forth tab is genres
126+ Tab {
127+ property bool populated: true
128+ property var loader: []
129+ property bool loading: false
130+ property var model: []
131+ id: genresTab
132+ objectName: "genresTab"
133+ anchors.fill: parent
134+ title: page.title
135+
136+ // Tab content begins here
137+ page: MusicGenres {
138+ id: musicGenresPage
139+ }
140+ }
141+
142 // fourth tab is all songs
143 Tab {
144 property bool populated: true

Subscribers

People subscribed via source and target branches