@@ -16,9 +16,15 @@ Item {
16
16
required property string name
17
17
required property string group
18
18
property list< var > gateways: []
19
+ property bool advanced: false
19
20
20
21
implicitHeight: 54 + 32 * gatewayRepeater .visibleChannels
21
22
width: 135
23
+ z: 10
24
+
25
+ onGatewaysChanged: {
26
+ gatewayRepeater .visibleChannels = root .gateways .length
27
+ }
22
28
23
29
property alias handleSource: handleSourceEdge
24
30
property alias handleSink: handleSinkEdge
31
37
anchors .fill : parent
32
38
anchors .margins : 8
33
39
Column {
40
+ id: gatewayColumn
34
41
anchors .fill : parent
35
42
padding: 0
36
43
spacing: 4
@@ -63,10 +70,12 @@ Item {
63
70
readonly property string label: root .gateways [index].name
64
71
readonly property string address: root .gateways [index].address || root .gateways [index].name
65
72
readonly property var channels: root .gateways [index].channels || [0 , 1 ]
73
+ readonly property var instances: root .gateways [index].instances || 1
66
74
readonly property string type: root .gateways [index].type
75
+ readonly property bool advanced: root .gateways [index].advanced || false
67
76
readonly property bool required: !! root .gateways [index].required
68
77
69
- model: node .channels .length / 2
78
+ model: node .channels .length / 2 * instances
70
79
71
80
property list< int> channelAssignation: {
72
81
return [... Array (node .channels .length / 2 )].map ((_ , i ) => i);
@@ -97,7 +106,7 @@ Item {
97
106
property alias edgeItem: edge
98
107
property bool counted: channel .index == 0
99
108
100
- visible: edgeItem .connection || index == node .connectionCount
109
+ visible: ( edgeItem .connection ? . ready || index == node .connectionCount ) && ( ! node . advanced || root . advanced )
101
110
onVisibleChanged: {
102
111
if (counted != channel .visible )
103
112
gatewayRepeater .visibleChannels += channel .visible ? 1 : - 1
@@ -119,7 +128,7 @@ Item {
119
128
Layout .alignment : Qt .AlignVCenter
120
129
Layout .preferredHeight : 28
121
130
verticalAlignment: Text .AlignVCenter
122
- text: label
131
+ text: node . instances == 1 ? label : ` ${ label } # ${ index + 1 } `
123
132
color: Theme .white
124
133
elide: Text .ElideRight
125
134
font .pixelSize : 10
@@ -131,16 +140,16 @@ Item {
131
140
Skin .ComboBox {
132
141
Layout .minimumWidth : implicitWidth
133
142
id: channelSelector
134
- property int previousIndex: node .channelAssignation [channel .index ]
135
- visible: node .count > 1
143
+ property int previousIndex: node .channelAssignation [channel .index ] ?? 0
144
+ visible: node .count > 1 && node . channels . length > 2
136
145
spacing: 2
137
146
clip: true
138
147
139
148
font .pixelSize : 12
140
149
model: {
141
150
return [... Array (node .channels .length / 2 )].map ((e , i ) => ` Ch ${ i * 2 + node .channels [0 ] + 1 } - ${ i * 2 + node .channels [0 ] + 2 } ` );
142
151
}
143
- currentIndex: node .channelAssignation [channel .index ]
152
+ currentIndex: node .channelAssignation [channel .index ] ?? 0
144
153
onActivated: (activatedIndex ) => {
145
154
let alreadyAssigned = node .channelAssignation .indexOf (activatedIndex)
146
155
node .channelAssignation [alreadyAssigned] = previousIndex
@@ -151,6 +160,7 @@ Item {
151
160
Rectangle {
152
161
id: edge
153
162
property var entity: root
163
+ property int instance: index / (node .channels .length / 2 )
154
164
property string type: node .type
155
165
property string group: root .group
156
166
property var address: node .address
@@ -160,6 +170,7 @@ Item {
160
170
161
171
property var connection: null
162
172
property bool counted: false
173
+ property bool connecting: false
163
174
164
175
onConnectionChanged: {
165
176
if (counted != !! edge .connection )
@@ -187,29 +198,77 @@ Item {
187
198
edge .updateConnectionPosition ()
188
199
}
189
200
}
190
- color: (edge .connection && edge .connection .state == " impossible" || ! edge .connection && node .required ) ? ' #7D3B3B' : edge .connection ? Theme .white : ' #626262'
201
+
202
+ Connections {
203
+ target: channel
204
+ function onHeightChanged () {
205
+ edge .updateConnectionPosition ()
206
+ }
207
+ function onYChanged () {
208
+ edge .updateConnectionPosition ()
209
+ }
210
+ }
211
+
212
+ color: Theme .midGray
191
213
width: 10
192
- height: 10
193
- radius: 5
214
+ height: width
215
+ radius: width/ 2
216
+ z: 100
217
+
218
+ states: [
219
+ State {
220
+ name: " idle"
221
+ },
222
+ State {
223
+ name: " warning"
224
+ when: (! edge .connection && node .required ) || (edge .connection && edge .connection .state == " warning" )
225
+
226
+ PropertyChanges {
227
+ target: edge
228
+ width: 15
229
+ color: Theme .warningColor
230
+ }
231
+ },
232
+ State {
233
+ name: " hidden"
234
+ when: edge .connection && ! edge .connection .visible
235
+
236
+ PropertyChanges {
237
+ target: channel
238
+ opacity: 0.5
239
+ }
240
+ },
241
+ State {
242
+ name: " setting"
243
+ when: edge .connection && ! edge .connection .existing || edge .connecting
244
+
245
+ PropertyChanges {
246
+ target: edge
247
+ width: 15
248
+ color: Theme .accentColor
249
+ }
250
+ }
251
+ ]
194
252
195
253
MouseArea {
196
- hoverEnabled: edge .connection != null
254
+ id: edgeMouseArea
255
+ hoverEnabled: edge .connection != null && edge .connection .visible
197
256
anchors .fill : parent
198
257
onPressed: {
199
- if (edge .connection && edge .connection .state == " impossible " ) {
258
+ if (edge .connection && edge .connection .flags & AudioConnection . Flags . AboutToDelete ) {
200
259
root .disconnect (edge .connection )
201
260
} else if (edge .connection == null ) {
202
261
root .connect (parent)
203
262
}
204
263
}
205
264
onEntered: {
206
265
if (edge .connection ) {
207
- edge .connection .state = " impossible "
266
+ edge .connection .flags |= AudioConnection . Flags . AboutToDelete
208
267
}
209
268
}
210
269
onExited: {
211
270
if (edge .connection ) {
212
- edge .connection .state = edge . connection . existing ? " setting " : " set "
271
+ edge .connection .flags &= ~ AudioConnection . Flags . AboutToDelete
213
272
}
214
273
}
215
274
}
0 commit comments