ProgrammControl.qml 2.12 KB
Newer Older
Leander Schulten's avatar
Leander Schulten committed
1
2
3
4
5
6
7
8
9
10
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import QtGraphicalEffects 1.0
import custom.licht 1.0

ControlItem{
    id:item
    blockWidth: 3
    blockHeight: 1
Leander Schulten's avatar
Leander Schulten committed
11
    pressed: controlData?!controlData.programm.running:false
Leander Schulten's avatar
Leander Schulten committed
12
13
14
    onPressedChanged: {
        if(controlData.programm.running){
            play.opacity = 1;
Leander Schulten's avatar
Leander Schulten committed
15
16
        }else{
            play.opacity = 0;
Leander Schulten's avatar
Leander Schulten committed
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
        }
    }
    ControlItemBlock{
        Image {
            anchors.margins: 1
            anchors.fill:parent
            id: play
            source: "icons/play.svg"
            Behavior on opacity {
                NumberAnimation{
                    duration: 100
                }
            }
        }
        Image {
            anchors.margins: 1
            anchors.fill:parent
            id: pause
            source: "icons/pause.svg"
            opacity: 1-play.opacity
        }
        MouseArea{
            anchors.fill:parent

            onClicked: {controlData.programm.running=!controlData.programm.running;}

        }
    }

    ControlItemBlock{
        blockWidth: 2
        Label{
            anchors.fill: parent
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
Leander Schulten's avatar
Leander Schulten committed
52
            text: controlData?controlData.programm.name:"null"
Leander Schulten's avatar
Leander Schulten committed
53
54
55
56
57
58
59
60
61
62
63
64
65
        }
    }

    popup: Popup{
            id:popup
            ColumnLayout{
                Label{
                    text:"Speed:"
                }
                Slider{
                    id:speedSlider
                    from: 0.1
                    to:10
Leander Schulten's avatar
Leander Schulten committed
66
                    value: controlData?controlData.programm.speed:1
Leander Schulten's avatar
Leander Schulten committed
67
68
69
70
71
72
73
74
75
76
77
78
79
                    onValueChanged: if(controlData)controlData.programm.speed = value;
                    Text {
                        id: sliderSpeed
                        text: speedSlider.value.toFixed(1)
                        anchors.bottom: speedSlider.handle.top
                        anchors.horizontalCenter: parent.handle.horizontalCenter
                        anchors.bottomMargin: 2
                    }
                }
            }
            closePolicy: Popup.CloseOnPressOutside
        }
}