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
28 property Component volumeSlider
34 Component.onCompleted: {
35 root.volumeSlider = Qt.createComponent("VolumeSlider.qml");
36 if (root.VolumeSlider.status !== Component.Ready) {
37 console.log("Failed to load the VolumeSlider.qml component: " + root.volumeSlider.errorString());
39 mixer.open(bindingAddress);
42 // Remove existing sliders
43 for(var i = sliders.children.length; i > 0 ; --i) {
44 console.log("destroying: " + i);
45 sliders.children[i-1].destroy();
48 // Add slider for each role
49 for(var j = 0; j < mixer.roles.length; ++j) {
50 addSlider(mixer.roles[j]);
55 for(var i = 0; i < sliders.children.length ; i++) {
56 console.log("Slider found: " + i);
57 //if (sliders[i].role === name) {
58 // sliders[i].value = value;
63 function addSlider(name) {
64 var sld = root.volumeSlider.createObject(sliders);
66 mixer.getVolume(name); // Update volume
69 function deleteChilds(item) {
70 for(var i = item.children.length; i > 0 ; i--) {
71 deleteChilds(item.children[i-1]);
81 anchors.horizontalCenter: parent.horizontalCenter
87 anchors.top: title.bottom
88 anchors.left: parent.left
89 anchors.right: parent.right