~ci-train-bot/ubuntu-settings-components/ubuntu-settings-components-ubuntu-yakkety-landing-092

« back to all changes in this revision

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

  • Committer: Nick Dedekind
  • Date: 2013-10-04 10:04:18 UTC
  • mto: (50.2.3 usc.indicators-tests)
  • mto: This revision was merged to the branch mainline in revision 52.
  • Revision ID: nicholas.dedekind@gmail.com-20131004100418-ddpoed9tc3r25owa
Changes to indicator components to fit into settings

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 Nick Dedekind <nick.dedekind@gmail.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 playing: false
 
27
 
 
28
    property bool canPlay: false
 
29
    property bool canGoNext: false
 
30
    property bool canGoPrevious: false
 
31
 
 
32
    signal next()
 
33
    signal play(bool play)
 
34
    signal previous()
 
35
 
 
36
    implicitHeight: controlsRow.height + units.gu(2)
 
37
 
 
38
    Row {
 
39
        id: controlsRow
 
40
 
 
41
        anchors {
 
42
            top: parent.top
 
43
            topMargin: units.gu(1)
 
44
            horizontalCenter: parent.horizontalCenter
 
45
        }
 
46
        spacing: units.gu(2)
 
47
 
 
48
        Button {
 
49
            objectName: "previousButton"
 
50
            width: units.gu(5)
 
51
            height: width
 
52
            onClicked: menu.previous()
 
53
            text: ""
 
54
            enabled: canGoPrevious
 
55
            anchors.verticalCenter: parent.verticalCenter
 
56
 
 
57
            Icon {
 
58
                anchors.fill: parent
 
59
                anchors.margins: units.gu(1)
 
60
                name: "media-skip-backward"
 
61
                color: Theme.palette.normal.foregroundText
 
62
            }
 
63
        }
 
64
 
 
65
        Button {
 
66
            objectName: "playButton"
 
67
            width: units.gu(6)
 
68
            height: width
 
69
            onClicked: menu.play(!playing)
 
70
            text: ""
 
71
            enabled: canPlay
 
72
            anchors.verticalCenter: parent.verticalCenter
 
73
 
 
74
            Icon {
 
75
                anchors.fill: parent
 
76
                anchors.margins: units.gu(1)
 
77
                name: playing ? "media-playback-pause" : "media-playback-start"
 
78
                color:  Theme.palette.normal.foregroundText
 
79
            }
 
80
        }
 
81
 
 
82
        Button {
 
83
            objectName: "nextButton"
 
84
            width: units.gu(5)
 
85
            height: width
 
86
            onClicked: menu.next()
 
87
            text: ""
 
88
            enabled: canGoNext
 
89
            anchors.verticalCenter: parent.verticalCenter
 
90
 
 
91
            Icon {
 
92
                anchors.fill: parent
 
93
                anchors.margins: units.gu(1)
 
94
                name: "media-skip-forward"
 
95
                color:  Theme.palette.normal.foregroundText
 
96
            }
 
97
        }
 
98
    }
 
99
}