Debian Codegraph @

src/qml/player/VideoSlider.qml

raw
1 /*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * Authors:
5 * Renato Araujo Oliveira Filho <[email protected]>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
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 Lomiri.Components 1.3
22
23 Item {
24 id: main
25 anchors.fill: parent
26
27 // properties to be published:
28 property Item bar: backgroundShape
29 property Item thumb: thumbShape
30
31 // private properties
32 readonly property real thumbSpacing: units.gu(1)
33 readonly property real liveValue: SliderUtils.liveValue(item)
34 readonly property real normalizedValue: SliderUtils.normalizedValue(item)
35 readonly property real thumbWidth: item.height - thumbSpacing
36
37 BorderImage {
38 id: backgroundFilledShape
39
40 border {
41 left: 7
42 top: 7
43 right: 7
44 bottom: 7
45 }
46 horizontalTileMode: BorderImage.Repeat
47 verticalTileMode: BorderImage.Repeat
48 source: "artwork/slider_shape.png"
49 anchors {
50 verticalCenter: parent.verticalCenter
51 left: parent.left
52 leftMargin: units.gu(0.2)
53 }
54 height: units.gu(1)
55 width: (normalizedValue * backgroundShape.width)
56 }
57
58 BorderImage {
59 id: backgroundShape
60
61 border {
62 left: 7
63 top: 7
64 right: 7
65 bottom: 7
66 }
67 horizontalTileMode: BorderImage.Repeat
68 verticalTileMode: BorderImage.Repeat
69 source: "artwork/slider_bg.png"
70 anchors {
71 verticalCenter: parent.verticalCenter
72 left: parent.left
73 right: parent.right
74 }
75 height: units.gu(1.5)
76 }
77
78 Image {
79 id: thumbShape
80
81 x: backgroundShape.x + backgroundFilledShape.width - (width / 2)
82 anchors.verticalCenter: backgroundShape.verticalCenter
83 width: thumbWidth
84 height: thumbWidth
85 source: "artwork/slider_handle.png"
86 }
87 }