-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDomoticzboardScreen.qml
422 lines (377 loc) · 11.8 KB
/
DomoticzboardScreen.qml
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
import QtQuick 1.1
import qb.components 1.0
Screen {
id: root
screenTitleIconUrl: "./drawables/DomoticzSystrayIcon.png"
screenTitle: qsTr("DomoticzBoard")
//settings screen
onShown: {
addCustomTopRightButton("Instellingen");
}
onCustomButtonClicked: {
if (app.domoticzSettings) {
app.domoticzSettings.show();
}
}
hasBackButton : true
//http open
function simpleSynchronous(request) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", request, true);
xmlhttp.send();
}
// ----- LEFT COLUMN -----
// iconButton1
IconButton {
id: switch1Button
anchors {
top: parent.top
topMargin: isNxt ? 19 : 15
left: parent.left
leftMargin: isNxt ? 31 : 25
}
width: isNxt ? 75 : 60
height: isNxt ? 75 : 60
visible: app.switch1idx > 0 ? true : false
iconSource: app.switch1StatusIcon
onClicked: {
simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchlight&idx="+app.switch1idx+"&switchcmd=Toggle");
switchLight1();
}
}
Text {
id: switch1Title
anchors {
left: switch1Button.right
verticalCenter: switch1Button.verticalCenter
leftMargin: isNxt ? 12 : 10
}
font {
family: qfont.semiBold.name
pixelSize: isNxt ? 25 : 20
}
color: colors.clockTileColor
text: app.switch1Name
visible: app.switch1idx > 0 ? true : false
}
// iconButton2
IconButton {
id: switch2Button
anchors {
top: switch1Button.bottom
topMargin: isNxt ? 19 : 15
left: parent.left
leftMargin: isNxt ? 31 : 25
}
width: isNxt ? 75 : 60
height: isNxt ? 75 : 60
visible: app.switch2idx > 0 ? true : false
iconSource: app.switch2StatusIcon
onClicked: {
simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchlight&idx="+app.switch2idx+"&switchcmd=Toggle");
switchLight2();
}
}
Text {
id: switch2Title
anchors {
left: switch2Button.right
verticalCenter: switch2Button.verticalCenter
leftMargin: isNxt ? 12 : 10
}
font {
family: qfont.semiBold.name
pixelSize: isNxt ? 25 : 20
}
color: colors.clockTileColor
text: app.switch2Name
visible: app.switch2idx > 0 ? true : false
}
// iconButton3
IconButton {
id: switch3Button
anchors {
top: switch2Button.bottom
topMargin: isNxt ? 19 : 15
left: parent.left
leftMargin: isNxt ? 31 : 25
}
width: isNxt ? 75 : 60
height: isNxt ? 75 : 60
visible: app.switch3idx > 0 ? true : false
iconSource: app.switch3StatusIcon
onClicked: {
simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchlight&idx="+app.switch3idx+"&switchcmd=Toggle");
switchLight3();
}
}
Text {
id: switch3Title
anchors {
left: switch3Button.right
verticalCenter: switch3Button.verticalCenter
leftMargin: isNxt ? 12 : 10
}
font {
family: qfont.semiBold.name
pixelSize: isNxt ? 25 : 20
}
color: colors.clockTileColor
text: app.switch3Name
visible: app.switch3idx > 0 ? true : false
}
// iconButton4
IconButton {
id: switch4Button
anchors {
top: switch3Button.bottom
topMargin: isNxt ? 19 : 15
left: parent.left
leftMargin: isNxt ? 31 : 25
}
width: isNxt ? 75 : 60
height: isNxt ? 75 : 60
visible: app.switch4idx > 0 ? true : false
iconSource: app.switch4StatusIcon
onClicked: {
simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchlight&idx="+app.switch4idx+"&switchcmd=Toggle");
switchLight4();
}
}
Text {
id: switch4Title
anchors {
left: switch4Button.right
verticalCenter: switch4Button.verticalCenter
leftMargin: isNxt ? 12 : 10
}
font {
family: qfont.semiBold.name
pixelSize: isNxt ? 25 : 20
}
color: colors.clockTileColor
text: app.switch4Name
visible: app.switch14idx > 0 ? true : false
}
// iconButton5
IconButton {
id: switch5Button
anchors {
top: switch4Button.bottom
topMargin: isNxt ? 19 : 15
left: parent.left
leftMargin: isNxt ? 31 : 25
}
width: isNxt ? 75 : 60
height: isNxt ? 75 : 60
visible: app.switch5idx > 0 ? true : false
iconSource: app.switch5StatusIcon
onClicked: {
simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchlight&idx="+app.switch5idx+"&switchcmd=Toggle");
switchLight5();
}
}
Text {
id: switch5Title
anchors {
left: switch5Button.right
verticalCenter: switch5Button.verticalCenter
leftMargin: isNxt ? 12 : 10
}
font {
family: qfont.semiBold.name
pixelSize: isNxt ? 25 : 20
}
color: colors.clockTileColor
text: app.switch5Name
visible: app.switch5idx > 0 ? true : false
}
// ----- RIGHT COLUMN -----
// Button 1
IconButton
{
id: scene1Button
anchors {
top: parent.top
topMargin: isNxt ? 19 : 15
left: parent.left
leftMargin: isNxt ? 500 : 400
}
width: isNxt ? 75 : 60
height: isNxt ? 75 : 60
visible: app.scene1idx > 0 ? true : false
iconSource: app.scene1StatusIcon
onClicked: {
if (app.scene1StatusName == "On")
{ simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchscene&idx="+app.scene1idx+"&switchcmd=Off"); }
else if (app.scene1StatusName == "Off")
{ simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchscene&idx="+app.scene1idx+"&switchcmd=On");}
else
{ simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchscene&idx="+app.scene1idx+"&switchcmd=Off"); }
}
}
Text {
id: scene1Title
anchors {
left: scene1Button.right
verticalCenter: scene1Button.verticalCenter
leftMargin: isNxt ? 12 : 10
}
font {
family: qfont.semiBold.name
pixelSize: isNxt ? 25 : 20
}
color: colors.clockTileColor
text: app.scene1Name
visible: app.scene1idx > 0 ? true : false
}
// Button 2
IconButton {
id: scene2Button
anchors {
top: scene1Button.bottom
topMargin: isNxt ? 19 : 15
left: parent.left
leftMargin: isNxt ? 500 : 400
}
width: isNxt ? 75 : 60
height: isNxt ? 75 : 60
visible: app.scene2idx > 0 ? true : false
iconSource: app.scene2StatusIcon
onClicked: {
if (app.scene2StatusName == "On")
{ simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchscene&idx="+app.scene2idx+"&switchcmd=Off"); }
else if (app.scene2StatusName == "Off")
{ simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchscene&idx="+app.scene2idx+"&switchcmd=On");}
else
{ simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchscene&idx="+app.scene2idx+"&switchcmd=Off"); }
}
}
Text {
id: scene2Title
anchors {
left: scene2Button.right
verticalCenter: scene2Button.verticalCenter
leftMargin: isNxt ? 12 : 10
}
font {
family: qfont.semiBold.name
pixelSize: isNxt ? 25 : 20
}
color: colors.clockTileColor
text: app.scene2Name
visible: app.scene2idx > 0 ? true : false
}
// Button 3
IconButton {
id: scene3Button
anchors {
top: scene2Button.bottom
topMargin: isNxt ? 19 : 15
left: parent.left
leftMargin: isNxt ? 500 : 400
}
width: isNxt ? 75 : 60
height: isNxt ? 75 : 60
visible: app.scene3idx > 0 ? true : false
iconSource: app.scene3StatusIcon
onClicked: {
if (app.scene3StatusName == "On")
{ simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchscene&idx="+app.scene3idx+"&switchcmd=Off"); }
else if (app.scene3StatusName == "Off")
{ simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchscene&idx="+app.scene3idx+"&switchcmd=On");}
else
{ simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchscene&idx="+app.scene3idx+"&switchcmd=Off"); }
}
}
Text {
id: scene3Title
anchors {
left: scene3Button.right
verticalCenter: scene3Button.verticalCenter
leftMargin: isNxt ? 12 : 10
}
font {
family: qfont.semiBold.name
pixelSize: isNxt ? 25 : 20
}
color: colors.clockTileColor
text: app.scene3Name
visible: app.scene3idx > 0 ? true : false
}
// Button 4
IconButton {
id: scene4Button
anchors {
top: scene3Button.bottom
topMargin: isNxt ? 19 : 15
left: parent.left
leftMargin: isNxt ? 500 : 400
}
width: isNxt ? 75 : 60
height: isNxt ? 75 : 60
visible: app.scene4idx > 0 ? true : false
iconSource: app.scene4StatusIcon
onClicked: {
if (app.scene4StatusName == "On")
{ simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchscene&idx="+app.scene4idx+"&switchcmd=Off"); }
else if (app.scene4StatusName == "Off")
{ simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchscene&idx="+app.scene4idx+"&switchcmd=On");}
else
{ simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchscene&idx="+app.scene4idx+"&switchcmd=Off"); }
}
}
Text {
id: scene4Title
anchors {
left: scene4Button.right
verticalCenter: scene4Button.verticalCenter
leftMargin: isNxt ? 12 : 10
}
font {
family: qfont.semiBold.name
pixelSize: isNxt ? 25 : 20
}
color: colors.clockTileColor
text: app.scene4Name
visible: app.scene4idx > 0 ? true : false
}
// Button 5
IconButton {
id: scene5Button
anchors {
top: scene4Button.bottom
topMargin: isNxt ? 19 : 15
left: parent.left
leftMargin: isNxt ? 500 : 400
}
width: isNxt ? 75 : 60
height: isNxt ? 75 : 60
visible: app.scene5idx > 0 ? true : false
iconSource: app.scene5StatusIcon
onClicked: {
if (app.scene5StatusName == "On")
{ simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchscene&idx="+app.scene5idx+"&switchcmd=Off"); }
else if (app.scene5StatusName == "Off")
{ simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchscene&idx="+app.scene5idx+"&switchcmd=On");}
else
{ simpleSynchronous("http://"+app.connectionPath+"/json.htm?type=command¶m=switchscene&idx="+app.scene5idx+"&switchcmd=Off"); }
}
}
Text {
id: scene5Title
anchors {
left: scene5Button.right
verticalCenter: scene5Button.verticalCenter
leftMargin: isNxt ? 12 : 10
}
font {
family: qfont.semiBold.name
pixelSize: isNxt ? 25 : 20
}
color: colors.clockTileColor
text: app.scene5Name
visible: app.scene5idx > 0 ? true : false
}
// closing tag
}