ControlView.qml 4.56 KB
Newer Older
Leander Schulten's avatar
Leander Schulten committed
1
2
3
4
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.0
import QtGraphicalEffects 1.0
5
import QtQuick.Dialogs 1.2
Leander Schulten's avatar
Leander Schulten committed
6
7
8
9
10
11
12
13
14
15
16
17
import custom.licht 1.0


ControlPanel{



    onExitMenuArea: programm.width = programm.height
    menuHeight: height-switchGroup.y
    menuWidth: width-programm.x
    RoundButton{

18
        onClicked: selectProgrammDialog.visible=true
Leander Schulten's avatar
Leander Schulten committed
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
        visible: UserManagment.currentUser.havePermission(Permission.ADD_CONTROL_ITEM);
        id:programm
        text: "+"
        z:2
        anchors.margins: 5
        anchors.bottom: parent.bottom
        anchors.right: parent.right
        onHoveredChanged: if(hovered)width=150;
        Behavior on width {
            NumberAnimation{
                duration: 150
                easing.type: Easing.OutQuad
                onRunningChanged: {
                    if(running)
                        textAnimation.start();
                    if(running&&!programm.hovered){
                        textAnimation.newText="Add Programm";
                        dimmerGroup.y = programm.y;
                        switchGroup.y = programm.y;
                    }else if(!running&&programm.hovered){
                        textAnimation.newText="+";
                        dimmerGroup.y = programm.y-programm.height;
                        switchGroup.y = programm.y-programm.height*2;
                    }
                }
            }
        }
        onYChanged: {
            if(width!=height){
                dimmerGroup.y = programm.y-programm.height
                switchGroup.y = programm.y-programm.height*2;
            }else{
                dimmerGroup.y = programm.y;
                switchGroup.y = programm.y;
            }
        }

        SequentialAnimation {
            id:textAnimation
            property alias newText: setText.value
            NumberAnimation{
                target: programm.contentItem
                property: "opacity"
                duration: 60
                from: 1
                to: 0
                easing.type: Easing.Linear
            }

            PauseAnimation {
                duration: 30
            }
            PropertyAction {
                id:setText
                target: programm;
                property: "text"
            }
            NumberAnimation{
                target: programm.contentItem
                property: "opacity"
                duration: 60
                from: 0
                to: 1
                easing.type: Easing.Linear
            }
        }
    }

    RoundButton{
        visible: UserManagment.currentUser.havePermission(Permission.ADD_CONTROL_ITEM);
        z:1.3
        id: switchGroup
        text:"Switchgroup"
        anchors.right: programm.right
        anchors.left: programm.left
        Behavior on y{
            NumberAnimation{duration: 100}
        }
        onClicked: addSwitchGroupControl()
    }
    RoundButton{
        visible: UserManagment.currentUser.havePermission(Permission.ADD_CONTROL_ITEM);
        z:1.3
        id: dimmerGroup
        text:"Dimmergroup"
        anchors.right: programm.right
        anchors.left: programm.left
        Behavior on y{
            NumberAnimation{duration: 100}
        }
        onClicked: addDimmerGroupControl()
    }
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133

    Dialog{
        modality: Qt.WindowModal
        id:selectProgrammDialog
        title: "Select Programm"
        width:300
        contentItem: RowLayout {
            Pane{
                Layout.fillWidth: true
                ColumnLayout{
                    anchors.left: parent.left
                    anchors.right: parent.right
                    spacing: 10
                    ComboBox{
                        Layout.fillWidth: true
                        id:programmSelect
                        model: programmModel
                        textRole: "display"
                    }
                    RowLayout{
                        Button{
                            Layout.fillWidth: true
                            text:"Abbrechen"
134
                            onClicked: selectProgrammDialog.visible = false
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
                        }
                        Button{
                            Layout.fillWidth: true
                            text:"Hinzufügen"
                            onClicked: {
                                    selectProgrammDialog.visible = false;
                                    addProgrammControl(programmModel.data(programmModel.index(programmSelect.currentIndex,0),-1));

                            }
                        }
                    }
                }
            }
        }
    }


Leander Schulten's avatar
Leander Schulten committed
152
}