Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt QML cleanup #4629

Merged
merged 8 commits into from
Jan 17, 2022
6 changes: 4 additions & 2 deletions res/qml/ComboBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,22 @@ ComboBox {
}

delegate: ItemDelegate {
id: itemDlgt

width: parent.width
highlighted: root.highlightedIndex === index
text: root.textAt(index)

contentItem: Text {
text: parent.text
text: itemDlgt.text
color: Theme.deckTextColor
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}

background: Rectangle {
radius: 5
border.width: highlighted ? 1 : 0
border.width: itemDlgt.highlighted ? 1 : 0
border.color: Theme.deckLineColor
color: "transparent"
}
Expand Down
26 changes: 14 additions & 12 deletions res/qml/DeckInfoBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ Rectangle {
Mixxx.ControlProxy {
group: root.group
key: "play"
onValueChanged: spinnyIndicator.indicatorVisible = (value > 0)
onValueChanged: (value) => {
spinnyIndicator.indicatorVisible = (value > 0);
}
Swiftb0y marked this conversation as resolved.
Show resolved Hide resolved
}

MixxxControls.Spinny {
Expand Down Expand Up @@ -109,11 +111,11 @@ Rectangle {
id: infoBarVSeparator

anchors.left: coverArt.right
anchors.right: infoBar.right
anchors.verticalCenter: infoBar.verticalCenter
anchors.right: root.right
anchors.verticalCenter: root.verticalCenter
anchors.margins: 5
height: 2
color: infoBar.lineColor
color: root.lineColor
}

Skin.EmbeddedText {
Expand All @@ -132,13 +134,13 @@ Rectangle {
Rectangle {
id: infoBarHSeparator1

anchors.top: infoBar.top
anchors.bottom: infoBar.bottom
anchors.top: root.top
anchors.bottom: root.bottom
anchors.right: infoBarKey.left
anchors.topMargin: 5
anchors.bottomMargin: 5
width: 2
color: infoBar.lineColor
color: root.lineColor
}

Skin.EmbeddedText {
Expand All @@ -154,21 +156,21 @@ Rectangle {
Rectangle {
id: infoBarHSeparator2

anchors.top: infoBar.top
anchors.bottom: infoBar.bottom
anchors.top: root.top
anchors.bottom: root.bottom
anchors.right: infoBarRateRatio.left
anchors.topMargin: 5
anchors.bottomMargin: 5
width: 2
color: infoBar.lineColor
color: root.lineColor
}

Skin.EmbeddedText {
id: infoBarRate

anchors.top: infoBarHSeparator2.top
anchors.bottom: infoBarVSeparator.top
anchors.right: infoBar.right
anchors.right: root.right
anchors.rightMargin: 5
width: rateSlider.width

Expand All @@ -189,7 +191,7 @@ Rectangle {
anchors.top: infoBarVSeparator.bottom
anchors.bottom: infoBarHSeparator1.bottom
width: rateSlider.width
anchors.right: infoBar.right
anchors.right: root.right
anchors.rightMargin: 5
text: (ratio > 0) ? "+" + ratio.toFixed(2) : ratio.toFixed(2)

Expand Down
1 change: 0 additions & 1 deletion res/qml/DeckRow.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import QtQuick 2.12
import QtQuick.Controls 2.12

Item {
id: root
Expand Down
1 change: 0 additions & 1 deletion res/qml/EffectRow.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import "." as Skin
import QtQuick 2.12
import QtQuick.Controls 2.12

Item {
id: root
Expand Down
4 changes: 2 additions & 2 deletions res/qml/EffectSlot.qml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Item {
anchors.margins: 5
textRole: "display"
model: Mixxx.EffectsManager.visibleEffectsModel
onActivated: {
onActivated: (index) => {
const effectId = model.get(index).effectId;
if (root.slot.effectId != effectId)
root.slot.effectId = effectId;
Expand All @@ -62,7 +62,7 @@ Item {
// TODO: Consider using an additional QHash in the
// model and provide a more efficient lookup method
for (let i = 0; i < rowCount; i++) {
if (effectSelector.model.get(i).effectId === target.effectId) {
if (effectSelector.model.get(i).effectId === root.slot.effectId) {
effectSelector.currentIndex = i;
break;
}
Expand Down
4 changes: 2 additions & 2 deletions res/qml/EffectUnit.qml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Item {
height: 40
width: height
arcStart: Knob.ArcStart.Minimum
group: "[EffectRack1_EffectUnit" + unitNumber + "]"
group: "[EffectRack1_EffectUnit" + root.unitNumber + "]"
key: "super1"
color: Theme.effectUnitColor
visible: false
Expand All @@ -177,7 +177,7 @@ Item {
height: 40
width: height
arcStart: Knob.ArcStart.Minimum
group: "[EffectRack1_EffectUnit" + unitNumber + "]"
group: "[EffectRack1_EffectUnit" + root.unitNumber + "]"
key: "mix"
color: Theme.effectUnitColor
visible: false
Expand Down
8 changes: 4 additions & 4 deletions res/qml/Hotcue.qml
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,28 @@ Item {
id: hotcueColorControl

group: root.group
key: "hotcue_" + hotcueNumber + "_color"
key: "hotcue_" + root.hotcueNumber + "_color"
}

Mixxx.ControlProxy {
id: hotcueActivateControl

group: root.group
key: "hotcue_" + hotcueNumber + "_activate"
key: "hotcue_" + root.hotcueNumber + "_activate"
}

Mixxx.ControlProxy {
id: hotcueStatusControl

group: root.group
key: "hotcue_" + hotcueNumber + "_status"
key: "hotcue_" + root.hotcueNumber + "_status"
}

Mixxx.ControlProxy {
id: hotcueClearControl

group: root.group
key: "hotcue_" + hotcueNumber + "_clear"
key: "hotcue_" + root.hotcueNumber + "_clear"
}

}
2 changes: 1 addition & 1 deletion res/qml/HotcueButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Skin.Button {

anchors.fill: parent
acceptedButtons: Qt.RightButton
onClicked: {
onClicked: (mouse) => {
if (hotcue.isSet) {
popup.x = mouse.x;
popup.y = mouse.y;
Expand Down
6 changes: 4 additions & 2 deletions res/qml/HotcuePopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Popup {
MouseArea {
anchors.fill: parent
onClicked: {
hotcue.setColor(parent.color);
root.hotcue.setColor(parent.color);
root.close();
}
}
Expand All @@ -52,7 +52,9 @@ Popup {
anchors.topMargin: 5
text: "Clear"
activeColor: Theme.deckActiveColor
onDownChanged: hotcue.clear = down
onDownChanged: (down) => {
root.hotcue.clear = down;
}
}

enter: Transition {
Expand Down
1 change: 0 additions & 1 deletion res/qml/InfoBarButton.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import "." as Skin
import Mixxx 0.1 as Mixxx
import QtGraphicalEffects 1.12
import QtQuick 2.12
Expand Down
15 changes: 10 additions & 5 deletions res/qml/Library.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import "." as Skin
import Mixxx 0.1 as Mixxx
import QtQml.Models 2.12
import QtQuick 2.12
Expand All @@ -12,9 +11,15 @@ Item {
LibraryControl {
id: libraryControl

onMoveVertical: listView.moveSelectionVertical(offset)
onLoadSelectedTrack: listView.loadSelectedTrack(group, play)
onLoadSelectedTrackIntoNextAvailableDeck: listView.loadSelectedTrackIntoNextAvailableDeck(play)
onMoveVertical: (offset) => {
listView.moveSelectionVertical(offset);
}
onLoadSelectedTrack: (group, play) => {
listView.loadSelectedTrack(group, play);
}
onLoadSelectedTrackIntoNextAvailableDeck: (play) => {
listView.loadSelectedTrackIntoNextAvailableDeck(play);
}
onFocusWidgetChanged: {
switch (focusWidget) {
case FocusedWidgetControl.WidgetKind.LibraryView:
Expand Down Expand Up @@ -65,7 +70,7 @@ Item {
highlightMoveDuration: 250
highlightResizeDuration: 50
model: Mixxx.Library.model
Keys.onPressed: {
Keys.onPressed: (event) => {
switch (event.key) {
case Qt.Key_Enter:
case Qt.Key_Return:
Expand Down
28 changes: 17 additions & 11 deletions res/qml/LibraryControl.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Item {
Mixxx.ControlProxy {
group: "[Library]"
key: "GoToItem"
onValueChanged: {
onValueChanged: (value) => {
if (value != 0 && root.focusWidget == FocusedWidgetControl.WidgetKind.LibraryView)
root.loadSelectedTrackIntoNextAvailableDeck(false);

Expand All @@ -29,7 +29,7 @@ Item {
Mixxx.ControlProxy {
group: "[Playlist]"
key: "LoadSelectedIntoFirstStopped"
onValueChanged: {
onValueChanged: (value) => {
if (value != 0 && root.focusWidget == FocusedWidgetControl.WidgetKind.LibraryView)
root.loadSelectedTrackIntoNextAvailableDeck(false);

Expand All @@ -39,7 +39,7 @@ Item {
Mixxx.ControlProxy {
group: "[Playlist]"
key: "SelectTrackKnob"
onValueChanged: {
onValueChanged: (value) => {
if (value != 0) {
root.focusWidget = FocusedWidgetControl.WidgetKind.LibraryView;
root.moveVertical(value);
Expand All @@ -50,7 +50,7 @@ Item {
Mixxx.ControlProxy {
group: "[Playlist]"
key: "SelectPrevTrack"
onValueChanged: {
onValueChanged: (value) => {
if (value != 0) {
root.focusWidget = FocusedWidgetControl.WidgetKind.LibraryView;
root.moveVertical(-1);
Expand All @@ -61,7 +61,7 @@ Item {
Mixxx.ControlProxy {
group: "[Playlist]"
key: "SelectNextTrack"
onValueChanged: {
onValueChanged: (value) => {
if (value != 0) {
root.focusWidget = FocusedWidgetControl.WidgetKind.LibraryView;
root.moveVertical(1);
Expand All @@ -72,7 +72,7 @@ Item {
Mixxx.ControlProxy {
group: "[Library]"
key: "MoveVertical"
onValueChanged: {
onValueChanged: (value) => {
if (value != 0 && root.focusWidget == FocusedWidgetControl.WidgetKind.LibraryView)
root.moveVertical(value);

Expand All @@ -82,7 +82,7 @@ Item {
Mixxx.ControlProxy {
group: "[Library]"
key: "MoveUp"
onValueChanged: {
onValueChanged: (value) => {
if (value != 0 && root.focusWidget == FocusedWidgetControl.WidgetKind.LibraryView)
root.moveVertical(-1);

Expand All @@ -92,7 +92,7 @@ Item {
Mixxx.ControlProxy {
group: "[Library]"
key: "MoveDown"
onValueChanged: {
onValueChanged: (value) => {
if (value != 0 && root.focusWidget == FocusedWidgetControl.WidgetKind.LibraryView)
root.moveVertical(1);

Expand All @@ -112,7 +112,9 @@ Item {
delegate: LibraryControlLoadSelectedTrackHandler {
group: "[Channel" + (index + 1) + "]"
enabled: root.focusWidget == FocusedWidgetControl.WidgetKind.LibraryView
onLoadTrackRequested: root.loadSelectedTrack(group, play)
onLoadTrackRequested: (play) => {
root.loadSelectedTrack(this.group, play);
}
}

}
Expand All @@ -130,7 +132,9 @@ Item {
delegate: LibraryControlLoadSelectedTrackHandler {
group: "[PreviewDeck" + (index + 1) + "]"
enabled: root.focusWidget == FocusedWidgetControl.WidgetKind.LibraryView
onLoadTrackRequested: root.loadSelectedTrack(group, play)
onLoadTrackRequested: (play) => {
root.loadSelectedTrack(this.group, play);
}
}

}
Expand All @@ -148,7 +152,9 @@ Item {
delegate: LibraryControlLoadSelectedTrackHandler {
group: "[Sampler" + (index + 1) + "]"
enabled: root.focusWidget == FocusedWidgetControl.WidgetKind.LibraryView
onLoadTrackRequested: root.loadSelectedTrack(group, play)
onLoadTrackRequested: (play) => {
root.loadSelectedTrack(this.group, play);
}
}

}
Expand Down
4 changes: 2 additions & 2 deletions res/qml/LibraryControlLoadSelectedTrackHandler.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Item {
Mixxx.ControlProxy {
group: root.group
key: "LoadSelectedTrack"
onValueChanged: {
onValueChanged: (value) => {
if (value == 0 || !root.enabled)
return ;

Expand All @@ -27,7 +27,7 @@ Item {
Mixxx.ControlProxy {
group: root.group
key: "LoadSelectedTrackAndPlay"
onValueChanged: {
onValueChanged: (value) => {
if (value == 0 || !root.enabled)
return ;

Expand Down
6 changes: 3 additions & 3 deletions res/qml/MicrophoneDuckingPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Column {
id: duckingControl

property string duckingModeName: {
switch (value) {
switch (this.value) {
case MicrophoneDuckingPanel.DuckingMode.Auto:
return "Auto";
case MicrophoneDuckingPanel.DuckingMode.Manual:
Expand All @@ -46,11 +46,11 @@ Column {
}
}
property bool duckingEnabled: {
return (value == MicrophoneDuckingPanel.DuckingMode.Auto || value == MicrophoneDuckingPanel.DuckingMode.Manual);
return (this.value == MicrophoneDuckingPanel.DuckingMode.Auto || this.value == MicrophoneDuckingPanel.DuckingMode.Manual);
}

function nextMode() {
value = (value + 1) % MicrophoneDuckingPanel.DuckingMode.NumModes;
this.value = (this.value + 1) % MicrophoneDuckingPanel.DuckingMode.NumModes;
}

group: "[Master]"
Expand Down
Loading