2
* Copyright (C) 2013, 2014, 2015
3
* Andrew Hayzen <ahayzen@gmail.com>
4
* Nekhelesh Ramananthan <krnekhelesh@gmail.com>
5
* Victor Thompson <victor.thompson@gmail.com>
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.
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.
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/>.
21
import Ubuntu.Components 1.3
27
property alias column: columnComponent.sourceComponent
28
property real coverSize: styleMusic.common.albumSize
29
property var imageSource
36
verticalCenter: parent.verticalCenter
39
fillMode: Image.PreserveAspectCrop
41
source: imageSource !== undefined && imageSource !== ""
42
? (imageSource.art !== undefined
44
: "image://albumart/artist=" + imageSource.author + "&album=" + imageSource.album)
46
sourceSize.height: height
47
sourceSize.width: width
51
if (status === Image.Error) {
52
source = Qt.resolvedUrl("../graphics/music-app-cover@30.png")
55
visible: imageSource !== undefined
61
verticalCenter: parent.verticalCenter
63
width: imageSource === undefined ? parent.width - parent.spacing
64
: parent.width - image.width - parent.spacing
66
onSourceComponentChanged: {
67
for (var i=0; i < item.children.length; i++) {
68
item.children[i].elide = Text.ElideRight
69
item.children[i].height = units.gu(2)
70
item.children[i].maximumLineCount = 1
71
item.children[i].wrapMode = Text.NoWrap
72
item.children[i].verticalAlignment = Text.AlignVCenter
74
// binds to width so it is updated when screen size changes
75
item.children[i].width = Qt.binding(function () { return width; })