~unity-team/unity8/ota9.5

« back to all changes in this revision

Viewing changes to Dash/Music/AlbumTile.qml

  • Committer: Michał Sawicz
  • Date: 2013-06-05 22:03:08 UTC
  • Revision ID: michal.sawicz@canonical.com-20130605220308-yny8fv3futtr04fg
Inital unity8 commit.

Previous history can be found at https://code.launchpad.net/~unity-team/unity/phablet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2013 Canonical, Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
import QtQuick 2.0
 
18
import Ubuntu.Components 0.1
 
19
 
 
20
AbstractButton {
 
21
    id: root
 
22
    property url source
 
23
    property alias album: albumLabel.text
 
24
    property alias artist: artistLabel.text
 
25
    property alias iconWidth: icon.width
 
26
    property alias iconHeight: icon.height
 
27
 
 
28
    UbuntuShape {
 
29
        id: icon
 
30
        anchors {
 
31
            top: parent.top
 
32
            horizontalCenter: parent.horizontalCenter
 
33
        }
 
34
        radius: "medium"
 
35
        image: Image {
 
36
            source: root.source
 
37
            sourceSize { width: icon.width; height: icon.height }
 
38
            asynchronous: true
 
39
            cache: false
 
40
        }
 
41
    }
 
42
 
 
43
    UbuntuShape {
 
44
        id: borderPressed
 
45
 
 
46
        anchors.fill: icon
 
47
        radius: "medium"
 
48
        borderSource: ItemStyle.style.borderPressed
 
49
        opacity: root.pressed ? 1.0 : 0.0
 
50
        Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
 
51
    }
 
52
 
 
53
    Item {
 
54
        id: artistContainer
 
55
        anchors {
 
56
            left: parent.left
 
57
            right: parent.right
 
58
            top: icon.bottom
 
59
        }
 
60
        height: units.gu(2)
 
61
 
 
62
        Label {
 
63
            id: artistLabel
 
64
            anchors {
 
65
                baseline: parent.bottom
 
66
                left: parent.left
 
67
                right: parent.right
 
68
                leftMargin: units.gu(1)
 
69
                rightMargin: units.gu(1)
 
70
            }
 
71
 
 
72
            color: "#f3f3e7"
 
73
            opacity: 0.9
 
74
            style: Text.Raised
 
75
            styleColor: "black"
 
76
            fontSize: "small"
 
77
            elide: Text.ElideMiddle
 
78
            horizontalAlignment: Text.AlignHCenter
 
79
        }
 
80
    }
 
81
 
 
82
    Item {
 
83
        anchors {
 
84
            left: parent.left
 
85
            right: parent.right
 
86
            top: artistContainer.bottom
 
87
        }
 
88
        height: units.gu(1.5)
 
89
 
 
90
        Label {
 
91
            id: albumLabel
 
92
            anchors {
 
93
                baseline: parent.bottom
 
94
                left: parent.left
 
95
                right: parent.right
 
96
                leftMargin: units.gu(1)
 
97
                rightMargin: units.gu(1)
 
98
            }
 
99
 
 
100
            color: "#f3f3e7"
 
101
            opacity: 0.9
 
102
            style: Text.Raised
 
103
            styleColor: "black"
 
104
            fontSize: "small"
 
105
            font.weight: Font.Light
 
106
            elide: Text.ElideMiddle
 
107
            horizontalAlignment: Text.AlignHCenter
 
108
        }
 
109
    }
 
110
 
 
111
    GridView.onRemove: SequentialAnimation {
 
112
        PropertyAction { target: root; property: "GridView.delayRemove"; value: true }
 
113
        NumberAnimation { target: root; property: "opacity"; from: 1; to: 0; duration: 200; easing.type: Easing.InOutQuad }
 
114
        PropertyAction { target: root; property: "GridView.delayRemove"; value: false }
 
115
    }
 
116
}