Restore colorwheels for color correction, fix freeze on reset effect, fix effects with factor

parent 14a2a09a
......@@ -2,31 +2,31 @@
<effect tag="lift_gamma_gain" id="lift_gamma_gain">
<name>Lift/gamma/gain</name>
<author>Brian Matherly</author>
<parameter type="double" name="lift_r" default="0" min="0" max="500" factor="100">
<parameter type="colorwheel" name="lift_r" default="0" min="0" max="500" factor="100">
<name>Lift: Red</name>
</parameter>
<parameter type="double" name="lift_g" default="0" min="0" max="500" factor="100">
<parameter type="colorwheel" name="lift_g" default="0" min="0" max="500" factor="100">
<name>Lift: Green</name>
</parameter>
<parameter type="double" name="lift_b" default="0" min="0" max="500" factor="100">
<parameter type="colorwheel" name="lift_b" default="0" min="0" max="500" factor="100">
<name>Lift: Blue</name>
</parameter>
<parameter type="double" name="gamma_r" default="100" min="0" max="500" factor="100">
<parameter type="colorwheel" name="gamma_r" default="100" min="0" max="500" factor="100">
<name>Gamma: Red</name>
</parameter>
<parameter type="double" name="gamma_g" default="100" min="0" max="500" factor="100">
<parameter type="colorwheel" name="gamma_g" default="100" min="0" max="500" factor="100">
<name>Gamma: Green</name>
</parameter>
<parameter type="double" name="gamma_b" default="100" min="0" max="500" factor="100">
<parameter type="colorwheel" name="gamma_b" default="100" min="0" max="500" factor="100">
<name>Gamma: Blue</name>
</parameter>
<parameter type="double" name="gain_r" default="100" min="0" max="500" factor="100">
<parameter type="colorwheel" name="gain_r" default="100" min="0" max="500" factor="100">
<name>Gain: Red</name>
</parameter>
<parameter type="double" name="gain_g" default="100" min="0" max="500" factor="100">
<parameter type="colorwheel" name="gain_g" default="100" min="0" max="500" factor="100">
<name>Gain: Green</name>
</parameter>
<parameter type="double" name="gain_b" default="100" min="0" max="500" factor="100">
<parameter type="colorwheel" name="gain_b" default="100" min="0" max="500" factor="100">
<name>Gain: Blue</name>
</parameter>
</effect>
......@@ -15,6 +15,8 @@ set(kdenlive_SRCS
#assets/view/widgets/animationwidget.cpp
assets/view/widgets/boolparamwidget.cpp
assets/view/widgets/doubleparamwidget.cpp
assets/view/widgets/colorwheel.cpp
assets/view/widgets/lumaliftgainparam.cpp
# assets/view/widgets/keyframeedit.cpp
assets/view/widgets/keyframewidget.cpp
assets/view/widgets/listparamwidget.cpp
......
......@@ -325,6 +325,8 @@ ParamType AssetParameterModel::paramTypeFromStr(const QString &type)
return ParamType::KeyframeParam;
} else if (type == QLatin1String("color")) {
return ParamType::Color;
} else if (type == QLatin1String("colorwheel")) {
return ParamType::ColorWheel;
} else if (type == QLatin1String("position")) {
return ParamType::Position;
} else if (type == QLatin1String("curve")) {
......@@ -406,6 +408,12 @@ QVariant AssetParameterModel::parseAttribute(const QString &attribute, const QDo
if (attribute == QLatin1String("default")) {
if (type == ParamType::RestrictedAnim) {
content = getDefaultKeyframes(0, content, true);
} else {
if (element.hasAttribute(QStringLiteral("factor"))) {
QLocale locale;
locale.setNumberOptions(QLocale::OmitGroupSeparator);
return QVariant(locale.toDouble(content) / locale.toDouble(element.attribute(QStringLiteral("factor"))));
}
}
}
return content;
......
......@@ -52,6 +52,7 @@ enum class ParamType {
Addedgeometry,
KeyframeParam,
Color,
ColorWheel,
Position,
Curve,
Bezier_spline,
......
......@@ -46,32 +46,41 @@ AssetParameterView::AssetParameterView(QWidget *parent)
void AssetParameterView::setModel(const std::shared_ptr<AssetParameterModel> &model, QPair<int, int> range, QSize frameSize, bool addSpacer)
{
qDebug() << "**************\nset ASSETPARAMVIEW model " << model.get();
unsetModel();
QMutexLocker lock(&m_lock);
m_model = model;
m_model->prepareKeyframes();
const QString paramTag = model->getAssetId();
connect(m_model.get(), &AssetParameterModel::dataChanged, this, &AssetParameterView::refresh);
for (int i = 0; i < model->rowCount(); ++i) {
QModelIndex index = model->index(i, 0);
auto type = model->data(index, AssetParameterModel::TypeRole).value<ParamType>();
if (m_mainKeyframeWidget &&
if (paramTag == QStringLiteral("lift_gamma_gain")) {
// Special case, the colorwheel widget manages several parameters
QModelIndex index = model->index(0, 0);
auto w = AbstractParamWidget::construct(model, index, range, frameSize, this);
connect(w, &AbstractParamWidget::valueChanged, this, &AssetParameterView::commitChanges);
m_lay->addWidget(w);
m_widgets.push_back(w);
} else {
for (int i = 0; i < model->rowCount(); ++i) {
QModelIndex index = model->index(i, 0);
auto type = model->data(index, AssetParameterModel::TypeRole).value<ParamType>();
if (m_mainKeyframeWidget &&
(type == ParamType::Geometry || type == ParamType::Animated || type == ParamType::RestrictedAnim || type == ParamType::KeyframeParam)) {
// Keyframe widget can have some extra params that should'nt build a new widget
qDebug() << "// FOUND ADDED PARAM";
m_mainKeyframeWidget->addParameter(index);
} else {
auto w = AbstractParamWidget::construct(model, index, range, frameSize, this);
/*if (type == ParamType::Geometry || type == ParamType::Animated || type == ParamType::RestrictedAnim || type == ParamType::AnimatedRect) {
// Keyframe widget can have some extra params that should'nt build a new widget
qDebug() << "// FOUND ADDED PARAM";
m_mainKeyframeWidget->addParameter(index);
} else {
auto w = AbstractParamWidget::construct(model, index, range, frameSize, this);
/*if (type == ParamType::Geometry || type == ParamType::Animated || type == ParamType::RestrictedAnim || type == ParamType::AnimatedRect) {
animWidget = static_cast<AnimationWidget *>(w);
}*/
if (type == ParamType::KeyframeParam || type == ParamType::AnimatedRect) {
m_mainKeyframeWidget = static_cast<KeyframeWidget *>(w);
}*/
if (type == ParamType::KeyframeParam || type == ParamType::AnimatedRect) {
m_mainKeyframeWidget = static_cast<KeyframeWidget *>(w);
}
connect(w, &AbstractParamWidget::valueChanged, this, &AssetParameterView::commitChanges);
connect(w, &AbstractParamWidget::seekToPos, this, &AssetParameterView::seekToPos);
m_lay->addWidget(w);
m_widgets.push_back(w);
}
connect(w, &AbstractParamWidget::valueChanged, this, &AssetParameterView::commitChanges);
connect(w, &AbstractParamWidget::seekToPos, this, &AssetParameterView::seekToPos);
m_lay->addWidget(w);
m_widgets.push_back(w);
}
}
if (addSpacer) {
......@@ -81,13 +90,21 @@ void AssetParameterView::setModel(const std::shared_ptr<AssetParameterModel> &mo
void AssetParameterView::resetValues()
{
QMutexLocker lock(&m_lock);
auto type = m_model->data(m_model->index(0, 0), AssetParameterModel::TypeRole).value<ParamType>();
for (int i = 0; i < m_model->rowCount(); ++i) {
QModelIndex index = m_model->index(i, 0);
QString name = m_model->data(index, AssetParameterModel::NameRole).toString();
QString defaultValue = m_model->data(index, AssetParameterModel::DefaultRole).toString();
m_model->setParameter(name, defaultValue);
refresh(index, index, QVector<int>());
if (type == ParamType::ColorWheel) {
if (i == m_model->rowCount() - 1) {
// Special case, the ColorWheel widget handles several params, so only refresh once when all parameters were set.
QModelIndex firstIndex = m_model->index(0, 0);
refresh(firstIndex, firstIndex, QVector<int>());
}
} else {
refresh(index, index, QVector<int>());
}
}
}
......@@ -153,7 +170,6 @@ void AssetParameterView::refresh(const QModelIndex &topLeft, const QModelIndex &
Q_ASSERT(!topLeft.parent().isValid());
// We make sure the range is valid
Q_ASSERT(bottomRight.row() < (int)m_widgets.size());
for (int i = topLeft.row(); i <= bottomRight.row(); ++i) {
m_widgets[(uint)i]->slotRefresh();
}
......
......@@ -21,6 +21,7 @@
#include "animationwidget.h"
#include "assets/model/assetparametermodel.hpp"
#include "boolparamwidget.hpp"
#include "lumaliftgainparam.hpp"
#include "doubleparamwidget.hpp"
#include "geometryeditwidget.hpp"
#include "keyframeedit.h"
......@@ -94,6 +95,9 @@ AbstractParamWidget *AbstractParamWidget::construct(const std::shared_ptr<AssetP
case ParamType::Color:
widget = new ColorEditWidget(model, index, parent);
break;
case ParamType::ColorWheel:
widget = new LumaLiftGainParam(model, index, parent);
break;
case ParamType::Animated:
case ParamType::RestrictedAnim:
// widget = new AnimationWidget(model, index, range, parent);
......
/*
* Copyright (c) 2013 Meltytech, LLC
* Author: Dan Dennedy <dan@dennedy.org>
* Some ideas came from Qt-Plus: https://github.com/liuyanghejerry/Qt-Plus
* and Steinar Gunderson's Movit demo app.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "colorwheel.h"
#include <qmath.h>
ColorWheel::ColorWheel(const QString &id, const QString &name, const QColor &color, QWidget *parent)
: QWidget(parent)
, m_id(id)
, m_isMouseDown(false)
, m_margin(5)
, m_color(color)
, m_isInWheel(false)
, m_isInSquare(false)
, m_name(name)
{
QFontInfo info(font());
m_unitSize = info.pixelSize();
m_initialSize = QSize(m_unitSize * 11.5, m_unitSize * 11);
m_sliderWidth = m_unitSize * 1.5;
resize(m_initialSize);
setMinimumSize(100, 100);
setMaximumSize(m_initialSize);
setCursor(Qt::CrossCursor);
}
QColor ColorWheel::color()
{
return m_color;
}
void ColorWheel::setColor(const QColor &color)
{
m_color = color;
}
int ColorWheel::wheelSize() const
{
return qMin(width() - m_sliderWidth, height() - m_unitSize);
}
QColor ColorWheel::colorForPoint(const QPoint &point)
{
if (!m_image.valid(point)) {
return QColor();
}
if (m_isInWheel) {
qreal w = wheelSize();
qreal xf = qreal(point.x()) / w;
qreal yf = 1.0 - qreal(point.y()) / w;
qreal xp = 2.0 * xf - 1.0;
qreal yp = 2.0 * yf - 1.0;
qreal rad = qMin(hypot(xp, yp), 1.0);
qreal theta = qAtan2(yp, xp);
theta -= 105.0 / 360.0 * 2.0 * M_PI;
if (theta < 0.0) {
theta += 2.0 * M_PI;
}
qreal hue = (theta * 180.0 / M_PI) / 360.0;
return QColor::fromHsvF(hue, rad, m_color.valueF());
}
if (m_isInSquare) {
qreal value = 1.0 - qreal(point.y() - m_margin) / (wheelSize() - m_margin * 2);
return QColor::fromHsvF(m_color.hueF(), m_color.saturationF(), value);
}
return QColor();
}
QSize ColorWheel::sizeHint() const
{
return QSize(width(), height());
}
QSize ColorWheel::minimumSizeHint() const
{
return QSize(100, 100);
}
void ColorWheel::mousePressEvent(QMouseEvent *event)
{
m_lastPoint = event->pos();
if (m_wheelRegion.contains(m_lastPoint)) {
m_isInWheel = true;
m_isInSquare = false;
if (event->button() != Qt::MidButton) {
changeColor(colorForPoint(m_lastPoint));
} else {
// reset to default on middle button
qreal r = m_color.redF();
qreal b = m_color.blueF();
qreal g = m_color.greenF();
qreal max = qMax(r, b);
max = qMax(max, g);
changeColor(QColor::fromRgbF(max, max, max));
}
} else if (m_sliderRegion.contains(m_lastPoint)) {
m_isInWheel = false;
m_isInSquare = true;
if (event->button() != Qt::MidButton) {
changeColor(colorForPoint(m_lastPoint));
} else {
QColor c;
if (m_id == QLatin1String("lift")) {
c = QColor::fromRgbF(0, 0, 0);
} else if (m_id == QLatin1String("gamma")) {
c = QColor::fromRgbF(0.5, 0.5, 0.5);
} else {
c = QColor::fromRgbF(0.25, 0.25, 0.25);
}
changeColor(c);
}
}
m_isMouseDown = true;
}
void ColorWheel::mouseMoveEvent(QMouseEvent *event)
{
m_lastPoint = event->pos();
if (!m_isMouseDown) {
return;
}
if (m_wheelRegion.contains(m_lastPoint) && m_isInWheel) {
const QColor color = colorForPoint(m_lastPoint);
changeColor(color);
} else if (m_sliderRegion.contains(m_lastPoint) && m_isInSquare) {
const QColor color = colorForPoint(m_lastPoint);
changeColor(color);
}
}
void ColorWheel::mouseReleaseEvent(QMouseEvent *event)
{
Q_UNUSED(event)
m_isMouseDown = false;
m_isInWheel = false;
m_isInSquare = false;
}
void ColorWheel::resizeEvent(QResizeEvent *event)
{
m_image = QImage(event->size(), QImage::Format_ARGB32_Premultiplied);
m_image.fill(palette().background().color().rgb());
drawWheel();
drawSlider();
update();
}
QString ColorWheel::getParamValues()
{
if (m_id == QLatin1String("gamma")) {
return QString::number(m_color.redF() * 2, 'g', 2) + QLatin1Char(',') + QString::number(m_color.greenF() * 2, 'g', 2) + QLatin1Char(',') +
QString::number(m_color.blueF() * 2, 'g', 2);
}
if (m_id == QLatin1String("gain")) {
return QString::number(m_color.redF() * 4, 'g', 2) + QLatin1Char(',') + QString::number(m_color.greenF() * 4, 'g', 2) + QLatin1Char(',') +
QString::number(m_color.blueF() * 4, 'g', 2);
}
// default (lift)
return QString::number(m_color.redF(), 'g', 2) + QLatin1Char(',') + QString::number(m_color.greenF(), 'g', 2) + QLatin1Char(',') +
QString::number(m_color.blueF(), 'g', 2);
}
void ColorWheel::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event)
QPainter painter(this);
// QStyleOption opt;
// opt.init(this);
painter.setRenderHint(QPainter::Antialiasing);
painter.drawImage(0, 0, m_image);
// painter.drawRect(0, 0, width(), height());
painter.drawText(m_margin, wheelSize() + m_unitSize - m_margin, m_name + QLatin1Char(' ') + getParamValues());
drawWheelDot(painter);
drawSliderBar(painter);
// style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
}
void ColorWheel::drawWheel()
{
int r = wheelSize();
QPainter painter(&m_image);
painter.setRenderHint(QPainter::Antialiasing);
m_image.fill(0); // transparent
QConicalGradient conicalGradient;
conicalGradient.setColorAt(0.0, Qt::red);
conicalGradient.setColorAt(60.0 / 360.0, Qt::yellow);
conicalGradient.setColorAt(135.0 / 360.0, Qt::green);
conicalGradient.setColorAt(180.0 / 360.0, Qt::cyan);
conicalGradient.setColorAt(240.0 / 360.0, Qt::blue);
conicalGradient.setColorAt(315.0 / 360.0, Qt::magenta);
conicalGradient.setColorAt(1.0, Qt::red);
QRadialGradient radialGradient(0.0, 0.0, r / 2);
radialGradient.setColorAt(0.0, Qt::white);
radialGradient.setColorAt(1.0, Qt::transparent);
painter.translate(r / 2, r / 2);
painter.rotate(-105);
QBrush hueBrush(conicalGradient);
painter.setPen(Qt::NoPen);
painter.setBrush(hueBrush);
painter.drawEllipse(QPoint(0, 0), r / 2 - m_margin, r / 2 - m_margin);
QBrush saturationBrush(radialGradient);
painter.setBrush(saturationBrush);
painter.drawEllipse(QPoint(0, 0), r / 2 - m_margin, r / 2 - m_margin);
m_wheelRegion = QRegion(r / 2, r / 2, r - 2 * m_margin, r - 2 * m_margin, QRegion::Ellipse);
m_wheelRegion.translate(-(r - 2 * m_margin) / 2, -(r - 2 * m_margin) / 2);
}
void ColorWheel::drawSlider()
{
QPainter painter(&m_image);
painter.setRenderHint(QPainter::Antialiasing);
int ws = wheelSize();
qreal scale = qreal(ws + m_sliderWidth) / maximumWidth();
int w = m_sliderWidth * scale;
int h = ws - m_margin * 2;
QLinearGradient gradient(0, 0, w, h);
gradient.setColorAt(0.0, Qt::white);
gradient.setColorAt(1.0, Qt::black);
QBrush brush(gradient);
painter.setPen(Qt::NoPen);
painter.setBrush(brush);
painter.translate(ws, m_margin);
painter.drawRect(0, 0, w, h);
m_sliderRegion = QRegion(ws, m_margin, w, h);
}
void ColorWheel::drawWheelDot(QPainter &painter)
{
int r = wheelSize() / 2;
QPen pen(Qt::white);
pen.setWidth(2);
painter.setPen(pen);
painter.setBrush(Qt::black);
painter.translate(r, r);
painter.rotate(360.0 - m_color.hue());
painter.rotate(-105);
// r -= margin;
painter.drawEllipse(QPointF(m_color.saturationF() * r, 0.0), 4, 4);
painter.resetTransform();
}
void ColorWheel::drawSliderBar(QPainter &painter)
{
qreal value = 1.0 - m_color.valueF();
int ws = wheelSize();
qreal scale = qreal(ws + m_sliderWidth) / maximumWidth();
int w = m_sliderWidth * scale;
int h = ws - m_margin * 2;
QPen pen(Qt::white);
pen.setWidth(2);
painter.setPen(pen);
painter.setBrush(Qt::black);
painter.translate(ws, m_margin + value * h);
painter.drawRect(0, 0, w, 4);
painter.resetTransform();
}
void ColorWheel::changeColor(const QColor &color)
{
m_color = color;
drawWheel();
drawSlider();
update();
emit colorChange(m_color);
}
/*
* Copyright (c) 2013 Meltytech, LLC
* Author: Dan Dennedy <dan@dennedy.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COLORWHEELPARAM_H
#define COLORWHEELPARAM_H
#include <QPainter>
#include <QResizeEvent>
#include <QWidget>
class ColorWheel : public QWidget
{
Q_OBJECT
public:
explicit ColorWheel(const QString &id, const QString &name, const QColor &color, QWidget *parent = nullptr);
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
QColor color();
void setColor(const QColor &color);
signals:
void colorChange(const QColor &color);
public slots:
void changeColor(const QColor &color);
protected:
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
void paintEvent(QPaintEvent *event) override;
private:
QString m_id;
QSize m_initialSize;
QImage m_image;
bool m_isMouseDown;
QPoint m_lastPoint;
int m_margin;
int m_sliderWidth;
QRegion m_wheelRegion;
QRegion m_sliderRegion;
QColor m_color;
bool m_isInWheel;
bool m_isInSquare;
int m_unitSize;
QString m_name;
int wheelSize() const;
QColor colorForPoint(const QPoint &point);
void drawWheel();
void drawWheelDot(QPainter &painter);
void drawSliderBar(QPainter &painter);
void drawSlider();
QString getParamValues();
};
#endif // COLORWHEEL_H
/***************************************************************************
* Copyright (C) 2018 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* Some code was borrowed from shotcut *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "lumaliftgainparam.hpp"
#include "assets/model/assetparametermodel.hpp"
#include "colorwheel.h"
#include "utils/flowlayout.h"
#include <KLocalizedString>
static const double GAMMA_FACTOR = 2.0;
static const double GAIN_FACTOR = 4.0;
LumaLiftGainParam::LumaLiftGainParam(std::shared_ptr<AssetParameterModel> model, QModelIndex index, QWidget *parent)
: AbstractParamWidget(std::move(model), index, parent)
{
auto *flowLayout = new FlowLayout(this, 2, 2, 2);
/*QVBoxLayout *layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
*/
m_locale.setNumberOptions(QLocale::OmitGroupSeparator);
m_lift = new ColorWheel(QStringLiteral("lift"), i18n("Lift"), QColor(), this);
connect(m_lift, &ColorWheel::colorChange, this, &LumaLiftGainParam::liftChanged);
m_gamma = new ColorWheel(QStringLiteral("gamma"), i18n("Gamma"), QColor(), this);
connect(m_gamma, &ColorWheel::colorChange, this, &LumaLiftGainParam::gammaChanged);
m_gain = new ColorWheel(QStringLiteral("gain"), i18n("Gain"), QColor(), this);
connect(m_gain, &ColorWheel::colorChange, this, &LumaLiftGainParam::gainChanged);
QMap<QString, QModelIndex> indexes;
for (int i = 0; i < m_model->rowCount(); ++i) {
QModelIndex local_index = m_model->index(i, 0);
QString name = m_model->data(local_index, AssetParameterModel::NameRole).toString();
indexes.insert(name, local_index);
}
flowLayout->addWidget(m_lift);
flowLayout->addWidget(m_gamma);
flowLayout->addWidget(m_gain);
setLayout(flowLayout);
slotRefresh();
connect(this, &LumaLiftGainParam::liftChanged,
[this, indexes]() {
QColor liftColor = m_lift->color();
emit valueChanged(indexes.value(QStringLiteral("lift_r")), m_locale.toString(liftColor.redF()), true);
emit valueChanged(indexes.value(QStringLiteral("lift_g")), m_locale.toString(liftColor.greenF()), true);
emit valueChanged(indexes.value(QStringLiteral("lift_b")), m_locale.toString(liftColor.blueF()), true);
});
connect(this, &LumaLiftGainParam::gammaChanged,
[this, indexes]() {
QColor gammaColor = m_gamma->color();
emit valueChanged(indexes.value(QStringLiteral("gamma_r")), m_locale.toString(gammaColor.redF() * GAMMA_FACTOR), true);
emit valueChanged(indexes.value(QStringLiteral("gamma_g")), m_locale.toString(gammaColor.greenF() * GAMMA_FACTOR), true);
emit valueChanged(indexes.value(QStringLiteral("gamma_b")), m_locale.toString(gammaColor.blueF() * GAMMA_FACTOR), true);
});
connect(this, &LumaLiftGainParam::gainChanged,
[this, indexes]() {
QColor gainColor = m_gain->color();
emit valueChanged(indexes.value(QStringLiteral("gain_r")), m_locale.toString(gainColor.redF()* GAIN_FACTOR), true);
emit valueChanged(indexes.value(QStringLiteral("gain_g")), m_locale.toString(gainColor.greenF()* GAIN_FACTOR), true);
emit valueChanged(indexes.value(QStringLiteral("gain_b")), m_locale.toString(gainColor.blueF()* GAIN_FACTOR), true);
});
}
void LumaLiftGainParam::updateEffect(QDomElement &effect)
{
QColor lift = m_lift->color();
QColor gamma = m_gamma->color();
QColor gain = m_gain->color();
QMap<QString, double> values;
values.insert(QStringLiteral("lift_r"), lift.redF());
values.insert(QStringLiteral("lift_g"), lift.greenF());
values.insert(QStringLiteral("lift_b"), lift.blueF());
values.insert(QStringLiteral("gamma_r"), gamma.redF() * GAMMA_FACTOR);
values.insert(QStringLiteral("gamma_g"), gamma.greenF() * GAMMA_FACTOR);