2 * Copyright 2016 Konsulko Group
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 // BUG: ValueChanged event is raised by sliders when you are moving the caret, should be raised only when you release it.
18 // TODO: Call mixer.setVolume(sliderName, Value) on value change
19 // TODO: Call mixer.getVolume(sliderName) on load
22 import QtQuick.Layouts 1.1
23 import QtQuick.Controls 2.0
24 import AGL.Demo.Controls 1.0
32 Component.onCompleted: {
33 mixer.open(bindingAddress)
36 // Remove existing sliders
37 for(var i = sliders.children.length; i > 0 ; --i) {
38 console.log("destroying: " + i)
39 sliders.children[i-1].destroy()
42 // Add slider for each role
43 for(var j = 0; j < mixer.roles.length; ++j) {
44 addSlider(mixer.roles[j])
48 function addSlider(name) {
50 import QtQuick.Layouts 1.1
51 import QtQuick.Controls 2.0
54 id: slider_" + name + "
55 Layout.minimumHeight: 75
59 Layout.minimumWidth: 150
62 id: slider_" + name + "_textvalue
67 id: slider_" + name + "_slider
68 Layout.fillWidth: true
72 snapMode: Slider.SnapOnRelease
74 slider_" + name + "_textvalue.text = value + \" %\"
75 mixer.setVolume(\"" + name + "\", value)
77 Component.objectName: {
78 mixer.getVolume(\"" + name + "\")
81 }", sliders, "volumeslider")
84 function deleteChilds(item) {
85 for(var i = item.children.length; i > 0 ; i--) {
86 deleteChilds(item.children[i-1])
96 anchors.horizontalCenter: parent.horizontalCenter
102 anchors.top: title.bottom
103 anchors.left: parent.left
104 anchors.right: parent.right