Skip to content

Commit cfff9db

Browse files
committed
feat(QML): add controller settings
1 parent 50c2790 commit cfff9db

14 files changed

Lines changed: 1679 additions & 147 deletions

res/controllers/Dummy Device Screen.hid.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@
6262
<value color="#FFFFFF" label="White">white</value>
6363
</option>
6464
</row>
65+
<option
66+
variable="intValue"
67+
type="integer"
68+
min="20"
69+
max="500"
70+
step="2"
71+
default="50"
72+
label="Int value"/>
6573
</group>
6674
</settings>
6775
<controller id="DummyDevice">

res/controllers/DummyDeviceDefaultScreen.qml

Lines changed: 110 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Mixxx 1.0 as Mixxx
1212
import Mixxx.Controls 1.0 as MixxxControls
1313

1414
import "." as Skin
15+
import "Theme"
1516

1617
Mixxx.ControllerScreen {
1718
id: root
@@ -119,17 +120,17 @@ Mixxx.ControllerScreen {
119120

120121
antialiasing: true
121122

122-
ColumnLayout {
123+
GridLayout {
123124
id: column
124125
anchors.fill: parent
125-
anchors.leftMargin: 0
126-
anchors.rightMargin: 0
127-
anchors.topMargin: 0
128-
anchors.bottomMargin: 0
129-
spacing: 6
126+
rowSpacing: 6
127+
columns: 2
128+
columnSpacing: 10
130129

131130
RowLayout {
132131
Layout.fillWidth: true
132+
Layout.preferredHeight: 80
133+
Layout.columnSpan: 2
133134
spacing: 0
134135

135136
Repeater {
@@ -149,157 +150,151 @@ Mixxx.ControllerScreen {
149150

150151
color: modelData
151152
Layout.fillWidth: true
152-
height: 80
153+
Layout.preferredHeight: 80
153154
}
154155
}
155156
}
156157

157158
RowLayout {
158-
anchors.leftMargin: 6
159-
anchors.rightMargin: 6
160-
anchors.topMargin: 6
161-
anchors.bottomMargin: 6
162-
163-
Layout.fillWidth: true
164-
Layout.fillHeight: true
165159
spacing: 6
166-
167-
Rectangle {
168-
color: 'transparent'
160+
Text {
169161
Layout.fillWidth: true
170-
Layout.fillHeight: true
171-
Text {
172-
text: qsTr("Group")
173-
font.pixelSize: 18
174-
font.family: "Noto Sans"
175-
font.letterSpacing: -1
176-
color: fontColor
177-
}
162+
text: qsTr("Group")
163+
font.pixelSize: 18
164+
font.family: "Noto Sans"
165+
font.letterSpacing: -1
166+
color: fontColor
178167
}
179-
180-
Rectangle {
181-
color: 'transparent'
168+
Text {
182169
Layout.fillWidth: true
183-
Layout.fillHeight: true
184-
Text {
185-
text: `${root.group}`
186-
font.pixelSize: 18
187-
font.family: "Noto Sans"
188-
font.letterSpacing: -1
189-
color: fontColor
190-
}
170+
text: root.group
171+
font.pixelSize: 18
172+
font.family: "Noto Sans"
173+
font.letterSpacing: -1
174+
color: fontColor
191175
}
192176
}
193177

194178
RowLayout {
195-
anchors.leftMargin: 6
196-
anchors.rightMargin: 6
197-
anchors.topMargin: 6
198-
anchors.bottomMargin: 6
199-
200-
Layout.fillWidth: true
201-
Layout.fillHeight: true
202179
spacing: 6
203180

204-
Rectangle {
205-
color: 'transparent'
181+
Text {
206182
Layout.fillWidth: true
207-
Layout.fillHeight: true
208-
Text {
209-
text: qsTr("Widget")
210-
font.pixelSize: 18
211-
font.family: "Noto Sans"
212-
font.letterSpacing: -1
213-
color: fontColor
214-
}
183+
text: qsTr("Widget")
184+
font.pixelSize: 18
185+
font.family: "Noto Sans"
186+
font.letterSpacing: -1
187+
color: fontColor
215188
}
216189

217-
Rectangle {
218-
color: 'transparent'
219-
Layout.fillWidth: true
220-
Layout.fillHeight: true
190+
Skin.HotcueButton {
191+
hotcueNumber: 1
192+
group: root.group
193+
}
194+
Skin.ControlKnob {
195+
width: 42
196+
height: width
197+
arcStart: Knob.ArcStart.Minimum
198+
group: root.group
199+
key: "pregain"
200+
color: Theme.gainKnobColor
201+
}
202+
}
203+
204+
ColumnLayout {
205+
Layout.fillWidth: true
206+
Layout.fillHeight: true
207+
Repeater {
208+
model: [{
209+
controllerKey: "beatloop_size",
210+
title: "Beatloop Size"
211+
}, {
212+
controllerKey: "track_samples",
213+
title: "Track sample"
214+
}, {
215+
controllerKey: "track_samplerate",
216+
title: "Track sample rate"
217+
}, {
218+
controllerKey: "playposition",
219+
title: "Play position"
220+
}, {
221+
controllerKey: "rate_ratio",
222+
title: "Rate ratio"
223+
}, {
224+
controllerKey: "waveform_zoom",
225+
title: "Waveform zoom"
226+
}
227+
]
228+
229+
RowLayout {
230+
id: row
231+
spacing: 4
232+
required property var modelData
221233

222-
Skin.HotcueButton {
223-
anchors.fill: parent
234+
Mixxx.ControlProxy {
235+
id: mixxxValue
236+
group: root.group
237+
key: modelData.controllerKey
238+
}
239+
240+
Text {
241+
Layout.fillWidth: true
242+
text: qsTr(modelData.title)
243+
font.pixelSize: 18
244+
font.family: "Noto Sans"
245+
font.letterSpacing: -1
246+
color: fontColor
247+
}
224248

225-
hotcueNumber: 1
226-
group: root.group
249+
Text {
250+
text: mixxxValue.value
251+
font.pixelSize: 18
252+
font.family: "Noto Sans"
253+
font.letterSpacing: -1
254+
color: fontColor
255+
}
227256
}
228257
}
229258
}
259+
ColumnLayout {
260+
Layout.fillWidth: true
261+
Layout.fillHeight: true
262+
Repeater {
263+
model: [
264+
"theme",
265+
"idleBackground",
266+
"accentColor",
267+
"deckA",
268+
"intValue",
269+
]
230270

231-
Repeater {
232-
model: [{
233-
controllerKey: "beatloop_size",
234-
title: "Beatloop Size"
235-
}, {
236-
controllerKey: "track_samples",
237-
title: "Track sample"
238-
}, {
239-
controllerKey: "track_samplerate",
240-
title: "Track sample rate"
241-
}, {
242-
controllerKey: "playposition",
243-
title: "Play position"
244-
}, {
245-
controllerKey: "rate_ratio",
246-
title: "Rate ratio"
247-
}, {
248-
controllerKey: "waveform_zoom",
249-
title: "Waveform zoom"
250-
}
251-
]
252-
253-
RowLayout {
254-
id: row
255-
anchors.leftMargin: 6
256-
anchors.rightMargin: 6
257-
anchors.topMargin: 6
258-
anchors.bottomMargin: 6
259-
Layout.fillWidth: true
260-
Layout.fillHeight: true
261-
spacing: 4
262-
required property var modelData
263-
264-
Mixxx.ControlProxy {
265-
id: mixxxValue
266-
group: root.group
267-
key: modelData.controllerKey
268-
}
271+
RowLayout {
272+
spacing: 4
273+
required property var modelData
269274

270-
Rectangle {
271-
color: 'transparent'
272-
Layout.fillWidth: true
273-
Layout.fillHeight: true
274275
Text {
275-
text: qsTr(modelData.title)
276+
Layout.fillWidth: true
277+
text: modelData
276278
font.pixelSize: 18
277279
font.family: "Noto Sans"
278280
font.letterSpacing: -1
279281
color: fontColor
280282
}
281-
}
282283

283-
Rectangle {
284-
color: 'transparent'
285-
Layout.fillWidth: true
286-
Layout.fillHeight: true
287284
Text {
288-
text: `${mixxxValue.value}`
285+
Layout.maximumWidth: 160
286+
text: engine.getSetting(modelData)
289287
font.pixelSize: 18
290288
font.family: "Noto Sans"
291289
font.letterSpacing: -1
292290
color: fontColor
291+
elide: Text.ElideLeft
293292
}
294293
}
295294
}
296295
}
297296
RowLayout {
298-
anchors.leftMargin: 6
299-
anchors.rightMargin: 6
300-
anchors.topMargin: 6
301-
anchors.bottomMargin: 6
302-
297+
Layout.columnSpan: 2
303298
Layout.fillWidth: true
304299
Layout.fillHeight: true
305300

res/qml/ActionPopup.qml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,22 @@ Popup {
1616
margins: 0
1717
leftInset: 0
1818

19+
enum Facing {
20+
Left,
21+
Top,
22+
Right,
23+
Bottom
24+
}
25+
1926
default property alias children: content.children
27+
property variant facing: ActionPopup.Facing.Left
2028

2129
contentItem: Item {
2230
ColumnLayout {
2331
spacing: 2
2432
anchors.fill: parent
25-
anchors.leftMargin: 20
33+
anchors.leftMargin: root.facing == ActionPopup.Facing.Left ? 20 : 0
34+
anchors.rightMargin: root.facing == ActionPopup.Facing.Right ? 20 : 0
2635
id: content
2736
}
2837
}
@@ -32,7 +41,8 @@ Popup {
3241
id: content3
3342
anchors.fill: parent
3443
Shape {
35-
anchors.left: parent.left
44+
anchors.right: root.facing == ActionPopup.Facing.Right ? parent.right : undefined
45+
anchors.left: root.facing == ActionPopup.Facing.Left ? parent.left : undefined
3646
anchors.verticalCenter: parent.verticalCenter
3747
implicitHeight: 20
3848
ShapePath {
@@ -47,11 +57,20 @@ Popup {
4757
PathLine { x: 20; y: 20 }
4858
PathLine { x: 0; y: 10 }
4959
}
60+
transformOrigin: Item.Center
61+
rotation: {
62+
switch (root.facing) {
63+
case ActionPopup.Facing.Right:
64+
return 180
65+
default:
66+
return 0
67+
}
68+
}
5069
}
5170
Rectangle {
5271
anchors.fill: parent
53-
anchors.right: parent.right
54-
anchors.leftMargin: 20
72+
anchors.leftMargin: root.facing == ActionPopup.Facing.Left ? 20 : 0
73+
anchors.rightMargin: root.facing == ActionPopup.Facing.Right ? 20 : 0
5574
border.width: 0
5675
radius: 8
5776
color: Theme.backgroundColor

res/qml/Button.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Qt5Compat.GraphicalEffects
2-
import QtQuick 2.12
3-
import QtQuick.Controls 2.12
2+
import QtQuick 2
3+
import QtQuick.Controls 2
44
import "Theme"
55

66
AbstractButton {

0 commit comments

Comments
 (0)