summaryrefslogtreecommitdiffstats
path: root/res/skins/QMLDemo/Hotcue.qml
blob: 1ff2579b4988ee5764f741e23fd022515525a82c (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import Mixxx 0.1 as Mixxx
import QtQuick 2.12
import "Theme"

Item {
    id: root

    property int hotcueNumber // required
    property string group // required
    property alias activate: hotcueActivateControl.value
    property alias clear: hotcueClearControl.value
    readonly property bool isSet: hotcueStatusControl.value != 0
    readonly property color color: {
        if (hotcueColorControl.value < 0)
            return Theme.deckActiveColor;

        return "#" + hotcueColorControl.value.toString(16).padStart(6, "0");
    }

    function setColor(newColor) {
        hotcueColorControl.value = (parseInt(newColor.r * 255) << 16) | (parseInt(newColor.g * 255) << 8) | parseInt(newColor.b * 255);
    }

    Mixxx.ControlProxy {
        id: hotcueColorControl

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

    Mixxx.ControlProxy {
        id: hotcueActivateControl

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

    Mixxx.ControlProxy {
        id: hotcueStatusControl

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

    Mixxx.ControlProxy {
        id: hotcueClearControl

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

}