1/* 2 SPDX-FileCopyrightText: 2018 Jean-Baptiste Mardelle <jb@kdenlive.org> 3 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 4*/ 5 6import QtQuick 2.11 7import QtQuick.Controls 1.4 8import QtQuick.Controls.Styles 1.4 9import Kdenlive.Controls 1.0 10import QtQuick.Layouts 1.11 11 12Item { 13 id: liftgammagain 14 property string effectName: 'lift_gamma_gain' 15 property double liftFactor : 2.0 16 property double gammaFactor: 2.0 17 property double gainFactor: 4.0 18 Layout.fillWidth: true 19 function loadWheels() { 20 if (!effectstackmodel.hasFilter(liftgammagain.effectName)) { 21 // Set default parameter values 22 liftwheel.setColor(0. / liftFactor, 0. / liftFactor, 0. / liftFactor, 1.0); 23 gammawheel.setColor(1.0 / gammaFactor, 1.0 / gammaFactor, 1.0 / gammaFactor, 1.0); 24 gainwheel.setColor(1.0 / gainFactor, 1.0 / gainFactor, 1.0 / gainFactor, 1.0); 25 } else { 26 liftwheel.setColor(effectstackmodel.getFilterParam(liftgammagain.effectName, 'lift_r') / liftFactor, 27 effectstackmodel.getFilterParam(liftgammagain.effectName, 'lift_g') / liftFactor, 28 effectstackmodel.getFilterParam(liftgammagain.effectName, 'lift_b') / liftFactor, 29 1.0 ) 30 gammawheel.setColor(effectstackmodel.getFilterParam(liftgammagain.effectName, 'gamma_r') / gammaFactor, 31 effectstackmodel.getFilterParam(liftgammagain.effectName, 'gamma_g') / gammaFactor, 32 effectstackmodel.getFilterParam(liftgammagain.effectName, 'gamma_b') / gammaFactor, 33 1.0 ) 34 gainwheel.setColor(effectstackmodel.getFilterParam(liftgammagain.effectName, 'gain_r') / gainFactor, 35 effectstackmodel.getFilterParam(liftgammagain.effectName, 'gain_g') / gainFactor, 36 effectstackmodel.getFilterParam(liftgammagain.effectName, 'gain_b') / gainFactor, 37 1.0 ) 38 } 39 } 40 RowLayout { 41 spacing: 0 42 Layout.fillWidth: true 43 Column { 44 height: parent.height 45 width: liftgammagain.width / 3 46 Label { 47 text: i18n("Lift") 48 } 49 ColorWheelItem { 50 id: liftwheel 51 width: liftgammagain.width / 3 52 height: width 53 onColorChanged: { 54 effectstackmodel.adjust(liftgammagain.effectName, 'lift_r', liftwheel.red ); 55 effectstackmodel.adjust(liftgammagain.effectName, 'lift_g', liftwheel.green ); 56 effectstackmodel.adjust(liftgammagain.effectName, 'lift_b', liftwheel.blue ); 57 } 58 } 59 } 60 Column { 61 height: parent.height 62 width: liftgammagain.width / 3 63 Label { 64 text: i18n("Gamma") 65 } 66 ColorWheelItem { 67 id: gammawheel 68 width: liftgammagain.width / 3 69 height: width 70 onColorChanged: { 71 effectstackmodel.adjust(liftgammagain.effectName, 'gamma_r', gammawheel.red); 72 effectstackmodel.adjust(liftgammagain.effectName, 'gamma_g', gammawheel.green); 73 effectstackmodel.adjust(liftgammagain.effectName, 'gamma_b', gammawheel.blue); 74 } 75 } 76 } 77 Column { 78 height: parent.height 79 width: liftgammagain.width / 3 80 Label { 81 text: i18n("Gain") 82 } 83 ColorWheelItem { 84 id: gainwheel 85 width: liftgammagain.width / 3 86 height: width 87 onColorChanged: { 88 effectstackmodel.adjust(liftgammagain.effectName, 'gain_r', gainwheel.red); 89 effectstackmodel.adjust(liftgammagain.effectName, 'gain_g', gainwheel.green); 90 effectstackmodel.adjust(liftgammagain.effectName, 'gain_b', gainwheel.blue); 91 } 92 } 93 } 94 } 95 Component.onCompleted: { 96 liftwheel.setFactorDefaultZero(liftgammagain.liftFactor, 0, 0.5); 97 gammawheel.setFactorDefaultZero(liftgammagain.gammaFactor, 1, 0); 98 gainwheel.setFactorDefaultZero(liftgammagain.gainFactor, 1, 0); 99 } 100} 101