This repository has been archived by the owner on Jan 28, 2022. It is now read-only.
/
Card.qml
313 lines (282 loc) Β· 9.82 KB
/
Card.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
/******************************************************************************
*
* Copyright (C) 2018-2019 Marton Borzak <hello@martonborzak.com>
*
* This file is part of the YIO-Remote software project.
*
* YIO-Remote software is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* YIO-Remote software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with YIO-Remote software. If not, see <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*****************************************************************************/
import QtQuick 2.11
import QtQuick.Controls 2.5
import QtGraphicalEffects 1.0
import Style 1.0
import Entity.Remote 1.0
import "qrc:/basic_ui" as BasicUI
Rectangle {
id: cardRemote
width: parent.width
height: parent.height
color: Style.colorDark
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CONNECT TO BUTTONS
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Connections {
target: buttonHandler
onButtonPress: {
switch (button) {
case "volume up":
if (obj.isSupported(Remote.F_VOLUME_UP)) {
obj.volumeUp();
}
break;
case "volume down":
if (obj.isSupported(Remote.F_VOLUME_DOWN)) {
obj.volumeDown();
}
break;
case "channel up":
if (obj.isSupported(Remote.F_CHANNEL_UP)) {
obj.channelUp();
}
break;
case "channel down":
if (obj.isSupported(Remote.F_CHANNEL_DOWN)) {
obj.channelDown();
}
break;
case "dpad up":
if (obj.isSupported(Remote.F_CURSOR_UP)) {
obj.cursorUp();
}
break;
case "dpad down":
if (obj.isSupported(Remote.F_CURSOR_DOWN)) {
obj.cursorDown();
}
break;
case "dpad left":
if (obj.isSupported(Remote.F_CURSOR_LEFT)) {
obj.cursorLeft();
}
break;
case "dpad right":
if (obj.isSupported(Remote.F_CURSOR_RIGHT)) {
obj.cursorRight();
}
break;
case "dpad middle":
if (obj.isSupported(Remote.F_CURSOR_OK)) {
obj.cursorOK();
}
break;
case "top left":
if (obj.isSupported(Remote.F_MUTE_TOGGLE)) {
obj.muteToggle();
}
break;
case "bottom left":
if (obj.isSupported(Remote.F_BACK)) {
obj.back();
}
break;
case "bottom right":
if (obj.isSupported(Remote.F_MENU)) {
obj.menu();
}
break;
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// UI ELEMENTS
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Item {
id: topItem
width: parent.width
height: 125
anchors.top: parent.top
Text {
id: title
color: Style.colorText
text: obj.friendly_name
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
wrapMode: Text.WordWrap
width: parent.width-232
anchors.left: parent.left
anchors.leftMargin: 106
anchors.verticalCenter: parent.verticalCenter
font.family: "Open Sans"
font.weight: Font.Normal
font.pixelSize: 27
lineHeight: 1
}
Text {
color: Style.colorText
text: icon.text
width: 85
height: 85
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font {family: "icons"; pixelSize: 100 }
anchors.left: parent.left
anchors.leftMargin: 10
anchors.verticalCenter: parent.verticalCenter
}
}
SwipeView {
id: pagesSwipeView
width: parent.width
height: parent.height - topItem.height - tooltips.height - 50
anchors.top: topItem.bottom
anchors.topMargin: 0
currentIndex: 0
//buttons
Loader {
asynchronous: true
sourceComponent: buttonView
}
// channels
Loader {
// active: SwipeView.isCurrentItem
asynchronous: true
sourceComponent: channelView
}
}
Component {
id: buttonView
CardButtons {}
}
Component {
id: channelView
CardChannels {}
}
PageIndicator {
id: indicator
count: pagesSwipeView.count
currentIndex: pagesSwipeView.currentIndex
anchors.bottom: tooltips.top
anchors.horizontalCenter: parent.horizontalCenter
delegate: Rectangle {
width: 8
height: 8
radius: height/2
color: Style.colorText
opacity: index == pagesSwipeView.currentIndex ? 1 : 0.3
}
}
Item {
id: tooltips
width: parent.width
height: 80
anchors.bottom: parent.bottom
Item {
id: leftToolTip
width: childrenRect.width
height: 60
anchors.left: parent.left
anchors.leftMargin: 20
anchors.verticalCenter: parent.verticalCenter
Text {
color: Style.colorText
text: "\uE91B"
width: 60
height: 60
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font {family: "icons"; pixelSize: 60 }
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
}
Text {
color: Style.colorText
opacity: 0.5
text: qsTr("Mute") + translateHandler.emptyString
verticalAlignment: Text.AlignVCenter
anchors.left: parent.left
anchors.leftMargin: 50
anchors.verticalCenter: parent.verticalCenter
font.family: "Open Sans"
font.weight: Font.Normal
font.pixelSize: 24
lineHeight: 1
}
}
Item {
id: middleToolTip
width: childrenRect.width
height: 60
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
Text {
color: Style.colorText
text: "\uE91D"
width: 60
height: 60
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font {family: "icons"; pixelSize: 60 }
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
}
Text {
color: Style.colorText
opacity: 0.5
text: qsTr("Back") + translateHandler.emptyString
verticalAlignment: Text.AlignVCenter
anchors.left: parent.left
anchors.leftMargin: 50
anchors.verticalCenter: parent.verticalCenter
font.family: "Open Sans"
font.weight: Font.Normal
font.pixelSize: 24
lineHeight: 1
}
}
Item {
id: rightToolTip
width: childrenRect.width
height: 60
anchors.right: parent.right
anchors.rightMargin: 40
anchors.verticalCenter: parent.verticalCenter
Text {
color: Style.colorText
text: "\uE91C"
width: 60
height: 60
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font {family: "icons"; pixelSize: 60 }
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
}
Text {
color: Style.colorText
opacity: 0.5
text: qsTr("Menu") + translateHandler.emptyString
verticalAlignment: Text.AlignVCenter
anchors.left: parent.left
anchors.leftMargin: 50
anchors.verticalCenter: parent.verticalCenter
font.family: "Open Sans"
font.weight: Font.Normal
font.pixelSize: 24
lineHeight: 1
}
}
}
}