-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4567 from Holzhaus/qml-library-improvements
QML: Library Improvements
- Loading branch information
Showing
16 changed files
with
508 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Mixxx 0.1 as Mixxx | ||
|
||
Mixxx.ControlProxy { | ||
|
||
enum WidgetKind { | ||
None, | ||
Searchbar, | ||
Sidebar, | ||
LibraryView | ||
} | ||
|
||
group: "[Library]" | ||
key: "focused_widget" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
import Mixxx 0.1 as Mixxx | ||
import QtQuick 2.12 | ||
|
||
Item { | ||
id: root | ||
|
||
property alias focusWidget: focusedWidgetControl.value | ||
|
||
signal moveVertical(int offset) | ||
signal loadSelectedTrack(string group, bool play) | ||
signal loadSelectedTrackIntoNextAvailableDeck(bool play) | ||
|
||
FocusedWidgetControl { | ||
id: focusedWidgetControl | ||
|
||
Component.onCompleted: this.value = FocusedWidgetControl.WidgetKind.LibraryView | ||
} | ||
|
||
Mixxx.ControlProxy { | ||
group: "[Library]" | ||
key: "GoToItem" | ||
onValueChanged: { | ||
if (value != 0 && root.focusWidget == FocusedWidgetControl.WidgetKind.LibraryView) | ||
root.loadSelectedTrackIntoNextAvailableDeck(false); | ||
|
||
} | ||
} | ||
|
||
Mixxx.ControlProxy { | ||
group: "[Playlist]" | ||
key: "LoadSelectedIntoFirstStopped" | ||
onValueChanged: { | ||
if (value != 0 && root.focusWidget == FocusedWidgetControl.WidgetKind.LibraryView) | ||
root.loadSelectedTrackIntoNextAvailableDeck(false); | ||
|
||
} | ||
} | ||
|
||
Mixxx.ControlProxy { | ||
group: "[Playlist]" | ||
key: "SelectTrackKnob" | ||
onValueChanged: { | ||
if (value != 0) { | ||
root.focusWidget = FocusedWidgetControl.WidgetKind.LibraryView; | ||
root.moveVertical(value); | ||
} | ||
} | ||
} | ||
|
||
Mixxx.ControlProxy { | ||
group: "[Playlist]" | ||
key: "SelectPrevTrack" | ||
onValueChanged: { | ||
if (value != 0) { | ||
root.focusWidget = FocusedWidgetControl.WidgetKind.LibraryView; | ||
root.moveVertical(-1); | ||
} | ||
} | ||
} | ||
|
||
Mixxx.ControlProxy { | ||
group: "[Playlist]" | ||
key: "SelectNextTrack" | ||
onValueChanged: { | ||
if (value != 0) { | ||
root.focusWidget = FocusedWidgetControl.WidgetKind.LibraryView; | ||
root.moveVertical(1); | ||
} | ||
} | ||
} | ||
|
||
Mixxx.ControlProxy { | ||
group: "[Library]" | ||
key: "MoveVertical" | ||
onValueChanged: { | ||
if (value != 0 && root.focusWidget == FocusedWidgetControl.WidgetKind.LibraryView) | ||
root.moveVertical(value); | ||
|
||
} | ||
} | ||
|
||
Mixxx.ControlProxy { | ||
group: "[Library]" | ||
key: "MoveUp" | ||
onValueChanged: { | ||
if (value != 0 && root.focusWidget == FocusedWidgetControl.WidgetKind.LibraryView) | ||
root.moveVertical(-1); | ||
|
||
} | ||
} | ||
|
||
Mixxx.ControlProxy { | ||
group: "[Library]" | ||
key: "MoveDown" | ||
onValueChanged: { | ||
if (value != 0 && root.focusWidget == FocusedWidgetControl.WidgetKind.LibraryView) | ||
root.moveVertical(1); | ||
|
||
} | ||
} | ||
|
||
Mixxx.ControlProxy { | ||
id: numDecksControl | ||
|
||
group: "[Master]" | ||
key: "num_decks" | ||
} | ||
|
||
Instantiator { | ||
model: numDecksControl.value | ||
|
||
delegate: LibraryControlLoadSelectedTrackHandler { | ||
group: "[Channel" + (index + 1) + "]" | ||
enabled: root.focusWidget == FocusedWidgetControl.WidgetKind.LibraryView | ||
onLoadTrackRequested: root.loadSelectedTrack(group, play) | ||
} | ||
|
||
} | ||
|
||
Mixxx.ControlProxy { | ||
id: numPreviewDecksControl | ||
|
||
group: "[Master]" | ||
key: "num_preview_decks" | ||
} | ||
|
||
Instantiator { | ||
model: numPreviewDecksControl.value | ||
|
||
delegate: LibraryControlLoadSelectedTrackHandler { | ||
group: "[PreviewDeck" + (index + 1) + "]" | ||
enabled: root.focusWidget == FocusedWidgetControl.WidgetKind.LibraryView | ||
onLoadTrackRequested: root.loadSelectedTrack(group, play) | ||
} | ||
|
||
} | ||
|
||
Mixxx.ControlProxy { | ||
id: numSamplersControl | ||
|
||
group: "[Master]" | ||
key: "num_samplers" | ||
} | ||
|
||
Instantiator { | ||
model: numSamplersControl.value | ||
|
||
delegate: LibraryControlLoadSelectedTrackHandler { | ||
group: "[Sampler" + (index + 1) + "]" | ||
enabled: root.focusWidget == FocusedWidgetControl.WidgetKind.LibraryView | ||
onLoadTrackRequested: root.loadSelectedTrack(group, play) | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import Mixxx 0.1 as Mixxx | ||
import QtQuick 2.12 | ||
|
||
/// Usually, this component shouldn't be an (visual) `Item` and use something | ||
/// like `QtObject` instead. However, for some reason using `QtObject` here | ||
/// makes Mixxx crash on load (using Qt 5.15.2+kde+r43-1). We can check if this | ||
/// is fixed upstream once we switch to Qt 6. | ||
Item { | ||
id: root | ||
|
||
property string group // required | ||
property bool enabled: true | ||
|
||
signal loadTrackRequested(bool play) | ||
|
||
Mixxx.ControlProxy { | ||
group: root.group | ||
key: "LoadSelectedTrack" | ||
onValueChanged: { | ||
if (value == 0 || !root.enabled) | ||
return ; | ||
|
||
root.loadTrackRequested(false); | ||
} | ||
} | ||
|
||
Mixxx.ControlProxy { | ||
group: root.group | ||
key: "LoadSelectedTrackAndPlay" | ||
onValueChanged: { | ||
if (value == 0 || !root.enabled) | ||
return ; | ||
|
||
root.loadTrackRequested(true); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.