-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMediaSelectZoneDelegate.qml
More file actions
191 lines (168 loc) · 4.08 KB
/
MediaSelectZoneDelegate.qml
File metadata and controls
191 lines (168 loc) · 4.08 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
import QtQuick 2.1
import BasicUIControls 1.0
import qb.components 1.0
Rectangle
{
width: isNxt ? 320 : 250
height: isNxt ? 50 : 40
color: colors.canvas
property string kpiPrefix: "zoneSelectscreen"
function friendlyName(state) {
switch (state) {
case "TRANSITIONING": return "Overgang";
case "PLAYING": return "Speelt af";
case "STOPPED": return "Gestopt";
case "PAUSED_PLAYBACK": return "Gepauzeerd";
default: break;
}
return state;
}
StandardButton {
id: zoneButton
controlGroup: zoneGroup
width: isNxt ? 270 : 220
height: isNxt ? 45 : 36
radius: 5
text: (isGroup == "yes") ? "Grp " + zoneName : zoneName
fontPixelSize: isNxt ? 25 : 20
x: isNxt ? 25 : 20
onClicked: {
if (app.zoneToSelect == "sonosName") {
app.sonosName = zoneName;
app.sonosNameIsGroup = (isGroup == "yes");
}
if (app.zoneToSelect == "sonosNameVoetbalApp") {
app.sonosNameVoetbalApp = zoneName;
}
app.saveSettings();
hide();
}
}
Text {
id: itemMuted
text: friendlyName(playbackState)
font.pixelSize: isNxt ? 20 : 16
font.family: qfont.regular.name
font.bold: true
color: colors.tileTextColor
width: isNxt ? 250 : 200
anchors.left: zoneButton.right
anchors.leftMargin : 20
anchors.top: zoneButton.top
}
Text {
id: itemArtist
text: artist
font.pixelSize: isNxt ? 15 : 12
font.family: qfont.regular.name
font.bold: true
color: colors.tileTextColor
width: isNxt ? 250 : 200
anchors.left: zoneButton.right
anchors.leftMargin : 20
anchors.bottom: zoneButton.bottom
}
//volume control session start here, first you'll find the first button.
IconButton {
id: volumeDown
anchors {
left: itemMuted.right
leftMargin: isNxt ? 15 : 12
}
iconSource: "qrc:/tsc/volume_down_small.png"
onClicked: {
if (isGroup == "yes") {
app.simpleSynchronous("http://"+app.connectionPath+"/"+app.sonosName+"/groupVolume/-2");
} else {
app.simpleSynchronous("http://"+app.connectionPath+"/"+app.sonosName+"/volume/-2");
}
volume = volume - 2;
if (volume < 0 ) volume = 0;
}
visible: volume > 0
}
IconButton {
id: prevButton
anchors {
left: volumeDown.right
leftMargin: isNxt ? 15 : 12
bottom: volumeDown.bottom
}
iconSource: "qrc:/tsc/left.png"
onClicked: {
app.simpleSynchronous("http://"+app.connectionPath+"/"+zoneName + "/previous");
}
}
IconButton {
id: pauseButton
anchors {
left: prevButton.right
leftMargin: isNxt ? 15 : 12
bottom: prevButton.bottom
}
iconSource: "qrc:/tsc/pause.png"
onClicked: {
app.simpleSynchronous("http://"+app.connectionPath+"/"+zoneName+"/pause");
}
visible: playbackState == "PLAYING"
}
IconButton {
id: playButton
anchors {
left: pauseButton.right
leftMargin: isNxt ? 15 : 12
bottom: pauseButton.bottom
}
iconSource: "qrc:/tsc/play.png"
onClicked: {
app.simpleSynchronous("http://"+app.connectionPath+"/"+zoneName+"/play");
}
visible: playbackState !== "PLAYING"
}
IconButton {
id: nextButton
anchors {
left: playButton.right
leftMargin: isNxt ? 15 : 12
bottom: pauseButton.bottom
}
iconSource: "qrc:/tsc/right.png"
onClicked: {
console.log("next");
app.simpleSynchronous("http://"+app.connectionPath+"/"+zoneName+"/next");
}
}
//last in this section is the volume up button.
IconButton {
id: volumeUp
anchors {
bottom: nextButton.bottom
left: nextButton.right
leftMargin: isNxt ? 15 : 12
}
iconSource: "qrc:/tsc/volume_up_small.png"
onClicked: {
if (isGroup == "yes") {
app.simpleSynchronous("http://"+app.connectionPath+"/"+app.sonosName+"/groupVolume/+2");
} else {
app.simpleSynchronous("http://"+app.connectionPath+"/"+app.sonosName+"/volume/+2");
}
volume = volume + 2;
if (volume > 100) volume = 100;
}
visible: volume < 100
}
Text {
id: itemVolume
text: volume + "%"
font.pixelSize: isNxt ? 20 : 16
font.family: qfont.regular.name
font.bold: true
color: colors.tileTextColor
width: isNxt ? 75 : 60
anchors.left: volumeUp.right
anchors.leftMargin : isNxt ? 20 : 10
anchors.top: volumeUp.top
anchors.topMargin : 10
}
}