Commit 3b9d8bfd authored by Vincent Pinon's avatar Vincent Pinon
Browse files

Manually fix clazy warnings

parent d265f635
Pipeline #28060 passed with stage
in 16 minutes and 9 seconds
......@@ -29,7 +29,6 @@ int main(int argc, char **argv)
QApplication app(argc, argv);
QStringList args = app.arguments();
QStringList preargs;
QString locale;
if (args.count() >= 4) {
// Remove program name
args.removeFirst();
......@@ -92,7 +91,7 @@ int main(int argc, char **argv)
QLocale::setDefault(QLocale(localename));
for (const QString &frame : qAsConst(chunks)) {
fprintf(stderr, "START:%d \n", frame.toInt());
QString fileName = QStringLiteral("%1.%2").arg(frame).arg(extension);
QString fileName = QStringLiteral("%1.%2").arg(frame,extension);
if (baseFolder.exists(fileName)) {
// Don't overwrite an existing file
fprintf(stderr, "DONE:%d \n", frame.toInt());
......
......@@ -68,7 +68,7 @@ AssetPanel::AssetPanel(QWidget *parent)
for (const auto &transition : qAsConst(allTransitions)) {
m_switchCompoButton->addItem(transition.second, transition.first);
}
connect(m_switchCompoButton, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), [&]() {
connect(m_switchCompoButton, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, [&]() {
if (m_transitionWidget->stackOwner().first == ObjectType::TimelineComposition) {
emit switchCurrentComposition(m_transitionWidget->stackOwner().second, m_switchCompoButton->currentData().toString());
}
......@@ -141,7 +141,7 @@ AssetPanel::AssetPanel(QWidget *parent)
connect(m_effectStackWidget, &EffectStackView::seekToPos, this, &AssetPanel::seekToPos);
connect(m_effectStackWidget, &EffectStackView::reloadEffect, this, &AssetPanel::reloadEffect);
connect(m_transitionWidget, &TransitionStackView::seekToTransPos, this, &AssetPanel::seekToPos);
connect(m_effectStackWidget, &EffectStackView::updateEnabledState, [this]() { m_enableStackButton->setActive(m_effectStackWidget->isStackEnabled()); });
connect(m_effectStackWidget, &EffectStackView::updateEnabledState, this, [this]() { m_enableStackButton->setActive(m_effectStackWidget->isStackEnabled()); });
}
void AssetPanel::showTransition(int tid, const std::shared_ptr<AssetParameterModel> &transitionModel)
......@@ -217,7 +217,7 @@ void AssetPanel::showEffectStack(const QString &itemName, const std::shared_ptr<
m_enableStackButton->setActive(effectsModel->isStackEnabled());
if (showSplit) {
m_splitButton->setEnabled(effectsModel->rowCount() > 0);
QObject::connect(effectsModel.get(), &EffectStackModel::dataChanged, [&]() {
QObject::connect(effectsModel.get(), &EffectStackModel::dataChanged, this, [&]() {
if (m_effectStackWidget->isEmpty()) {
m_splitButton->setActive(false);
}
......@@ -394,7 +394,7 @@ void AssetPanel::enableStack(bool enable)
void AssetPanel::deleteCurrentEffect()
{
if (m_effectStackWidget->isVisible()) {
m_effectStackWidget->removeCurrentEffect();
emit m_effectStackWidget->removeCurrentEffect();
}
}
......@@ -414,7 +414,7 @@ void AssetPanel::slotCheckWheelEventFilter()
// widget has scroll bar,
blockWheel = true;
}
m_effectStackWidget->blockWheenEvent(blockWheel);
emit m_effectStackWidget->blockWheenEvent(blockWheel);
}
void AssetPanel::assetPanelWarning(const QString service, const QString /*id*/, const QString message)
......
......@@ -51,7 +51,6 @@ void CornersHelper::slotUpdateFromMonitorData(const QVariantList &v)
void CornersHelper::refreshParams(int pos)
{
QVariantList points{QPointF(), QPointF(), QPointF(), QPointF()};
QList<double> coords;
QSize frameSize = pCore->getCurrentFrameSize();
for (const auto &ix : qAsConst(m_indexes)) {
auto type = m_model->data(ix, AssetParameterModel::TypeRole).value<ParamType>();
......
......@@ -862,7 +862,6 @@ void KeyframeModel::parseRotoProperty(const QString &prop)
QJsonDocument doc = QJsonDocument::fromJson(prop.toLatin1(), &jsonError);
QVariant data = doc.toVariant();
if (data.canConvert(QVariant::Map)) {
QList<int> keyframes;
QMap<QString, QVariant> map = data.toMap();
QMap<QString, QVariant>::const_iterator i = map.constBegin();
while (i != map.constEnd()) {
......
......@@ -217,7 +217,7 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
}
qDebug() << "END parsing of " << assetId << ". Number of found parameters" << m_rows.size();
emit modelChanged();
modelChanged();
}
void AssetParameterModel::prepareKeyframes()
......
......@@ -58,7 +58,7 @@ void AssetParameterView::setModel(const std::shared_ptr<AssetParameterModel> &mo
const QString paramTag = model->getAssetId();
QDir dir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QStringLiteral("/effects/presets/"));
const QString presetFile = dir.absoluteFilePath(QString("%1.json").arg(paramTag));
connect(this, &AssetParameterView::updatePresets, [this, presetFile](const QString &presetName) {
connect(this, &AssetParameterView::updatePresets, this, [this, presetFile](const QString &presetName) {
m_presetMenu->clear();
m_presetGroup.reset(new QActionGroup(this));
m_presetGroup->setExclusive(true);
......@@ -92,7 +92,7 @@ void AssetParameterView::setModel(const std::shared_ptr<AssetParameterModel> &mo
connect(w, &AbstractParamWidget::valuesChanged, this, &AssetParameterView::commitMultipleChanges);
connect(w, &AbstractParamWidget::valueChanged, this, &AssetParameterView::commitChanges);
m_lay->addWidget(w);
connect(w, &AbstractParamWidget::updateHeight, [&](int h) {
connect(w, &AbstractParamWidget::updateHeight, this, [&](int h) {
setFixedHeight(h + m_lay->contentsMargins().bottom());
emit updateHeight();
});
......@@ -113,7 +113,7 @@ void AssetParameterView::setModel(const std::shared_ptr<AssetParameterModel> &mo
connect(w, &AbstractParamWidget::valueChanged, this, &AssetParameterView::commitChanges);
connect(w, &AbstractParamWidget::seekToPos, this, &AssetParameterView::seekToPos);
connect(w, &AbstractParamWidget::activateEffect, this, &AssetParameterView::activateEffect);
connect(w, &AbstractParamWidget::updateHeight, [&]() {
connect(w, &AbstractParamWidget::updateHeight, this, [&]() {
setFixedHeight(contentHeight());
emit updateHeight();
});
......
......@@ -94,6 +94,9 @@ protected:
QMenu *m_presetMenu;
std::shared_ptr<QActionGroup> m_presetGroup;
private:
QVector<QPair<QString, QVariant>> getDefaultValues() const;
private slots:
/** @brief Apply a change of parameter sent by the view
@param index is the index corresponding to the modified param
......@@ -102,7 +105,6 @@ private slots:
*/
void commitChanges(const QModelIndex &index, const QString &value, bool storeUndo);
void commitMultipleChanges(const QList <QModelIndex> indexes, const QStringList &values, bool storeUndo);
QVector<QPair<QString, QVariant>> getDefaultValues() const;
signals:
void seekToPos(int);
......
......@@ -41,7 +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 state) {
connect(this->m_checkBox, &QCheckBox::stateChanged, this, [this](int state) {
emit valueChanged(m_index, QString::number(state), true); });
}
......
......@@ -89,7 +89,7 @@ ButtonParamWidget::ButtonParamWidget(std::shared_ptr<AssetParameterModel> model,
setMinimumHeight(m_button->sizeHint().height() + (m_label != nullptr ? m_label->sizeHint().height() : 0));
// emit the signal of the base class when appropriate
connect(this->m_button, &QPushButton::clicked, [&, filterData, filterAddedParams, consumerParams]() {
connect(this->m_button, &QPushButton::clicked, this, [&, filterData, filterAddedParams, consumerParams]() {
// Trigger job
if (!m_displayConditional) {
QVector<QPair<QString, QVariant>> values;
......@@ -133,7 +133,7 @@ ButtonParamWidget::ButtonParamWidget(std::shared_ptr<AssetParameterModel> model,
fParams.insert({fparam.section(QLatin1Char('='), 0, 0), fparam.section(QLatin1Char('='), 1)});
}
}
pCore->jobManager()->startJob<FilterClipJob>({binId}, -1, QString(), owner, m_model, assetId, in, out, assetId, fParams, fData, consumerParams);
emit pCore->jobManager()->startJob<FilterClipJob>({binId}, -1, QString(), owner, m_model, assetId, in, out, assetId, fParams, fData, consumerParams);
if (m_label) {
m_label->setVisible(false);
}
......
......@@ -38,7 +38,6 @@ ClickableLabelParamWidget::ClickableLabelParamWidget(std::shared_ptr<AssetParame
{
// setup the comment
m_displayName = m_model->data(m_index, Qt::DisplayRole).toString();
QString name = m_model->data(m_index, AssetParameterModel::NameRole).toString();
QString comment = m_model->data(m_index, AssetParameterModel::CommentRole).toString();
setToolTip(comment);
auto *layout = new QHBoxLayout(this);
......@@ -50,12 +49,12 @@ ClickableLabelParamWidget::ClickableLabelParamWidget(std::shared_ptr<AssetParame
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(m_tb);
layout->addWidget(m_label);
connect(m_tb, &QToolButton::clicked, [&]() {
connect(m_tb, &QToolButton::clicked, this, [&]() {
QClipboard *clipboard = QApplication::clipboard();
QString value = m_model->data(m_index, AssetParameterModel::ValueRole).toString();
clipboard->setText(value);
});
connect(m_label, &QLabel::linkActivated, [&](const QString &result) {
connect(m_label, &QLabel::linkActivated, this, [&](const QString &result) {
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(result);
});
......
......@@ -519,7 +519,7 @@ ColorWheel::ColorWheel(QString id, QString name, NegQColor color, QWidget *paren
hb->setContentsMargins(0, 0, 0, 0);
lay->addLayout(hb);
m_container->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
connect(m_container, &WheelContainer::colorChange, [&] (const NegQColor &col) {
connect(m_container, &WheelContainer::colorChange, this, [&] (const NegQColor &col) {
QList <double> vals = m_container->getNiceParamValues();
m_redEdit->blockSignals(true);
m_greenEdit->blockSignals(true);
......@@ -532,13 +532,13 @@ ColorWheel::ColorWheel(QString id, QString name, NegQColor color, QWidget *paren
m_blueEdit->blockSignals(false);
emit colorChange(col);
});
connect(m_redEdit, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), [&]() {
connect(m_redEdit, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), this, [&]() {
m_container->setRedColor(m_redEdit->value());
});
connect(m_greenEdit, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), [&]() {
connect(m_greenEdit, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), this, [&]() {
m_container->setGreenColor(m_greenEdit->value());
});
connect(m_blueEdit, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), [&]() {
connect(m_blueEdit, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), this, [&]() {
m_container->setBlueColor(m_blueEdit->value());
});
setMinimumHeight(m_wheelName->height() + m_container->minimumHeight() + m_redEdit->height());
......@@ -555,7 +555,6 @@ NegQColor ColorWheel::color() const
void ColorWheel::setColor(QList<double> values)
{
m_container->setColor(values);
QList <double> vals = m_container->getNiceParamValues();
m_redEdit->blockSignals(true);
m_greenEdit->blockSignals(true);
m_blueEdit->blockSignals(true);
......
......@@ -49,7 +49,7 @@ DoubleParamWidget::DoubleParamWidget(std::shared_ptr<AssetParameterModel> model,
setMinimumHeight(m_doubleWidget->height());
// Connect signal
connect(m_doubleWidget, &DoubleWidget::valueChanged, [this](double val) { emit valueChanged(m_index, QString::number(val, 'f'), true); });
connect(m_doubleWidget, &DoubleWidget::valueChanged, this, [this](double val) { emit valueChanged(m_index, QString::number(val, 'f'), true); });
slotRefresh();
}
......
......@@ -38,7 +38,7 @@ FontParamWidget::FontParamWidget(std::shared_ptr<AssetParameterModel> model, QMo
slotRefresh();
setMinimumHeight(fontfamilywidget->sizeHint().height());
// emit the signal of the base class when appropriate
connect(this->fontfamilywidget, &QFontComboBox::currentFontChanged, [this](const QFont &font) { emit valueChanged(m_index, font.family(), true); });
connect(this->fontfamilywidget, &QFontComboBox::currentFontChanged, this, [this](const QFont &font) { emit valueChanged(m_index, font.family(), true); });
}
void FontParamWidget::slotShowComment(bool show)
......
......@@ -57,7 +57,7 @@ GeometryEditWidget::GeometryEditWidget(std::shared_ptr<AssetParameterModel> mode
setFixedHeight(m_geom->sizeHint().height());
// 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, [this](const QString val) { emit valueChanged(m_index, val, true); });
setToolTip(comment);
}
......
......@@ -372,7 +372,6 @@ void KeyframeImport::updateDestinationRange()
m_destMin.setEnabled(true);
m_destMax.setEnabled(true);
m_limitRange->setEnabled(true);
QString tag = m_targetCombo->currentData().toString();
double min = m_model->data(m_targetCombo->currentData().toModelIndex(), AssetParameterModel::MinRole).toDouble();
double max = m_model->data(m_targetCombo->currentData().toModelIndex(), AssetParameterModel::MaxRole).toDouble();
m_destMin.setRange(min, max);
......
......@@ -143,7 +143,7 @@ KeyframeWidget::KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QMode
break;
}
connect(kfType, static_cast<void (KSelectAction::*)(QAction *)>(&KSelectAction::triggered),
[&](QAction *ac) { KdenliveSettings::setDefaultkeyframeinterp(ac->data().toInt()); });
this, [&](QAction *ac) { KdenliveSettings::setDefaultkeyframeinterp(ac->data().toInt()); });
auto *container = new QMenu(this);
container->addAction(copy);
container->addAction(paste);
......@@ -164,8 +164,8 @@ KeyframeWidget::KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QMode
m_lay->addWidget(m_toolbar);
monitorSeek(monitor->position());
connect(m_time, &TimecodeDisplay::timeCodeEditingFinished, [&]() { slotSetPosition(-1, true); });
connect(m_keyframeview, &KeyframeView::seekToPos, [&](int p) { slotSetPosition(p, true); });
connect(m_time, &TimecodeDisplay::timeCodeEditingFinished, this, [&]() { slotSetPosition(-1, true); });
connect(m_keyframeview, &KeyframeView::seekToPos, this, [&](int p) { slotSetPosition(p, true); });
connect(m_keyframeview, &KeyframeView::atKeyframe, this, &KeyframeWidget::slotAtKeyframe);
connect(m_keyframeview, &KeyframeView::modified, this, &KeyframeWidget::slotRefreshParams);
connect(m_keyframeview, &KeyframeView::activateEffect, this, &KeyframeWidget::activateEffect);
......@@ -210,7 +210,7 @@ void KeyframeWidget::slotEditKeyframeType(QAction *action)
{
int type = action->data().toInt();
m_keyframeview->slotEditType(type, m_index);
activateEffect();
emit activateEffect();
}
void KeyframeWidget::slotRefreshParams()
......@@ -356,8 +356,8 @@ void KeyframeWidget::addParameter(const QPersistentModelIndex &index)
GeometryWidget *geomWidget = new GeometryWidget(pCore->getMonitor(m_model->monitorId), range, rect, opacity, m_sourceFrameSize, false,
m_model->data(m_index, AssetParameterModel::OpacityRole).toBool(), integerOpacity, this);
connect(geomWidget, &GeometryWidget::valueChanged,
[this, index](const QString v) {
activateEffect();
this, [this, index](const QString v) {
emit activateEffect();
m_keyframes->updateKeyframe(GenTime(getPosition(), pCore->getCurrentFps()), QVariant(v), index); });
paramWidget = geomWidget;
} else if (type == ParamType::Roto_spline) {
......@@ -390,8 +390,8 @@ void KeyframeWidget::addParameter(const QPersistentModelIndex &index)
factor = qFuzzyIsNull(factor) ? 1 : factor;
auto doubleWidget = new DoubleWidget(name, value, min, max, factor, defaultValue, comment, -1, suffix, decimals, m_model->data(index, AssetParameterModel::OddRole).toBool(), this);
connect(doubleWidget, &DoubleWidget::valueChanged,
[this, index](double v) {
activateEffect();
this, [this, index](double v) {
emit activateEffect();
m_keyframes->updateKeyframe(GenTime(getPosition(), pCore->getCurrentFps()), QVariant(v), index);
});
paramWidget = doubleWidget;
......@@ -432,7 +432,7 @@ void KeyframeWidget::connectMonitor(bool active)
void KeyframeWidget::slotUpdateKeyframesFromMonitor(const QPersistentModelIndex &index, const QVariant &res)
{
activateEffect();
emit activateEffect();
if (m_keyframes->isEmpty()) {
GenTime pos(pCore->getItemIn(m_model->getOwnerId()) + m_time->getValue(), pCore->getCurrentFps());
if (m_time->getValue() > 0) {
......
......@@ -28,7 +28,6 @@ KeywordParamWidget::KeywordParamWidget(std::shared_ptr<AssetParameterModel> mode
setupUi(this);
// setup the comment
QString name = m_model->data(m_index, AssetParameterModel::NameRole).toString();
QString comment = m_model->data(m_index, AssetParameterModel::CommentRole).toString();
setToolTip(comment);
......@@ -53,11 +52,11 @@ KeywordParamWidget::KeywordParamWidget(std::shared_ptr<AssetParameterModel> mode
setMinimumHeight(comboboxwidget->sizeHint().height());
// emit the signal of the base class when appropriate
connect(lineeditwidget, &QLineEdit::editingFinished, [this]() {
connect(lineeditwidget, &QLineEdit::editingFinished, this, [this]() {
emit valueChanged(m_index, lineeditwidget->text(), true);
});
connect(comboboxwidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
[this](int ix) {
this, [this](int ix) {
if (ix > 0) {
QString comboval = comboboxwidget->itemData(ix).toString();
this->lineeditwidget->insert(comboval);
......
......@@ -30,7 +30,6 @@ ListParamWidget::ListParamWidget(std::shared_ptr<AssetParameterModel> model, QMo
setupUi(this);
// Get data from model
QString name = m_model->data(m_index, AssetParameterModel::NameRole).toString();
QString comment = m_model->data(m_index, AssetParameterModel::CommentRole).toString();
// setup the comment
......@@ -47,7 +46,7 @@ ListParamWidget::ListParamWidget(std::shared_ptr<AssetParameterModel> model, QMo
// emit the signal of the base class when appropriate
// The connection is ugly because the signal "currentIndexChanged" is overloaded in QComboBox
connect(this->m_list, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
[this](int) {
this, [this](int) {
emit valueChanged(m_index, m_list->itemData(m_list->currentIndex()).toString(), true);
});
}
......
......@@ -51,7 +51,7 @@ PositionEditWidget::PositionEditWidget(std::shared_ptr<AssetParameterModel> mode
connect(m_slider, &QAbstractSlider::valueChanged, this, &PositionEditWidget::valueChanged);
// emit the signal of the base class when appropriate
connect(this->m_slider, &QAbstractSlider::valueChanged, [this](int val) {
connect(this->m_slider, &QAbstractSlider::valueChanged, this, [this](int val) {
if (m_inverted) {
val = m_model->data(m_index, AssetParameterModel::ParentInRole).toInt() + m_model->data(m_index, AssetParameterModel::ParentDurationRole).toInt() - 1 -
val;
......
......@@ -25,7 +25,6 @@ SlideWidget::SlideWidget(std::shared_ptr<AssetParameterModel> model, QModelIndex
{
// setup the comment
setupUi(this);
QString name = m_model->data(m_index, AssetParameterModel::NameRole).toString();
QString comment = m_model->data(m_index, AssetParameterModel::CommentRole).toString();
slotRefresh();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment