File indexing completed on 2024-05-12 04:52:54

0001 /*
0002     SPDX-FileCopyrightText: 2018 Jean-Baptiste Mardelle <jb@kdenlive.org>
0003     SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 */
0005 
0006 #pragma once
0007 
0008 #include "abstractparamwidget.hpp"
0009 #include "utils/qcolorutils.h"
0010 #include <QDomElement>
0011 #include <QWidget>
0012 
0013 class ColorWheel;
0014 class FlowLayout;
0015 
0016 /**
0017  * @class LumaLiftGainParam
0018  * @brief Provides options to choose 3 colors.
0019  * @author Jean-Baptiste Mardelle
0020  */
0021 class LumaLiftGainParam : public QWidget
0022 {
0023     Q_OBJECT
0024 public:
0025     /** @brief Sets up the widget.
0026      * @param text (optional) What the color will be used for
0027      * @param color (optional) initial color
0028      * @param alphaEnabled (optional) Should transparent colors be enabled */
0029     explicit LumaLiftGainParam(std::shared_ptr<AssetParameterModel> model, const QModelIndex &index, QWidget *parent);
0030     void updateEffect(QDomElement &effect);
0031     int miniHeight();
0032 
0033 private:
0034     ColorWheel *m_lift;
0035     ColorWheel *m_gamma;
0036     ColorWheel *m_gain;
0037     FlowLayout *m_flowLayout;
0038     std::shared_ptr<AssetParameterModel> m_model;
0039     QPersistentModelIndex m_index;
0040 
0041 protected:
0042     void resizeEvent(QResizeEvent *ev) override;
0043 
0044 Q_SIGNALS:
0045     /** @brief Emitted whenever a different color was chosen. */
0046     void liftChanged(const NegQColor &sourceColor, const NegQColor &color, bool createUndo);
0047     void gammaChanged(const NegQColor &sourceColor, const NegQColor &color, bool createUndo);
0048     void gainChanged(const NegQColor &sourceColor, const NegQColor &color, bool createUndo);
0049     void valuesChanged(const QList<QModelIndex>, const QStringList &, const QStringList &, bool createUndo);
0050     void updateHeight(int height);
0051 
0052 public Q_SLOTS:
0053     /** @brief refresh the properties to reflect changes in the model
0054      */
0055     void slotRefresh(int pos);
0056 };