on ad2923e help sign in
unity8/Panel/Menus/Overview/VolumeWidget.qml
88 lines 2.2 kB history raw
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 */
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../../../Components/"
21Item {
22 id: volumeWidget
24 Image {
25 id: minVolumeIcon
26 objectName: "minVolumeIcon"
27 source: "graphics/sound_off_icon.png"
28 anchors {
29 left: parent.left
30 leftMargin: units.gu(2)
31 verticalCenter: parent.verticalCenter
32 }
33 width: units.gu(4)
34 height: units.gu(4)
36 MouseArea {
37 anchors.fill: parent
38 onClicked: volumeControl.volumeDown();
39 }
40 }
42 Slider {
43 id: slider
44 objectName: "volumeSlider"
45 anchors {
46 left: minVolumeIcon.right
47 right: maxVolumeIcon.left
48 margins: units.gu(1)
49 verticalCenter: parent.verticalCenter
50 }
51 live: false
52 minimumValue: 0
53 maximumValue: 100
54 value: 50
56 onValueChanged: {
57 volumeControl.volume = value;
58 }
60 Binding {
61 target: slider
62 property: "value"
63 value: volumeControl.volume
64 }
66 function formatValue(v) {
67 return ""
68 }
69 }
71 Image {
72 id: maxVolumeIcon
73 objectName: "maxVolumeIcon"
74 source: "graphics/sound_on_icon.png"
75 anchors {
76 right: parent.right
77 rightMargin: units.gu(2)
78 verticalCenter: parent.verticalCenter
79 }
80 width: units.gu(4)
81 height: units.gu(4)
83 MouseArea {
84 anchors.fill: parent
85 onClicked: volumeControl.volumeUp();
86 }
87 }