Skip to content

Commit 7f77c25

Browse files
committed
feat(QML): enhance the setting components
1 parent 0355c89 commit 7f77c25

4 files changed

Lines changed: 31 additions & 13 deletions

File tree

res/qml/Settings.qml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ Popup {
268268
}
269269

270270
Component.onCompleted: {
271-
print("onCompleted", data)
272271
let index = 0;
273272
let activateBuilder = (index) => function() {
274273
categoryList.currentIndex = index;
@@ -282,7 +281,6 @@ Popup {
282281
child.visible = Qt.binding(visibleBuilder(index));
283282
child.activated.connect(activateBuilder(index))
284283
child.anchors.fill = this
285-
print("child", child.label, index, categoryList.currentIndex, child.anchors.fill)
286284
index++;
287285
}
288286
// This is needed to ensure the right category is displayed.
@@ -295,10 +293,6 @@ Popup {
295293
}
296294
}
297295

298-
Component.onCompleted: {
299-
print("Settings", categoryList.currentIndex)
300-
}
301-
302296
ListModel {
303297
id: sectionProperties
304298
}

res/qml/Settings/AudioRouter.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ Rectangle {
439439
"legacy"
440440
]
441441
onOptionsChanged: {
442-
if (modeChoice.selected.startsWith("advanced")) {
442+
if (modeChoice.selected?.startsWith("advanced")) {
443443
modeChoice.selected = options[1]
444444
}
445445
}

res/qml/Settings/RatioChoice.qml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ Item {
1010
id: root
1111
required property list<string> options
1212
property list<var> tooltips: []
13-
property string selected: options.length ? options[0] : null
13+
property var selected: options.length ? options[0] : null
1414
property real spacing: 9
1515
property real maxWidth: 0
1616
property bool normalizedWidth: true
17+
property color inactiveColor: Theme.darkGray2
18+
property alias metric: fontMetrics
19+
property alias content: contentList
1720

1821
onTooltipsChanged: {
1922
popup.close()
@@ -27,6 +30,7 @@ Item {
2730

2831
implicitHeight: (contentList.visible ? contentList.height : contentSpin.height) + dropRatio.radius * 2
2932
implicitWidth: (contentList.visible ? contentList.width : contentSpin.width) + dropRatio.radius * 2
33+
3034
readonly property real cellSize: {
3135
Math.max.apply(null, options.map((option) => fontMetrics.advanceWidth(option))) + root.spacing*2
3236
}
@@ -43,16 +47,16 @@ Item {
4347
options.reduce((acc, option) => acc + fontMetrics.advanceWidth(option) + root.spacing*2, 0) + root.spacing
4448
}
4549
}
46-
color: '#2B2B2B'
50+
color: root.inactiveColor
4751
radius: height / 2
4852
RowLayout {
49-
anchors.fill: parent
53+
anchors.centerIn: parent
5054
Repeater {
5155
model: options
5256
Item {
5357
required property int index
5458
required property var modelData
55-
width: root.normalizedWidth ? root.cellSize : fontMetrics.advanceWidth(modelData) + root.spacing*2
59+
implicitWidth: root.normalizedWidth ? root.cellSize : fontMetrics.advanceWidth(modelData) + root.spacing*2
5660
height: contentList.height
5761
Rectangle {
5862
anchors.fill: parent
@@ -173,7 +177,7 @@ Item {
173177
implicitWidth: 24
174178
implicitHeight: 24
175179
radius: parent.height / 2
176-
color: '#2B2B2B'
180+
color: root.inactiveColor
177181
border.width: 0
178182

179183
Text {
@@ -200,7 +204,7 @@ Item {
200204
background: Rectangle {
201205
implicitWidth: contentSpin.textWidth + 2 * contentSpin.spacing + 48
202206
radius: parent.height / 2
203-
color: '#2B2B2B'
207+
color: root.inactiveColor
204208
}
205209

206210
textFromValue: function(value) {
@@ -216,6 +220,7 @@ Item {
216220
}
217221

218222
onValueChanged: {
223+
if (!contentSpin.visible) return;
219224
root.selected = contentSpin.textFromValue(value) ?? ""
220225
popup.tooltip = root.tooltips[contentSpin.value] ?? ""
221226
popup.x = contentSpin.width / 2 - popup.width / 2

res/qml/main.qml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import "Theme"
99
ApplicationWindow {
1010
id: root
1111

12+
readonly property int numDecks: 4
13+
readonly property int numSamplers: 16
14+
1215
property alias maximizeLibrary: maximizeLibraryButton.checked
1316
property alias show4decks: show4DecksButton.checked
1417
property alias showEffects: showEffectsButton.checked
@@ -19,6 +22,22 @@ ApplicationWindow {
1922
visible: true
2023
width: 1920
2124

25+
Mixxx.ControlProxy {
26+
group: "[App]"
27+
key: "num_decks"
28+
onInitializedChanged: {
29+
value = root.numDecks
30+
}
31+
}
32+
33+
Mixxx.ControlProxy {
34+
group: "[App]"
35+
key: "num_samplers"
36+
onInitializedChanged: {
37+
value = root.numSamplers
38+
}
39+
}
40+
2241
Column {
2342
id: content
2443
anchors.fill: parent

0 commit comments

Comments
 (0)