blob: 23273ebec568c01b5a6e1f4ed73ea7eef78716ac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
import QtQuick 1.0
Rectangle {
width: 128
height: 128
color: "black"
Image {
id: mediaart
anchors.fill: parent
fillMode: Image.PreserveAspectFit
smooth: true
source: player.mediaArt
}
Rectangle {
x: 0
width: parent.width
height: 14
anchors.bottom: parent.bottom
color: "black"
Text {
anchors.fill: parent
text: player.title.length > 0 ? player.title : qsTr("No media");
color: "white"
}
}
Rectangle {
id: volumeBar
width: 18
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
color: "white"
visible: false
Image {
id: volumeIcon
anchors.top: parent.top
anchors.left: parent.left
anchors.leftMargin: 2
source: "volume.png"
}
Rectangle {
id: volumeBarBox
anchors.top: volumeIcon.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.leftMargin: 2
color: "black"
Rectangle {
id: volumeBarThing
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: 4
height: volumeBar.visible ?
(volumeControl.volume * (parent.height - anchors.margins*2)) / (volumeControl.max - volumeControl.min) :
0; // Avoid unnecessary updates when not visible.
color: "white"
}
}
Timer {
id: autoHideTimer
interval: 3000
repeat: false
onTriggered: {
volumeBar.visible = false;
}
}
function show() {
volumeBar.visible = true;
autoHideTimer.restart();
}
}
Connections {
target: watch
onButtonPressed : {
switch(button) {
case 0: {
player.playPause();
break;
}
case 1: {
volumeControl.up();
volumeBar.show();
break;
}
case 2: {
volumeControl.down();
volumeBar.show();
break;
}
case 3: {
player.previous();
break;
}
case 4: {
player.next();
break;
}
}
}
}
}
|