Merge lp:~ahayzen/music-app/remix-cover-grid into lp:music-app/remix

Proposed by Andrew Hayzen
Status: Merged
Approved by: Victor Thompson
Approved revision: 670
Merged at revision: 668
Proposed branch: lp:~ahayzen/music-app/remix-cover-grid
Merge into: lp:music-app/remix
Diff against target: 134 lines (+77/-13)
4 files modified
MusicAlbums.qml (+1/-1)
MusicArtists.qml (+1/-1)
common/Card.qml (+4/-11)
common/CoverGrid.qml (+71/-0)
To merge this branch: bzr merge lp:~ahayzen/music-app/remix-cover-grid
Reviewer Review Type Date Requested Status
Victor Thompson Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+238079@code.launchpad.net

Commit message

* Add CoverGrid.qml component
* Use CoverGrid in Card.qml

Description of the change

* Add CoverGrid.qml component
* Use CoverGrid in Card.qml

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
668. By Andrew Hayzen

* Merge of trunk

Revision history for this message
Victor Thompson (vthompson) wrote :

I just have 2 small inline comments that should be addressed. Otherwise, this looks great!

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

* Removal of old code

670. By Andrew Hayzen

* Fix for typo :(

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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Victor Thompson (vthompson) wrote :

LGTM, Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'MusicAlbums.qml'
2--- MusicAlbums.qml 2014-10-07 12:58:24 +0000
3+++ MusicAlbums.qml 2014-10-13 16:35:43 +0000
4@@ -42,7 +42,7 @@
5 }
6 delegate: Card {
7 id: albumCard
8- imageSource: model.art
9+ coverSources: [{art: model.art}]
10 objectName: "albumsPageGridItem" + index
11 primaryText: model.title
12 secondaryText: model.artist
13
14=== modified file 'MusicArtists.qml'
15--- MusicArtists.qml 2014-10-13 13:05:59 +0000
16+++ MusicArtists.qml 2014-10-13 16:35:43 +0000
17@@ -46,7 +46,7 @@
18 }
19 delegate: Card {
20 id: artistCard
21- imageSource: "image://artistart/artist=" + model.artist + "&album=" + artistCard.album
22+ coverSources: [{art: "image://artistart/artist=" + model.artist + "&album=" + artistCard.album}]
23 objectName: "artistsPageGridItem" + index
24 primaryText: model.artist
25 secondaryTextVisible: false
26
27=== modified file 'common/Card.qml'
28--- common/Card.qml 2014-10-11 03:20:48 +0000
29+++ common/Card.qml 2014-10-13 16:35:43 +0000
30@@ -24,7 +24,7 @@
31 color: "transparent"
32 height: cardColumn.childrenRect.height + 2 * bg.anchors.margins
33
34- property alias imageSource: image.source
35+ property alias coverSources: coverGrid.covers
36 property alias primaryText: primaryLabel.text
37 property alias secondaryText: secondaryLabel.text
38 property alias secondaryTextVisible: secondaryLabel.visible
39@@ -75,16 +75,9 @@
40 }
41 spacing: units.gu(0.5)
42
43- Image {
44- id: image
45- height: parent.width
46- width: parent.width
47-
48- onStatusChanged: {
49- if (status === Image.Error) {
50- source = Qt.resolvedUrl("../images/music-app-cover@30.png")
51- }
52- }
53+ CoverGrid {
54+ id: coverGrid
55+ size: parent.width
56 }
57
58 Rectangle {
59
60=== added file 'common/CoverGrid.qml'
61--- common/CoverGrid.qml 1970-01-01 00:00:00 +0000
62+++ common/CoverGrid.qml 2014-10-13 16:35:43 +0000
63@@ -0,0 +1,71 @@
64+/*
65+ * Copyright (C) 2013, 2014
66+ * Andrew Hayzen <ahayzen@gmail.com>
67+ * Nekhelesh Ramananthan <krnekhelesh@gmail.com>
68+ * Victor Thompson <victor.thompson@gmail.com>
69+ *
70+ * This program is free software; you can redistribute it and/or modify
71+ * it under the terms of the GNU General Public License as published by
72+ * the Free Software Foundation; version 3.
73+ *
74+ * This program is distributed in the hope that it will be useful,
75+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
76+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
77+ * GNU General Public License for more details.
78+ *
79+ * You should have received a copy of the GNU General Public License
80+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
81+ */
82+
83+import QtQuick 2.3
84+import Ubuntu.Components 1.1
85+
86+Rectangle {
87+ id: coverGrid
88+ color: "transparent"
89+ height: size
90+ width: size
91+
92+ // Property (array) to store the cover images
93+ property var covers
94+
95+ // Property to set the size of the cover image
96+ property int size
97+
98+ onCoversChanged: {
99+ if (covers !== undefined) {
100+ while (covers.length > 4) { // remove any covers after 4
101+ covers.pop()
102+ }
103+ }
104+ }
105+
106+ // Flow of the cover arts in either 1, 1x1, 2x1, 2x2
107+ Flow {
108+ id: imageRow
109+ anchors {
110+ fill: parent
111+ }
112+
113+ Repeater {
114+ id: repeat
115+ model: coverGrid.covers.length === 0 ? 1 : coverGrid.covers.length
116+ delegate: Image {
117+ fillMode: Image.PreserveAspectCrop
118+ height: coverGrid.size / (coverGrid.covers.length > 1 ? 2 : 1)
119+ width: coverGrid.size / (coverGrid.covers.length > 2 && !(coverGrid.covers.length === 3 && index === 2) ? 2 : 1)
120+ source: coverGrid.covers.length !== 0 && coverGrid.covers[index] !== "" && coverGrid.covers[index] !== undefined
121+ ? (coverGrid.covers[index].art !== undefined
122+ ? coverGrid.covers[index].art
123+ : "image://albumart/artist=" + coverGrid.covers[index].author + "&album=" + coverGrid.covers[index].album)
124+ : Qt.resolvedUrl("../images/music-app-cover@30.png")
125+ onStatusChanged: {
126+ if (status === Image.Error) {
127+ source = Qt.resolvedUrl("../images/music-app-cover@30.png")
128+ }
129+ }
130+ }
131+ }
132+ }
133+}
134+

Subscribers

People subscribed via source and target branches