Skip to content
This repository was archived by the owner on Jan 28, 2022. It is now read-only.

Commit 54846ba

Browse files
authored
feat: updated remote UI with transport and digit buttons
1 parent 7502ab2 commit 54846ba

File tree

8 files changed

+344
-105
lines changed

8 files changed

+344
-105
lines changed

components/remote/ui/ir/Button.qml

+4-11
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,13 @@
2121
*****************************************************************************/
2222
import QtQuick 2.11
2323
import Style 1.0
24-
import Entity.Remote 1.0
2524
import Haptic 1.0
2625

2726
Rectangle {
2827
id: bg
29-
width: 110
30-
height: 60
28+
width: 118; height: 70
3129
radius: height/2
32-
border.color: Style.color.light
33-
border.width: 2
30+
border { color: Style.color.light; width: 2 }
3431
color: Style.color.backgroundTransparent
3532

3633
property alias title: title.text
@@ -42,13 +39,9 @@ Rectangle {
4239
color: Style.color.text
4340
width: parent.width-20
4441
elide: Text.ElideRight
45-
verticalAlignment: Text.AlignVCenter
46-
horizontalAlignment: Text.AlignHCenter
42+
verticalAlignment: Text.AlignVCenter; horizontalAlignment: Text.AlignHCenter
4743
anchors.centerIn: parent
48-
font.family: "Open Sans Regular"
49-
font.weight: Font.Normal
50-
font.pixelSize: 24
51-
lineHeight: 1
44+
font { family: "Open Sans Bold"; weight: Font.Bold; pixelSize: 24 }
5245
}
5346

5447
MouseArea {

components/remote/ui/ir/Card.qml

+45-3
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,43 @@ import Entity.Remote 1.0
3131
import "qrc:/basic_ui" as BasicUI
3232

3333
Rectangle {
34-
id: cardRemote
34+
id: card
3535
width: parent.width; height: parent.height
3636
color: Style.color.dark
3737
radius: Style.cornerRadius
3838

39+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
40+
// STATES
41+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
42+
state: "closed"
43+
44+
states: [
45+
State {
46+
name: "open"
47+
},
48+
State {
49+
name: "closed"
50+
PropertyChanges {target: topItem; opacity: 0; }
51+
PropertyChanges {target: pagesSwipeView; opacity: 0; }
52+
PropertyChanges {target: tooltips; opacity: 0; }
53+
PropertyChanges {target: indicator; opacity: 0; }
54+
}
55+
]
56+
57+
transitions: [
58+
Transition {
59+
to: "closed"
60+
PropertyAnimation { target: topItem; properties: "opacity"; easing.type: Easing.OutExpo; duration: 200 }
61+
PropertyAnimation { target: pagesSwipeView; properties: "opacity"; easing.type: Easing.OutExpo; duration: 200 }
62+
PropertyAnimation { target: tooltips; properties: "opacity"; easing.type: Easing.OutExpo; duration: 200 }
63+
PropertyAnimation { target: indicator; properties: "opacity"; easing.type: Easing.OutExpo; duration: 200 }
64+
}
65+
]
66+
67+
Component.onCompleted: {
68+
card.state = "open";
69+
}
70+
3971
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4072
// CONNECT TO BUTTONS
4173
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -147,15 +179,20 @@ Rectangle {
147179
anchors { top: topItem.bottom; topMargin: 0 }
148180
currentIndex: 0
149181

150-
//buttons
182+
// buttons
151183
Loader {
152184
asynchronous: true
153185
sourceComponent: buttonView
154186
}
155187

188+
// transport buttons
189+
Loader {
190+
asynchronous: true
191+
sourceComponent: buttonTransportView
192+
}
193+
156194
// channels
157195
Loader {
158-
// active: SwipeView.isCurrentItem
159196
asynchronous: true
160197
sourceComponent: channelView
161198
}
@@ -166,6 +203,11 @@ Rectangle {
166203
CardButtons {}
167204
}
168205

206+
Component {
207+
id: buttonTransportView
208+
CardButtonsTransport {}
209+
}
210+
169211
Component {
170212
id: channelView
171213
CardChannels {}

components/remote/ui/ir/CardButtons.qml

+83-41
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/******************************************************************************
22
*
3-
* Copyright (C) 2018-2019 Marton Borzak <hello@martonborzak.com>
3+
* Copyright (C) 2018-2020 Marton Borzak <hello@martonborzak.com>
44
*
55
* This file is part of the YIO-Remote software project.
66
*
@@ -22,30 +22,26 @@
2222
import QtQuick 2.11
2323
import Style 1.0
2424

25+
import Haptic 1.0
2526
import Entity.Remote 1.0
2627

2728
Item {
2829
width: parent.width - 60
2930
anchors.horizontalCenter: parent.horizontalCenter
3031

3132
Rectangle {
32-
id: bg
33+
id: powerButton
3334
visible: obj.isSupported(Remote.F_POWER_TOGGLE) || (obj.isSupported(Remote.F_POWER_ON) && obj.isSupported(Remote.F_POWER_OFF))
34-
width: 110
35-
height: 60
35+
width: 118; height: 60
3636
radius: height/2
3737
color: Style.color.red
38-
anchors.top: parent.top
39-
anchors.left: parent.left
38+
anchors { top: parent.top; left: parent.left }
4039

4140
Text {
4241
color: Style.color.line
4342
text: Style.icon.power_on
44-
renderType: Text.NativeRendering
45-
width: 70
46-
height: 70
47-
verticalAlignment: Text.AlignVCenter
48-
horizontalAlignment: Text.AlignHCenter
43+
width: 70; height: 70
44+
verticalAlignment: Text.AlignVCenter; horizontalAlignment: Text.AlignHCenter
4945
font {family: "icons"; pixelSize: 60 }
5046
anchors.centerIn: parent
5147
}
@@ -54,7 +50,7 @@ Item {
5450
id: mouseArea
5551
anchors.fill: parent
5652
onClicked: {
57-
haptic.playEffect(Haptic.Click);
53+
Haptic.playEffect(Haptic.Click);
5854
if (obj.isSupported(Remote.F_POWER_TOGGLE)) {
5955
obj.powerToggle();
6056
} else if (obj.isSupported(Remote.F_POWER_ON) && obj.isSupported(Remote.F_POWER_OFF)) {
@@ -69,44 +65,90 @@ Item {
6965

7066
Button {
7167
visible: obj.isSupported(Remote.F_SOURCE)
72-
anchors.top: parent.top
73-
anchors.right: parent.right
68+
anchors { top: parent.top; right: parent.right }
7469
title: qsTr("Source") + translateHandler.emptyString
75-
mouseArea.onClicked: {
76-
obj.source();
77-
}
70+
mouseArea.onClicked: { obj.source(); }
7871
}
7972

80-
Button {
81-
visible: obj.isSupported(Remote.F_INFO)
82-
anchors.bottom: parent.bottom
83-
anchors.left: parent.left
84-
title: qsTr("Info") + translateHandler.emptyString
85-
mouseArea.onClicked: {
86-
obj.info();
73+
Flow {
74+
width: parent.width
75+
visible: obj.isSupported(Remote.F_DIGIT_0) && obj.isSupported(Remote.F_DIGIT_1) && obj.isSupported(Remote.F_DIGIT_2) && obj.isSupported(Remote.F_DIGIT_3) && obj.isSupported(Remote.F_DIGIT_4) && obj.isSupported(Remote.F_DIGIT_5)
76+
&& obj.isSupported(Remote.F_DIGIT_6) && obj.isSupported(Remote.F_DIGIT_7) && obj.isSupported(Remote.F_DIGIT_8) && obj.isSupported(Remote.F_DIGIT_9)
77+
anchors { top: powerButton.bottom; topMargin: 30; horizontalCenter: parent.horizontalCenter }
78+
spacing: 32
79+
80+
Button {
81+
visible: obj.isSupported(Remote.F_DIGIT_1)
82+
title: "1"
83+
mouseArea.onClicked: { obj.channel(1); }
8784
}
88-
}
8985

90-
Button {
91-
visible: obj.isSupported(Remote.F_MENU)
92-
anchors.bottom: parent.bottom
93-
anchors.horizontalCenter: parent.horizontalCenter
94-
title: qsTr("Menu") + translateHandler.emptyString
95-
mouseArea.onClicked: {
96-
obj.menu();
86+
Button {
87+
visible: obj.isSupported(Remote.F_DIGIT_2)
88+
title: "2"
89+
mouseArea.onClicked: { obj.channel(2); }
9790
}
98-
}
9991

100-
Button {
101-
visible: obj.isSupported(Remote.F_GUIDE)
102-
anchors.bottom: parent.bottom
103-
anchors.right: parent.right
104-
title: qsTr("Guide") + translateHandler.emptyString
105-
mouseArea.onClicked: {
106-
obj.guide();
92+
Button {
93+
visible: obj.isSupported(Remote.F_DIGIT_3)
94+
title: "3"
95+
mouseArea.onClicked: { obj.channel(3); }
96+
}
97+
98+
Button {
99+
visible: obj.isSupported(Remote.F_DIGIT_4)
100+
title: "4"
101+
mouseArea.onClicked: { obj.channel(4); }
102+
}
103+
104+
Button {
105+
visible: obj.isSupported(Remote.F_DIGIT_5)
106+
title: "5"
107+
mouseArea.onClicked: { obj.channel(5); }
108+
}
109+
110+
Button {
111+
visible: obj.isSupported(Remote.F_DIGIT_6)
112+
title: "6"
113+
mouseArea.onClicked: { obj.channel(6); }
114+
}
115+
116+
Button {
117+
visible: obj.isSupported(Remote.F_DIGIT_7)
118+
title: "7"
119+
mouseArea.onClicked: { obj.channel(7); }
120+
}
121+
122+
Button {
123+
visible: obj.isSupported(Remote.F_DIGIT_8)
124+
title: "8"
125+
mouseArea.onClicked: { obj.channel(8); }
126+
}
127+
128+
Button {
129+
visible: obj.isSupported(Remote.F_DIGIT_9)
130+
title: "9"
131+
mouseArea.onClicked: { obj.channel(9); }
107132
}
108-
}
109133

134+
Button {
135+
visible: obj.isSupported(Remote.F_DIGIT_SEPARATOR)
136+
title: "-"
137+
mouseArea.onClicked: { }
138+
}
139+
140+
Button {
141+
visible: obj.isSupported(Remote.F_DIGIT_0)
142+
title: "0"
143+
mouseArea.onClicked: { obj.channel(0); }
144+
}
145+
146+
Button {
147+
visible: obj.isSupported(Remote.F_DIGIT_ENTER)
148+
title: "Pre-CH"
149+
mouseArea.onClicked: { }
150+
}
151+
}
110152
}
111153

112154

0 commit comments

Comments
 (0)