1/* 2 * Copyright (c) 2015-2021 Meltytech, LLC 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18import QtQuick 2.12 19import QtQuick.Controls 2.12 20import QtQuick.Layouts 1.12 21import Shotcut.Controls 1.0 as Shotcut 22 23Item { 24 width: 350 25 height: 150 26 Component.onCompleted: { 27 if (filter.isNew) { 28 // Set default parameter values 29 filter.set('0', 322) 30 filter.set('1', 322) 31 filter.set('2', 1) 32 filter.set('wetness', 1.0) 33 filter.savePreset(preset.parameters) 34 } 35 setControls() 36 } 37 38 function setControls() { 39 sliderCenter.value = filter.getDouble('0') 40 sliderBandwidth.value = filter.getDouble('1') 41 sliderStages.value = filter.getDouble('2') 42 sliderWetness.value = filter.getDouble('wetness') * sliderWetness.maximumValue 43 } 44 45 GridLayout { 46 anchors.fill: parent 47 anchors.margins: 8 48 columns: 3 49 50 Label { 51 text: qsTr('Preset') 52 Layout.alignment: Qt.AlignRight 53 } 54 Shotcut.Preset { 55 id: preset 56 parameters: ['0', '1', '2', 'wetness'] 57 Layout.columnSpan: 2 58 onPresetSelected: setControls() 59 } 60 61 Label { 62 text: qsTr('Center frequency') 63 Layout.alignment: Qt.AlignRight 64 } 65 Shotcut.SliderSpinner { 66 id: sliderCenter 67 minimumValue: 5 68 maximumValue: 21600 69 suffix: ' Hz' 70 value: filter.getDouble('0') 71 onValueChanged: { 72 filter.set('0', value) 73 } 74 } 75 Shotcut.UndoButton { 76 onClicked: sliderCenter.value = 322 77 } 78 79 Label { 80 text: qsTr('Bandwidth') 81 Layout.alignment: Qt.AlignRight 82 } 83 Shotcut.SliderSpinner { 84 id: sliderBandwidth 85 minimumValue: 5 86 maximumValue: 21600 87 suffix: ' Hz' 88 value: filter.getDouble('1') 89 onValueChanged: { 90 filter.set('1', value) 91 } 92 } 93 Shotcut.UndoButton { 94 onClicked: sliderBandwidth.value = 322 95 } 96 97 Label { 98 text: qsTr('Rolloff rate') 99 Layout.alignment: Qt.AlignRight 100 } 101 Shotcut.SliderSpinner { 102 id: sliderStages 103 minimumValue: 1 104 maximumValue: 10 105 value: filter.get('2') 106 onValueChanged: { 107 filter.set('2', value) 108 } 109 } 110 Shotcut.UndoButton { 111 onClicked: sliderStages.value = 1 112 } 113 114 Label { 115 text: qsTr('Dry') 116 Layout.alignment: Qt.AlignRight 117 } 118 Shotcut.SliderSpinner { 119 id: sliderWetness 120 minimumValue: 0 121 maximumValue: 100 122 decimals: 1 123 label: qsTr('Wet') 124 suffix: ' %' 125 value: filter.getDouble('wetness') * maximumValue 126 onValueChanged: { 127 filter.set('wetness', value / maximumValue) 128 } 129 } 130 Shotcut.UndoButton { 131 onClicked: sliderWetness.value = sliderWetness.maximumValue 132 } 133 134 Item { 135 Layout.fillHeight: true; 136 } 137 } 138} 139