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
=== modified file 'MusicAlbums.qml'
--- MusicAlbums.qml 2014-10-07 12:58:24 +0000
+++ MusicAlbums.qml 2014-10-13 16:35:43 +0000
@@ -42,7 +42,7 @@
42 }42 }
43 delegate: Card {43 delegate: Card {
44 id: albumCard44 id: albumCard
45 imageSource: model.art45 coverSources: [{art: model.art}]
46 objectName: "albumsPageGridItem" + index46 objectName: "albumsPageGridItem" + index
47 primaryText: model.title47 primaryText: model.title
48 secondaryText: model.artist48 secondaryText: model.artist
4949
=== modified file 'MusicArtists.qml'
--- MusicArtists.qml 2014-10-13 13:05:59 +0000
+++ MusicArtists.qml 2014-10-13 16:35:43 +0000
@@ -46,7 +46,7 @@
46 }46 }
47 delegate: Card {47 delegate: Card {
48 id: artistCard48 id: artistCard
49 imageSource: "image://artistart/artist=" + model.artist + "&album=" + artistCard.album49 coverSources: [{art: "image://artistart/artist=" + model.artist + "&album=" + artistCard.album}]
50 objectName: "artistsPageGridItem" + index50 objectName: "artistsPageGridItem" + index
51 primaryText: model.artist51 primaryText: model.artist
52 secondaryTextVisible: false52 secondaryTextVisible: false
5353
=== modified file 'common/Card.qml'
--- common/Card.qml 2014-10-11 03:20:48 +0000
+++ common/Card.qml 2014-10-13 16:35:43 +0000
@@ -24,7 +24,7 @@
24 color: "transparent"24 color: "transparent"
25 height: cardColumn.childrenRect.height + 2 * bg.anchors.margins25 height: cardColumn.childrenRect.height + 2 * bg.anchors.margins
2626
27 property alias imageSource: image.source27 property alias coverSources: coverGrid.covers
28 property alias primaryText: primaryLabel.text28 property alias primaryText: primaryLabel.text
29 property alias secondaryText: secondaryLabel.text29 property alias secondaryText: secondaryLabel.text
30 property alias secondaryTextVisible: secondaryLabel.visible30 property alias secondaryTextVisible: secondaryLabel.visible
@@ -75,16 +75,9 @@
75 }75 }
76 spacing: units.gu(0.5)76 spacing: units.gu(0.5)
7777
78 Image {78 CoverGrid {
79 id: image79 id: coverGrid
80 height: parent.width80 size: parent.width
81 width: parent.width
82
83 onStatusChanged: {
84 if (status === Image.Error) {
85 source = Qt.resolvedUrl("../images/music-app-cover@30.png")
86 }
87 }
88 }81 }
8982
90 Rectangle {83 Rectangle {
9184
=== added file 'common/CoverGrid.qml'
--- common/CoverGrid.qml 1970-01-01 00:00:00 +0000
+++ common/CoverGrid.qml 2014-10-13 16:35:43 +0000
@@ -0,0 +1,71 @@
1/*
2 * Copyright (C) 2013, 2014
3 * Andrew Hayzen <ahayzen@gmail.com>
4 * Nekhelesh Ramananthan <krnekhelesh@gmail.com>
5 * Victor Thompson <victor.thompson@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20import QtQuick 2.3
21import Ubuntu.Components 1.1
22
23Rectangle {
24 id: coverGrid
25 color: "transparent"
26 height: size
27 width: size
28
29 // Property (array) to store the cover images
30 property var covers
31
32 // Property to set the size of the cover image
33 property int size
34
35 onCoversChanged: {
36 if (covers !== undefined) {
37 while (covers.length > 4) { // remove any covers after 4
38 covers.pop()
39 }
40 }
41 }
42
43 // Flow of the cover arts in either 1, 1x1, 2x1, 2x2
44 Flow {
45 id: imageRow
46 anchors {
47 fill: parent
48 }
49
50 Repeater {
51 id: repeat
52 model: coverGrid.covers.length === 0 ? 1 : coverGrid.covers.length
53 delegate: Image {
54 fillMode: Image.PreserveAspectCrop
55 height: coverGrid.size / (coverGrid.covers.length > 1 ? 2 : 1)
56 width: coverGrid.size / (coverGrid.covers.length > 2 && !(coverGrid.covers.length === 3 && index === 2) ? 2 : 1)
57 source: coverGrid.covers.length !== 0 && coverGrid.covers[index] !== "" && coverGrid.covers[index] !== undefined
58 ? (coverGrid.covers[index].art !== undefined
59 ? coverGrid.covers[index].art
60 : "image://albumart/artist=" + coverGrid.covers[index].author + "&album=" + coverGrid.covers[index].album)
61 : Qt.resolvedUrl("../images/music-app-cover@30.png")
62 onStatusChanged: {
63 if (status === Image.Error) {
64 source = Qt.resolvedUrl("../images/music-app-cover@30.png")
65 }
66 }
67 }
68 }
69 }
70}
71

Subscribers

People subscribed via source and target branches