Skip to content

Commit 10c4070

Browse files
committed
feat(QML): enhance the setting components
1 parent 7898cc4 commit 10c4070

4 files changed

Lines changed: 17 additions & 9 deletions

File tree

res/qml/Settings.qml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,14 @@ Popup {
248248
Layout.leftMargin: 20
249249

250250
Component.onCompleted: {
251-
let index = 0;
252251
let activateBuilder = index => function () {
253252
categoryList.currentIndex = index;
254253
};
255254
let visibleBuilder = index => function () {
256255
return categoryList.currentIndex == index;
257256
};
258-
for (let child of Object.values(data)) {
257+
for (let index = 0; index < data.length; index++) {
258+
let child = data[index];
259259
if (!child.label)
260260
continue;
261261
sectionProperties.append({
@@ -264,7 +264,6 @@ Popup {
264264
child.visible = Qt.binding(visibleBuilder(index));
265265
child.activated.connect(activateBuilder(index));
266266
child.anchors.fill = this;
267-
index++;
268267
}
269268
// This is needed to ensure the right category is displayed.
270269
// It would seems there is a bug, where the component's layout appears out of date.

res/qml/Settings/AudioRouter.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ Rectangle {
476476
tooltips: !root.hiddenConnections ? [] : [null, `${root.hiddenConnections} connection${root.hiddenConnections > 1 ? 's' : ''} hidden\nUse the advanced mode to view them`, null]
477477

478478
onOptionsChanged: {
479-
if (modeChoice.selected.startsWith("advanced")) {
479+
if (modeChoice.selected?.startsWith("advanced")) {
480480
modeChoice.selected = options[1];
481481
}
482482
}

res/qml/Settings/RatioChoice.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Item {
1818
property alias metric: fontMetrics
1919
property bool normalizedWidth: false
2020
required property list<string> options
21-
property string selected: options.length ? options[0] : null
21+
property var selected: options.length ? options[0] : null
2222
property real spacing: 9
2323
property list<var> tooltips: []
2424

res/qml/main.qml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ ApplicationWindow {
1313
property alias editDeck: editDeckButton.checked
1414
property var focusedDeck: null
1515
property alias maximizeLibrary: maximizeLibraryButton.checked
16+
readonly property int numDecks: 4
17+
readonly property int numSamplers: 16
1618
readonly property bool show4decks: show4DecksButton.checked && show4DecksButton.visible
1719
property alias showEffects: showEffectsButton.checked
1820
property alias showSamplers: showSamplersButton.checked
@@ -25,13 +27,19 @@ ApplicationWindow {
2527
width: 1792
2628

2729
Mixxx.ControlProxy {
28-
id: numDecksControl
29-
3030
group: "[App]"
3131
key: "num_decks"
3232

33-
Component.onCompleted: {
34-
value = 4;
33+
onInitializedChanged: {
34+
value = root.numDecks;
35+
}
36+
}
37+
Mixxx.ControlProxy {
38+
group: "[App]"
39+
key: "num_samplers"
40+
41+
onInitializedChanged: {
42+
value = root.numSamplers;
3543
}
3644
}
3745
Column {
@@ -349,6 +357,7 @@ ApplicationWindow {
349357
onToggleFocus: {
350358
root.focusedDeck = (root.focusedDeck === deck1) ? null : deck1;
351359
}
360+
352361
anchors {
353362
left: parent.left
354363
right: mixer.left

0 commit comments

Comments
 (0)