~ubuntu-branches/ubuntu/trusty/ubuntu-settings-components/trusty

« back to all changes in this revision

Viewing changes to Ubuntu/Settings/Menus/MediaPlayerMenu.qml

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2013-11-20 14:57:11 UTC
  • Revision ID: package-import@ubuntu.com-20131120145711-696cnastnyown5hx
Tags: upstream-0.1+14.04.20131120.1
ImportĀ upstreamĀ versionĀ 0.1+14.04.20131120.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 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 Lesser 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 Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by Andrea Cimitan <andrea.cimitan@canonical.com>
 
17
 */
 
18
 
 
19
import QtQuick 2.0
 
20
import Ubuntu.Components 0.1
 
21
import Ubuntu.Components.ListItems 0.1 as ListItem
 
22
 
 
23
ListItem.Empty {
 
24
    id: menu
 
25
 
 
26
    property bool running: false
 
27
    property alias playerName: playerNameLabel.text
 
28
    property alias playerIcon: playerIcon.source
 
29
 
 
30
    property alias albumArt: albumArtImage.source
 
31
    property alias song: songLabel.text
 
32
    property alias artist: artistLabel.text
 
33
    property alias album: albumLabel.text
 
34
 
 
35
    implicitHeight: column.height + units.gu(2)
 
36
    Behavior on implicitHeight { UbuntuNumberAnimation {} }
 
37
 
 
38
    Column {
 
39
        id: column
 
40
        anchors {
 
41
            left: parent.left
 
42
            right: parent.right
 
43
            top: parent.top
 
44
            topMargin: units.gu(1)
 
45
            leftMargin: menu.__contentsMargins
 
46
            rightMargin: menu.__contentsMargins
 
47
        }
 
48
        height: running ? trackRow.height : playerRow.height
 
49
 
 
50
        Row {
 
51
            objectName: "player"
 
52
            id: playerRow
 
53
            spacing: menu.__contentsMargins
 
54
            visible: !running
 
55
 
 
56
            Behavior on opacity { UbuntuNumberAnimation {} }
 
57
 
 
58
            UbuntuShape {
 
59
                width: units.gu(5)
 
60
                height: width
 
61
 
 
62
                image: Image {
 
63
                    id: playerIcon
 
64
                }
 
65
            }
 
66
 
 
67
            Label {
 
68
                id: playerNameLabel
 
69
                anchors.verticalCenter: parent.verticalCenter
 
70
            }
 
71
        }
 
72
 
 
73
        Row {
 
74
            objectName: "albumArt"
 
75
            id: trackRow
 
76
            width: menu.width
 
77
            spacing: units.gu(2)
 
78
            visible: running
 
79
 
 
80
            Behavior on opacity { UbuntuNumberAnimation {} }
 
81
 
 
82
            UbuntuShape {
 
83
                width: units.gu(10)
 
84
                height: width
 
85
 
 
86
                image: Image {
 
87
                    id: albumArtImage
 
88
                }
 
89
            }
 
90
 
 
91
            Column {
 
92
                spacing: units.gu(1)
 
93
                anchors.verticalCenter: parent.verticalCenter
 
94
 
 
95
                Label {
 
96
                    id: songLabel
 
97
                }
 
98
 
 
99
                Label {
 
100
                    id: artistLabel
 
101
                }
 
102
 
 
103
                Label {
 
104
                    id: albumLabel
 
105
                }
 
106
            }
 
107
        }
 
108
    }
 
109
}