~mateo-salta/uvolman/uvolman

« back to all changes in this revision

Viewing changes to uVolMan/VolSlider.qml

  • Committer: Devid Antonio Filoni
  • Date: 2016-07-29 19:40:57 UTC
  • Revision ID: git-v1:cdfff2c72a8eb5247b10da7d60874d8a3f600168
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of uvolman.dfiloni
 
3
 *
 
4
 * Copyright (C) 2016 Devid Antonio Filoni https://launchpad.net/~d.filoni
 
5
 *
 
6
 * This program is free software: you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation, either version 3 of the License, or
 
9
 * (at your option) any later version.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
 */
 
19
 
 
20
import QtQuick 2.4
 
21
import Ubuntu.Components 1.3
 
22
 
 
23
Column {
 
24
    property alias slider: sliderId
 
25
    property alias labelText: label.text
 
26
    property alias divider: listItem.divider
 
27
 
 
28
    anchors.left: parent.left
 
29
    anchors.right: parent.right
 
30
 
 
31
    ListItem {
 
32
        id: listItem
 
33
        height: units.gu(8.5)
 
34
 
 
35
        Label {
 
36
            id: label
 
37
            anchors {
 
38
                top: parent.top
 
39
                left: parent.left
 
40
                topMargin: units.gu(1)
 
41
                leftMargin: units.gu(2)
 
42
            }
 
43
            horizontalAlignment: Text.AlignLeft
 
44
            text: i18n.tr("Volume")
 
45
        }
 
46
 
 
47
        Icon {
 
48
            anchors {
 
49
                top: label.bottom
 
50
                left: parent.left
 
51
                topMargin: units.gu(1)
 
52
                leftMargin: units.gu(2)
 
53
            }
 
54
            width: height
 
55
            height: units.gu(3)
 
56
            source: "image://theme/audio-volume-low-zero"
 
57
        }
 
58
 
 
59
        Slider {
 
60
            id: sliderId
 
61
            function formatValue(v) { return v.toFixed(2)*100 }
 
62
            anchors {
 
63
                top: label.bottom
 
64
                left: parent.left
 
65
                right: parent.right
 
66
                leftMargin: units.gu(6)
 
67
                rightMargin: units.gu(6)
 
68
            }
 
69
            minimumValue: 0.0
 
70
            maximumValue: 1.0
 
71
            live: false
 
72
        }
 
73
 
 
74
        Icon {
 
75
            anchors {
 
76
                top: label.bottom
 
77
                right: parent.right
 
78
                topMargin: units.gu(1)
 
79
                rightMargin: units.gu(2)
 
80
            }
 
81
            width: height
 
82
            height: units.gu(3)
 
83
            source: "image://theme/audio-volume-high"
 
84
        }
 
85
    }
 
86
}