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