~unity-team/unity8/trunk

« back to all changes in this revision

Viewing changes to Panel/Menus/Overview/VolumeWidget.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
import "../../../Components/"
 
20
 
 
21
Item {
 
22
    id: volumeWidget
 
23
 
 
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)
 
35
 
 
36
        MouseArea {
 
37
            anchors.fill: parent
 
38
            onClicked: volumeControl.volumeDown();
 
39
        }
 
40
    }
 
41
 
 
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
 
55
 
 
56
        onValueChanged: {
 
57
            volumeControl.volume = value;
 
58
        }
 
59
 
 
60
        Binding {
 
61
            target: slider
 
62
            property: "value"
 
63
            value: volumeControl.volume
 
64
        }
 
65
 
 
66
        function formatValue(v) {
 
67
            return ""
 
68
        }
 
69
    }
 
70
 
 
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)
 
82
 
 
83
        MouseArea {
 
84
            anchors.fill: parent
 
85
            onClicked: volumeControl.volumeUp();
 
86
        }
 
87
    }
 
88
}