summaryrefslogtreecommitdiffstats
path: root/res/qml/LibraryControlLoadSelectedTrackHandler.qml
blob: fad54367703efe06cc0933440859a9f257f060be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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);
        }
    }

}