Commit 0f74f3d1 authored by Nicolas Carion's avatar Nicolas Carion

formatting

parent 55c685bb
......@@ -115,9 +115,8 @@ int main(int argc, char **argv)
for (int i = 0; i < args.count(); ++i) {
if (args.at(i).startsWith(QLatin1String("meta.attr"))) {
QString data = args.at(i);
args.replace(i,
data.section(QLatin1Char('='), 0, 0) + QStringLiteral("=\"") +
QUrl::fromPercentEncoding(data.section(QLatin1Char('='), 1).toUtf8()) + QLatin1Char('\"'));
args.replace(i, data.section(QLatin1Char('='), 0, 0) + QStringLiteral("=\"") +
QUrl::fromPercentEncoding(data.section(QLatin1Char('='), 1).toUtf8()) + QLatin1Char('\"'));
}
}
......
......@@ -22,8 +22,8 @@
#include "xml/xml.hpp"
#include <QDir>
#include <QFile>
#include <QString>
#include <QStandardPaths>
#include <QString>
#include <QTextStream>
#include <locale>
......@@ -31,9 +31,7 @@
#include <xlocale.h>
#endif
template <typename AssetType> AbstractAssetsRepository<AssetType>::AbstractAssetsRepository()
{
}
template <typename AssetType> AbstractAssetsRepository<AssetType>::AbstractAssetsRepository() {}
template <typename AssetType> void AbstractAssetsRepository<AssetType>::init()
{
......
......@@ -166,12 +166,11 @@ QVariantList AssetFilter::getCategories()
QModelIndex AssetFilter::getModelIndex(QModelIndex current)
{
QModelIndex sourceIndex = mapToSource(current);
return sourceIndex;//this returns an integer
return sourceIndex; // this returns an integer
}
QModelIndex AssetFilter::getProxyIndex(QModelIndex current)
{
QModelIndex sourceIndex = mapFromSource(current);
return sourceIndex;//this returns an integer
return sourceIndex; // this returns an integer
}
......@@ -59,7 +59,7 @@ AssetPanel::AssetPanel(QWidget *parent)
m_switchBuiltStack->setCheckable(true);
m_switchBuiltStack->setChecked(KdenliveSettings::showbuiltstack());
m_switchBuiltStack->setVisible(false);
//connect(m_switchBuiltStack, &QToolButton::toggled, m_effectStackWidget, &EffectStackView::switchBuiltStack);
// connect(m_switchBuiltStack, &QToolButton::toggled, m_effectStackWidget, &EffectStackView::switchBuiltStack);
tLayout->addWidget(m_switchBuiltStack);
m_splitButton = new QToolButton(this);
......@@ -112,8 +112,7 @@ void AssetPanel::showTransition(int tid, std::shared_ptr<AssetParameterModel> tr
m_transitionWidget->setModel(transitionModel, QSize(), true);
}
void AssetPanel::showEffectStack(const QString &itemName, std::shared_ptr<EffectStackModel> effectsModel, QSize frameSize,
bool showKeyframes)
void AssetPanel::showEffectStack(const QString &itemName, std::shared_ptr<EffectStackModel> effectsModel, QSize frameSize, bool showKeyframes)
{
if (effectsModel == nullptr) {
// Item is not ready
......
......@@ -101,7 +101,7 @@ bool KeyframeModel::addKeyframe(int frame, double normalizedValue)
if (normalizedValue >= 0.5) {
realValue = norm + (2 * (normalizedValue - 0.5) * (max / factor - norm));
} else {
realValue = norm - pow(2 * (0.5 - normalizedValue), 10.0/6) * (norm - min / factor);
realValue = norm - pow(2 * (0.5 - normalizedValue), 10.0 / 6) * (norm - min / factor);
}
} else {
realValue = (normalizedValue * (max - min) + min) / factor;
......@@ -196,7 +196,7 @@ bool KeyframeModel::moveKeyframe(GenTime oldPos, GenTime pos, double newVal, Fun
if (newVal >= 0.5) {
realValue = norm + (2 * (newVal - 0.5) * (max / factor - norm));
} else {
realValue = norm - pow(2 * (0.5 - newVal), 10.0/6) * (norm - min / factor);
realValue = norm - pow(2 * (0.5 - newVal), 10.0 / 6) * (norm - min / factor);
}
} else {
realValue = (newVal * (max - min) + min) / factor;
......@@ -234,7 +234,7 @@ bool KeyframeModel::offsetKeyframes(int oldPos, int pos, bool logUndo)
QWriteLocker locker(&m_lock);
Fun undo = []() { return true; };
Fun redo = []() { return true; };
QList <GenTime> times;
QList<GenTime> times;
for (const auto &m : m_keyframeList) {
if (m.first < oldFrame) continue;
times << m.first;
......@@ -648,14 +648,14 @@ void KeyframeModel::parseAnimProperty(const QString &prop)
}
QVariant value;
switch (m_paramType) {
case ParamType::AnimatedRect: {
mlt_rect rect = mlt_prop.anim_get_rect("key", frame);
value = QVariant(QStringLiteral("%1 %2 %3 %4 %5").arg(rect.x).arg(rect.y).arg(rect.w).arg(rect.h).arg(rect.o));
break;
}
default:
value = QVariant(mlt_prop.anim_get_double("key", frame));
break;
case ParamType::AnimatedRect: {
mlt_rect rect = mlt_prop.anim_get_rect("key", frame);
value = QVariant(QStringLiteral("%1 %2 %3 %4 %5").arg(rect.x).arg(rect.y).arg(rect.w).arg(rect.h).arg(rect.o));
break;
}
default:
value = QVariant(mlt_prop.anim_get_double("key", frame));
break;
}
addKeyframe(GenTime(frame, pCore->getCurrentFps()), convertFromMltType(type), value, false, undo, redo);
}
......
......@@ -113,7 +113,7 @@ public:
Keyframe getKeyframe(const GenTime &pos, bool *ok) const;
/* @brief Returns true if we only have 1 keyframe
*/
*/
bool singleKeyframe() const;
/* @brief Returns the keyframe located after given position.
If there is a keyframe at given position it is ignored.
......
......@@ -298,7 +298,7 @@ void KeyframeView::paintEvent(QPaintEvent *event)
* Time-"line"
*/
p.setPen(m_colKeyframe);
p.drawLine(0, m_lineHeight + (headOffset / 2), (m_duration -1) * m_scale, m_lineHeight + (headOffset / 2));
p.drawLine(0, m_lineHeight + (headOffset / 2), (m_duration - 1) * m_scale, m_lineHeight + (headOffset / 2));
/*
* current position
......
......@@ -47,7 +47,7 @@ AssetCommand::AssetCommand(std::shared_ptr<AssetParameterModel> model, const QMo
void AssetCommand::undo()
{
m_model->setParameter(m_name, m_oldValue, true, m_index);
//m_model->dataChanged(m_index, m_index, QVector<int>());
// m_model->dataChanged(m_index, m_index, QVector<int>());
}
// virtual
void AssetCommand::redo()
......
......@@ -83,8 +83,7 @@ AssetParameterModel::AssetParameterModel(Mlt::Properties *asset, const QDomEleme
bool isFixed = (type == QLatin1String("fixed"));
if (isFixed) {
m_fixedParams[name] = value;
}
else if (type == QLatin1String("position")) {
} else if (type == QLatin1String("position")) {
int val = value.toInt();
if (val < 0) {
int in = pCore->getItemIn(m_ownerId);
......@@ -147,7 +146,7 @@ void AssetParameterModel::setParameter(const QString &name, const int value, boo
if (update) {
if (m_assetId.startsWith(QStringLiteral("sox_"))) {
// Warning, SOX effect, need unplug/replug
qDebug()<<"// Warning, SOX effect, need unplug/replug";
qDebug() << "// Warning, SOX effect, need unplug/replug";
QStringList effectParam = {m_assetId.section(QLatin1Char('_'), 1)};
for (const QString &pName : m_paramOrder) {
effectParam << m_asset->get(pName.toUtf8().constData());
......@@ -194,7 +193,7 @@ void AssetParameterModel::setParameter(const QString &name, const QString &value
if (update) {
if (m_assetId.startsWith(QStringLiteral("sox_"))) {
// Warning, SOX effect, need unplug/replug
qDebug()<<"// Warning, SOX effect, need unplug/replug";
qDebug() << "// Warning, SOX effect, need unplug/replug";
QStringList effectParam = {m_assetId.section(QLatin1Char('_'), 1)};
for (const QString &pName : m_paramOrder) {
effectParam << m_asset->get(pName.toUtf8().constData());
......@@ -230,7 +229,7 @@ void AssetParameterModel::setParameter(const QString &name, double &value)
}
if (m_assetId.startsWith(QStringLiteral("sox_"))) {
// Warning, SOX effect, need unplug/replug
qDebug()<<"// Warning, SOX effect, need unplug/replug";
qDebug() << "// Warning, SOX effect, need unplug/replug";
QStringList effectParam = {m_assetId.section(QLatin1Char('_'), 1)};
for (const QString &pName : m_paramOrder) {
effectParam << m_asset->get(pName.toUtf8().constData());
......@@ -238,9 +237,9 @@ void AssetParameterModel::setParameter(const QString &name, double &value)
m_asset->set("effect", effectParam.join(QLatin1Char(' ')).toUtf8().constData());
emit replugEffect(shared_from_this());
} else if (m_assetId == QLatin1String("autotrack_rectangle") || m_assetId.startsWith(QStringLiteral("ladspa"))) {
// these effects don't understand param change and need to be rebuild
emit replugEffect(shared_from_this());
} else {
// these effects don't understand param change and need to be rebuild
emit replugEffect(shared_from_this());
} else {
emit modelChanged();
}
pCore->refreshProjectItem(m_ownerId);
......
......@@ -114,7 +114,7 @@ public:
void setParameters(const QVector<QPair<QString, QVariant>> &params);
/* Which monitor is attached to this asset (clip/project)
*/
*/
Kdenlive::MonitorId monitorId;
QVariant data(const QModelIndex &index, int role) const override;
......
......@@ -63,14 +63,14 @@ void AssetParameterView::setModel(const std::shared_ptr<AssetParameterModel> &mo
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)) {
(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, frameSize, this);
connect(this, &AssetParameterView::initKeyframeView, w, &AbstractParamWidget::slotInitMonitor);
if (type == ParamType::KeyframeParam || type == ParamType::AnimatedRect ) {
if (type == ParamType::KeyframeParam || type == ParamType::AnimatedRect) {
m_mainKeyframeWidget = static_cast<KeyframeWidget *>(w);
}
connect(w, &AbstractParamWidget::valueChanged, this, &AssetParameterView::commitChanges);
......@@ -95,8 +95,7 @@ void AssetParameterView::resetValues()
m_model->setParameter(name, defaultValue);
if (m_mainKeyframeWidget) {
// Handles additionnal params like rotation so only refresh initial param at the end
}
else if (type == ParamType::ColorWheel) {
} else 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);
......@@ -156,7 +155,7 @@ void AssetParameterView::refresh(const QModelIndex &topLeft, const QModelIndex &
QMutexLocker lock(&m_lock);
if (m_widgets.size() == 0) {
// no visible param for this asset, abort
qDebug()<<"/// ASKING REFRESH... EMPTY WIDGET";
qDebug() << "/// ASKING REFRESH... EMPTY WIDGET";
return;
}
Q_UNUSED(roles);
......@@ -168,7 +167,8 @@ void AssetParameterView::refresh(const QModelIndex &topLeft, const QModelIndex &
} else {
auto type = m_model->data(m_model->index(bottomRight.row(), 0), AssetParameterModel::TypeRole).value<ParamType>();
if (type == ParamType::ColorWheel) {
// Some special widgets, like colorwheel handle multiple params so we can have cases where param index row is greater than the number of widgets. Should be better managed
// Some special widgets, like colorwheel handle multiple params so we can have cases where param index row is greater than the number of widgets.
// Should be better managed
m_widgets[0]->slotRefresh();
return;
}
......
......@@ -20,15 +20,15 @@
#include "abstractparamwidget.hpp"
#include "assets/model/assetparametermodel.hpp"
#include "boolparamwidget.hpp"
#include "switchparamwidget.hpp"
#include "lumaliftgainparam.hpp"
#include "coloreditwidget.hpp"
#include "doubleparamwidget.hpp"
#include "geometryeditwidget.hpp"
#include "keyframewidget.hpp"
#include "listparamwidget.h"
#include "lumaliftgainparam.hpp"
#include "positioneditwidget.hpp"
#include "coloreditwidget.hpp"
#include "slidewidget.hpp"
#include "switchparamwidget.hpp"
#include "urlparamwidget.hpp"
#include <QLabel>
......
......@@ -41,9 +41,7 @@ BoolParamWidget::BoolParamWidget(std::shared_ptr<AssetParameterModel> model, QMo
slotRefresh();
// emit the signal of the base class when appropriate
connect(this->m_checkBox, &QCheckBox::stateChanged, [this](int) {
emit valueChanged(m_index, QString::number(m_checkBox->isChecked()), true);
});
connect(this->m_checkBox, &QCheckBox::stateChanged, [this](int) { emit valueChanged(m_index, QString::number(m_checkBox->isChecked()), true); });
}
void BoolParamWidget::slotShowComment(bool show)
......
......@@ -53,7 +53,6 @@ public slots:
/** @brief refresh the properties to reflect changes in the model
*/
void slotRefresh() override;
};
#endif
......@@ -18,8 +18,8 @@
***************************************************************************/
#include "coloreditwidget.hpp"
#include "widgets/colorpickerwidget.h"
#include "assets/model/assetparametermodel.hpp"
#include "widgets/colorpickerwidget.h"
#include <QHBoxLayout>
#include <QLabel>
......@@ -37,9 +37,9 @@ static QColor stringToColor(QString strColor)
// 0xRRGGBBAA
intval = strColor.toUInt(&ok, 16);
color.setRgb((int)((intval >> 24) & 0xff), // r
(intval >> 16) & 0xff, // g
(intval >> 8) & 0xff, // b
intval & 0xff); // a
(intval >> 16) & 0xff, // g
(intval >> 8) & 0xff, // b
intval & 0xff); // a
} else {
// 0xRRGGBB, 0xRGB
color.setNamedColor(strColor.replace(0, 2, QLatin1Char('#')));
......@@ -49,9 +49,9 @@ static QColor stringToColor(QString strColor)
// #AARRGGBB
strColor = strColor.replace('#', QLatin1String("0x"));
intval = strColor.toUInt(&ok, 16);
color.setRgb((intval >> 16) & 0xff, // r
(intval >> 8) & 0xff, // g
intval&0xff, // b
color.setRgb((intval >> 16) & 0xff, // r
(intval >> 8) & 0xff, // g
intval & 0xff, // b
(int)((intval >> 24) & 0xff)); // a
} else if (strColor.length() == 8) {
// 0xRRGGBB
......@@ -130,13 +130,11 @@ ColorEditWidget::ColorEditWidget(std::shared_ptr<AssetParameterModel> model, QMo
setToolTip(comment);
}
void ColorEditWidget::slotShowComment(bool )
{
}
void ColorEditWidget::slotShowComment(bool) {}
void ColorEditWidget::slotRefresh()
{
QString color = m_model->data(m_index, AssetParameterModel::ValueRole).toString();
QString color = m_model->data(m_index, AssetParameterModel::ValueRole).toString();
m_button->setColor(stringToColor(color));
}
......
......@@ -37,7 +37,7 @@ class ColorEditWidget : public AbstractParamWidget
Q_OBJECT
public:
/** @brief Sets up the widget.
*/
*/
explicit ColorEditWidget(std::shared_ptr<AssetParameterModel> model, QModelIndex index, QWidget *parent);
/** @brief Gets the chosen color. */
......
......@@ -72,4 +72,3 @@ void DoubleParamWidget::slotShowComment(bool show)
{
m_doubleWidget->slotShowComment(show);
}
......@@ -20,13 +20,13 @@
***************************************************************************/
#include "geometryeditwidget.hpp"
#include "kdenlivesettings.h"
#include "timecodedisplay.h"
#include "assets/model/assetparametermodel.hpp"
#include "core.h"
#include "kdenlivesettings.h"
#include "monitor/monitor.h"
#include "widgets/geometrywidget.h"
#include "monitor/monitormanager.h"
#include "assets/model/assetparametermodel.hpp"
#include "timecodedisplay.h"
#include "widgets/geometrywidget.h"
#include <mlt++/MltGeometry.h>
#include <QHBoxLayout>
......@@ -51,20 +51,18 @@ GeometryEditWidget::GeometryEditWidget(std::shared_ptr<AssetParameterModel> mode
rect = QRect(50, 50, 200, 200);
}
Monitor *monitor = pCore->getMonitor(m_model->monitorId);
m_geom = new GeometryWidget(monitor, QPair<int, int>(start, end), rect, frameSize, false, m_model->data(m_index, AssetParameterModel::OpacityRole).toBool(), this);
m_geom = new GeometryWidget(monitor, QPair<int, int>(start, end), rect, frameSize, false, m_model->data(m_index, AssetParameterModel::OpacityRole).toBool(),
this);
m_geom->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred));
layout->addWidget(m_geom);
// emit the signal of the base class when appropriate
connect(this->m_geom, &GeometryWidget::valueChanged, [this](const QString val) {
emit valueChanged(m_index, val, true); });
connect(this->m_geom, &GeometryWidget::valueChanged, [this](const QString val) { emit valueChanged(m_index, val, true); });
setToolTip(comment);
}
GeometryEditWidget::~GeometryEditWidget()
{
}
GeometryEditWidget::~GeometryEditWidget() {}
void GeometryEditWidget::slotRefresh()
{
......@@ -73,7 +71,7 @@ void GeometryEditWidget::slotRefresh()
QStringList vals = value.split(QLatin1Char(' '));
int start = m_model->data(m_index, AssetParameterModel::ParentInRole).toInt();
int end = start + m_model->data(m_index, AssetParameterModel::ParentDurationRole).toInt();
m_geom->slotSetRange(QPair <int, int>(start, end));
m_geom->slotSetRange(QPair<int, int>(start, end));
if (vals.count() >= 4) {
rect = QRect(vals.at(0).toInt(), vals.at(1).toInt(), vals.at(2).toInt(), vals.at(3).toInt());
m_geom->setValue(rect);
......@@ -101,7 +99,7 @@ void GeometryEditWidget::monitorSeek(int pos)
void GeometryEditWidget::slotInitMonitor(bool active)
{
m_geom->connectMonitor(active);
Monitor * monitor = pCore->getMonitor(m_model->monitorId);
Monitor *monitor = pCore->getMonitor(m_model->monitorId);
if (active) {
monitor->setEffectKeyframe(true);
connect(monitor, &Monitor::seekPosition, this, &GeometryEditWidget::monitorSeek, Qt::UniqueConnection);
......
......@@ -145,7 +145,7 @@ private slots:
void slotAdjustKeyframePos(int value);
void slotAdjustKeyframeValue(double value);
/** @brief Turns the seek to keyframe position setting on/off.
* @param seek true = seeking on */
* @param seek true = seeking on */
void slotSetSeeking(bool seek);
/** @brief Shows the keyframe table and adds a second keyframe. */
......
......@@ -79,7 +79,7 @@ KeyframeWidget::KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QMode
curve->setCheckable(true);
m_selectType->addAction(curve);
m_selectType->setCurrentAction(linear);
connect(m_selectType, static_cast<void(KSelectAction::*)(QAction*)>(&KSelectAction::triggered), this, &KeyframeWidget::slotEditKeyframeType);
connect(m_selectType, static_cast<void (KSelectAction::*)(QAction *)>(&KSelectAction::triggered), this, &KeyframeWidget::slotEditKeyframeType);
m_selectType->setToolBarMode(KSelectAction::ComboBoxMode);
QToolBar *toolbar = new QToolBar(this);
......@@ -248,7 +248,8 @@ void KeyframeWidget::addParameter(const QPersistentModelIndex &index)
if (vals.count() >= 4) {
rect = QRect(vals.at(0).toInt(), vals.at(1).toInt(), vals.at(2).toInt(), vals.at(3).toInt());
}
GeometryWidget *geomWidget = new GeometryWidget(pCore->getMonitor(m_model->monitorId), range, rect, frameSize, false, m_model->data(m_index, AssetParameterModel::OpacityRole).toBool(), this);
GeometryWidget *geomWidget = new GeometryWidget(pCore->getMonitor(m_model->monitorId), range, rect, frameSize, false,
m_model->data(m_index, AssetParameterModel::OpacityRole).toBool(), this);
connect(geomWidget, &GeometryWidget::valueChanged,
[this, index](const QString v) { m_keyframes->updateKeyframe(GenTime(getPosition(), pCore->getCurrentFps()), QVariant(v), index); });
paramWidget = geomWidget;
......
......@@ -79,7 +79,6 @@ private:
TimecodeDisplay *m_time;
void connectMonitor(bool active);
std::unordered_map<QPersistentModelIndex, QWidget *> m_parameters;
};
#endif
......@@ -82,7 +82,6 @@ public slots:
/** @brief refresh the properties to reflect changes in the model
*/
void slotRefresh() override;
};
#endif
......@@ -56,27 +56,24 @@ LumaLiftGainParam::LumaLiftGainParam(std::shared_ptr<AssetParameterModel> model,
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);
});
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)
......@@ -110,13 +107,11 @@ void LumaLiftGainParam::updateEffect(QDomElement &effect)
}
}
void LumaLiftGainParam::slotShowComment(bool )
{
}
void LumaLiftGainParam::slotShowComment(bool) {}
void LumaLiftGainParam::slotRefresh()
{
qDebug()<<"//REFRESHING WIDGET START--------------__";
qDebug() << "//REFRESHING WIDGET START--------------__";
QMap<QString, double> values;
for (int i = 0; i < m_model->rowCount(); ++i) {
QModelIndex local_index = m_model->index(i, 0);
......@@ -130,9 +125,9 @@ void LumaLiftGainParam::slotRefresh()
values.value(QStringLiteral("gamma_b")) / GAMMA_FACTOR);
QColor gain = QColor::fromRgbF(values.value(QStringLiteral("gain_r")) / GAIN_FACTOR, values.value(QStringLiteral("gain_g")) / GAIN_FACTOR,
values.value(QStringLiteral("gain_b")) / GAIN_FACTOR);
qDebug()<<"//REFRESHING WIDGET START 2--------------__";
qDebug() << "//REFRESHING WIDGET START 2--------------__";
m_lift->setColor(lift);
m_gamma->setColor(gamma);
m_gain->setColor(gain);
qDebug()<<"//REFRESHING WIDGET START DONE--------------__";
qDebug() << "//REFRESHING WIDGET START DONE--------------__";
}
......@@ -38,9 +38,9 @@ class LumaLiftGainParam : public AbstractParamWidget
Q_OBJECT
public:
/** @brief Sets up the widget.
* @param text (optional) What the color will be used for
* @param color (optional) initial color
* @param alphaEnabled (optional) Should transparent colors be enabled */
* @param text (optional) What the color will be used for
* @param color (optional) initial color
* @param alphaEnabled (optional) Should transparent colors be enabled */
explicit LumaLiftGainParam(std::shared_ptr<AssetParameterModel> model, QModelIndex index, QWidget *parent);
void updateEffect(QDomElement &effect);
......@@ -64,7 +64,6 @@ public slots:
/** @brief refresh the properties to reflect changes in the model
*/
void slotRefresh() override;
};
#endif
......@@ -16,11 +16,11 @@
***************************************************************************/
#include "positioneditwidget.hpp"
#include "kdenlivesettings.h"
#include "timecodedisplay.h"
#include "assets/model/assetparametermodel.hpp"
#include "core.h"
#include "kdenlivesettings.h"
#include "monitor/monitormanager.h"
#include "assets/model/assetparametermodel.hpp"
#include "timecodedisplay.h"
#include <QHBoxLayout>
#include <QLabel>
......@@ -51,18 +51,19 @@ PositionEditWidget::PositionEditWidget(std::shared_ptr<AssetParameterModel> mode
// emit the signal of the base class when appropriate
connect(this->m_slider, &QAbstractSlider::valueChanged, [this](int val) {
if (m_inverted) { val = m_model->data(m_index, AssetParameterModel::ParentInRole).toInt() + m_model->data(m_index, AssetParameterModel::ParentDurationRole).toInt() - val;
if (m_inverted) {
val = m_model->data(m_index, AssetParameterModel::ParentInRole).toInt() + m_model->data(m_index, AssetParameterModel::ParentDurationRole).toInt() -
val;
} else if (!m_model->data(m_index, AssetParameterModel::RelativePosRole).toBool()) {
val += m_model->data(m_index, AssetParameterModel::ParentInRole).toInt();
}
emit AbstractParamWidget::valueChanged(m_index, QString::number(val), true); });
emit AbstractParamWidget::valueChanged(m_index, QString::number(val), true);
});
setToolTip(comment);
}
PositionEditWidget::~PositionEditWidget()
{
}
PositionEditWidget::~PositionEditWidget() {}
void PositionEditWidget::updateTimecodeFormat()
{
......@@ -98,13 +99,13 @@ void PositionEditWidget::slotRefresh()
if (value.isNull()) {
val = m_model->data(m_index, AssetParameterModel::DefaultRole).toInt();
if (m_inverted) {
val = - val;
val = -val;
}
} else {
val = value.toInt();
if (m_inverted) {
if (val < 0) {
val = - val;
val = -val;