75673fe20ffcf2deffbfddeab282820f8d71e232
[apps/mixer.git] / app / Mixer.qml
1 /*
2  * Copyright 2016 Konsulko Group
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 import QtQuick 2.6
18 import QtQuick.Layouts 1.1
19 import QtQuick.Controls 2.0
20 import AGL.Demo.Controls 1.0
21 import PaControlModel 1.0
22
23 ApplicationWindow {
24         id: root
25
26         Label { 
27                 id: title
28                 font.pixelSize: 48
29                 text: "Mixer"
30                 anchors.horizontalCenter: parent.horizontalCenter
31         }
32
33         Component {
34                 id: ctldesc
35                 Label {
36                         font.pixelSize: 32
37                         width: listView.width
38                         wrapMode: Text.WordWrap
39                         property var typeString: {modelType ? "Output" : "Input"}
40                         text: "[" + typeString + " #" + modelCIndex + "]: " + modelDesc
41                 }
42         }
43
44         Component {
45                 id: empty
46                 Item {
47                 }
48         }
49
50         ListView {
51                 id: listView
52                 anchors.left: parent.left
53                 anchors.top: title.bottom
54                 anchors.margins: 80
55                 anchors.fill: parent
56                 model: PaControlModel { objectName: "pacm" }
57                 delegate: ColumnLayout {
58                         width: parent.width
59                         spacing: 40
60                         Loader {
61                                 property int modelType: type
62                                 property int modelCIndex: cindex
63                                 property string modelDesc: desc
64                                 sourceComponent: (channel == 0) ? ctldesc : empty
65                         }
66                         RowLayout {
67                                 Layout.minimumHeight: 75
68                                 Label {
69                                         font.pixelSize: 24
70                                         text: cdesc
71                                         Layout.minimumWidth: 150
72                                 }
73                                 Label {
74                                         font.pixelSize: 24
75                                         text: "0 %"
76                                 }
77                                 Slider {
78                                         Layout.fillWidth: true
79                                         from: 0
80                                         to: 65536
81                                         stepSize: 256
82                                         snapMode: Slider.SnapOnRelease
83                                         onValueChanged: volume = value
84                                         Component.onCompleted: value = volume
85                                 }
86                                 Label {
87                                         font.pixelSize: 24
88                                         text: "100 %"
89                                 }
90                         }
91                 }
92         }
93 }