Commit 4bb8959e authored by Nicolas Carion's avatar Nicolas Carion

[MAINTENANCE] clang format + remove most warnings + update test libs

parent 5c995c64
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
#include "sampleplugin.h" #include "sampleplugin.h"
#include "ui_countdown_ui.h" #include "ui_countdown_ui.h"
#include <QDebug>
#include <KMessageBox> #include <KMessageBox>
#include <QDebug>
#include <QDialog> #include <QDialog>
#include <QProcess> #include <QProcess>
...@@ -38,7 +38,8 @@ QStringList SamplePlugin::generators(const QStringList &producers) const ...@@ -38,7 +38,8 @@ QStringList SamplePlugin::generators(const QStringList &producers) const
return result; return result;
} }
QUrl SamplePlugin::generatedClip(const QString &renderer, const QString &generator, const QUrl &projectFolder, const QStringList &/*lumaNames*/, const QStringList &/*lumaFiles*/, const double fps, const int /*width*/, const int height) QUrl SamplePlugin::generatedClip(const QString &renderer, const QString &generator, const QUrl &projectFolder, const QStringList & /*lumaNames*/,
const QStringList & /*lumaFiles*/, const double fps, const int /*width*/, const int height)
{ {
QString prePath; QString prePath;
if (generator == i18n("Noise")) { if (generator == i18n("Noise")) {
...@@ -80,12 +81,12 @@ QUrl SamplePlugin::generatedClip(const QString &renderer, const QString &generat ...@@ -80,12 +81,12 @@ QUrl SamplePlugin::generatedClip(const QString &renderer, const QString &generat
generatorProcess.setProcessEnvironment(env); generatorProcess.setProcessEnvironment(env);
QStringList args; QStringList args;
if (generator == i18n("Noise")) { if (generator == i18n("Noise")) {
args << QLatin1String("noise:") << QLatin1String("in=0") << QLatin1String("out=") + QString::number((int) fps * view.duration->value()); args << QLatin1String("noise:") << QLatin1String("in=0") << QLatin1String("out=") + QString::number((int)fps * view.duration->value());
} else { } else {
// Countdown producer // Countdown producer
for (int i = 0; i < view.duration->value(); ++i) { for (int i = 0; i < view.duration->value(); ++i) {
// Create the producers // Create the producers
args << QLatin1String("pango:") << QLatin1String("in=0") << QLatin1String("out=") + QString::number((int) fps * view.duration->value()); args << QLatin1String("pango:") << QLatin1String("in=0") << QLatin1String("out=") + QString::number((int)fps * view.duration->value());
args << QLatin1String("text=") + QString::number(view.duration->value() - i); args << QLatin1String("text=") + QString::number(view.duration->value() - i);
args << QLatin1String("font=") + QString::number(view.font->value()) + QLatin1String("px"); args << QLatin1String("font=") + QString::number(view.font->value()) + QLatin1String("px");
} }
...@@ -95,14 +96,14 @@ QUrl SamplePlugin::generatedClip(const QString &renderer, const QString &generat ...@@ -95,14 +96,14 @@ QUrl SamplePlugin::generatedClip(const QString &renderer, const QString &generat
generatorProcess.start(renderer, args); generatorProcess.start(renderer, args);
if (generatorProcess.waitForFinished()) { if (generatorProcess.waitForFinished()) {
if (generatorProcess.exitStatus() == QProcess::CrashExit) { if (generatorProcess.exitStatus() == QProcess::CrashExit) {
//qDebug() << "/// Generator failed: "; // qDebug() << "/// Generator failed: ";
QString error = QString::fromLocal8Bit(generatorProcess.readAllStandardError()); QString error = QString::fromLocal8Bit(generatorProcess.readAllStandardError());
KMessageBox::sorry(QApplication::activeWindow(), i18n("Failed to generate clip:\n%1", error), i18n("Generator Failed")); KMessageBox::sorry(QApplication::activeWindow(), i18n("Failed to generate clip:\n%1", error), i18n("Generator Failed"));
} else { } else {
result = view.path->url(); result = view.path->url();
} }
} else { } else {
//qDebug() << "/// Generator failed: "; // qDebug() << "/// Generator failed: ";
QString error = QString::fromLocal8Bit(generatorProcess.readAllStandardError()); QString error = QString::fromLocal8Bit(generatorProcess.readAllStandardError());
KMessageBox::sorry(QApplication::activeWindow(), i18n("Failed to generate clip:\n%1", error), i18n("Generator Failed")); KMessageBox::sorry(QApplication::activeWindow(), i18n("Failed to generate clip:\n%1", error), i18n("Generator Failed"));
} }
...@@ -112,4 +113,3 @@ QUrl SamplePlugin::generatedClip(const QString &renderer, const QString &generat ...@@ -112,4 +113,3 @@ QUrl SamplePlugin::generatedClip(const QString &renderer, const QString &generat
} }
Q_EXPORT_PLUGIN2(kdenlive_sampleplugin, SamplePlugin) Q_EXPORT_PLUGIN2(kdenlive_sampleplugin, SamplePlugin)
...@@ -17,18 +17,18 @@ ...@@ -17,18 +17,18 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/ ***************************************************************************/
#include "framework/mlt_version.h"
#include "mlt++/Mlt.h"
#include "renderjob.h" #include "renderjob.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QDebug> #include <QDebug>
#include <QDir>
#include <QDomDocument>
#include <QFileInfo> #include <QFileInfo>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QDomDocument>
#include <QUrl> #include <QUrl>
#include <QDir>
#include <stdio.h> #include <stdio.h>
#include "framework/mlt_version.h"
#include "mlt++/Mlt.h"
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
...@@ -85,10 +85,11 @@ int main(int argc, char **argv) ...@@ -85,10 +85,11 @@ int main(int argc, char **argv)
continue; continue;
} }
QScopedPointer<Mlt::Producer> playlst(prod.cut(frame.toInt(), frame.toInt() + chunkSize)); QScopedPointer<Mlt::Producer> playlst(prod.cut(frame.toInt(), frame.toInt() + chunkSize));
QScopedPointer<Mlt::Consumer> cons(new Mlt::Consumer(profile, QString("avformat:%1").arg(baseFolder.absoluteFilePath(fileName)).toUtf8().constData())); QScopedPointer<Mlt::Consumer> cons(
new Mlt::Consumer(profile, QString("avformat:%1").arg(baseFolder.absoluteFilePath(fileName)).toUtf8().constData()));
for (const QString &param : consumerParams) { for (const QString &param : consumerParams) {
if (param.contains(QLatin1Char('='))) { if (param.contains(QLatin1Char('='))) {
cons->set(param.section(QLatin1Char('='), 0, 0).toUtf8().constData(), param.section(QLatin1Char('='), 1).toUtf8().constData()); cons->set(param.section(QLatin1Char('='), 0, 0).toUtf8().constData(), param.section(QLatin1Char('='), 1).toUtf8().constData());
} }
} }
cons->set("terminate_on_pause", 1); cons->set("terminate_on_pause", 1);
...@@ -99,7 +100,7 @@ int main(int argc, char **argv) ...@@ -99,7 +100,7 @@ int main(int argc, char **argv)
cons->purge(); cons->purge();
fprintf(stderr, "DONE:%d \n", frame.toInt()); fprintf(stderr, "DONE:%d \n", frame.toInt());
} }
//Mlt::Factory::close(); // Mlt::Factory::close();
fprintf(stderr, "+ + + RENDERING FINSHED + + + \n"); fprintf(stderr, "+ + + RENDERING FINSHED + + + \n");
return 0; return 0;
} }
......
...@@ -32,7 +32,6 @@ public: ...@@ -32,7 +32,6 @@ public:
static void msleep(unsigned long msecs) { QThread::msleep(msecs); } static void msleep(unsigned long msecs) { QThread::msleep(msecs); }
}; };
RenderJob::RenderJob(const QString &render, const QString &scenelist, const QString &target, int pid, int in, int out) RenderJob::RenderJob(const QString &render, const QString &scenelist, const QString &target, int pid, int in, int out)
: QObject() : QObject()
, m_scenelist(scenelist) , m_scenelist(scenelist)
...@@ -147,9 +146,8 @@ void RenderJob::receivedStderr() ...@@ -147,9 +146,8 @@ void RenderJob::receivedStderr()
return; return;
} }
m_jobUiserver->call(QStringLiteral("setDescriptionField"), (uint)0, QString(), m_jobUiserver->call(QStringLiteral("setDescriptionField"), (uint)0, QString(),
tr("Remaining time: ") + tr("Remaining time: ") + QTime(0, 0, 0).addSecs(seconds).toString(QStringLiteral("hh:mm:ss")));
QTime(0, 0, 0).addSecs(seconds).toString(QStringLiteral("hh:mm:ss"))); // m_jobUiserver->call(QStringLiteral("setSpeed"), (frame - m_frame) / (seconds - m_seconds));
//m_jobUiserver->call(QStringLiteral("setSpeed"), (frame - m_frame) / (seconds - m_seconds));
// m_jobUiserver->call("setSpeed", (frame - m_frame) / (seconds - m_seconds)); // m_jobUiserver->call("setSpeed", (frame - m_frame) / (seconds - m_seconds));
m_frame = frame; m_frame = frame;
m_seconds = seconds; m_seconds = seconds;
...@@ -209,7 +207,7 @@ void RenderJob::start() ...@@ -209,7 +207,7 @@ void RenderJob::start()
// Because of the logging, we connect to stderr in all cases. // Because of the logging, we connect to stderr in all cases.
connect(m_renderProcess, &QProcess::readyReadStandardError, this, &RenderJob::receivedStderr); connect(m_renderProcess, &QProcess::readyReadStandardError, this, &RenderJob::receivedStderr);
m_renderProcess->start(m_prog, m_args); m_renderProcess->start(m_prog, m_args);
qDebug()<< "Started render process: " << m_prog << ' ' << m_args.join(QLatin1Char(' ')); qDebug() << "Started render process: " << m_prog << ' ' << m_args.join(QLatin1Char(' '));
m_logstream << "Started render process: " << m_prog << ' ' << m_args.join(QLatin1Char(' ')) << endl; m_logstream << "Started render process: " << m_prog << ' ' << m_args.join(QLatin1Char(' ')) << endl;
} }
......
...@@ -9,7 +9,7 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wparentheses -Wsequence-point -Wreturn- ...@@ -9,7 +9,7 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wparentheses -Wsequence-point -Wreturn-
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wuninitialized -Wreorder -Wundef -Wshadow -Wwrite-strings") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wuninitialized -Wreorder -Wundef -Wshadow -Wwrite-strings")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-compare -Wconversion") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-compare -Wconversion")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmissing-noreturn -Wsign-conversion -Wunused ") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmissing-noreturn -Wsign-conversion -Wunused ")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-aliasing -Wstrict-overflow -Wconversion") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-aliasing -Wconversion")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wdisabled-optimization") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wdisabled-optimization")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-undef") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-undef")
if (CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_COMPILER_IS_GNUCXX)
...@@ -26,7 +26,7 @@ if(NOT WIN32) ...@@ -26,7 +26,7 @@ if(NOT WIN32)
if (NOT MLT_DATADIR_failed) if (NOT MLT_DATADIR_failed)
string(REGEX REPLACE "[\r\n]" "" MLT_DATADIR "${MLT_DATADIR}") string(REGEX REPLACE "[\r\n]" "" MLT_DATADIR "${MLT_DATADIR}")
endif() endif()
execute_process( execute_process(
COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=meltbin mlt-framework COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=meltbin mlt-framework
OUTPUT_VARIABLE MLT_MELTBIN OUTPUT_VARIABLE MLT_MELTBIN
...@@ -292,6 +292,8 @@ target_link_libraries(kdenliveLib ...@@ -292,6 +292,8 @@ target_link_libraries(kdenliveLib
kiss_fft kiss_fft
) )
set_property(TARGET kdenliveLib PROPERTY CXX_STANDARD 14)
message(STATUS "Found MLT++: ${MLTPP_LIBRARIES}") message(STATUS "Found MLT++: ${MLTPP_LIBRARIES}")
if (KF5_FILEMETADATA) if (KF5_FILEMETADATA)
......
...@@ -58,7 +58,7 @@ public: ...@@ -58,7 +58,7 @@ public:
QString getDescription(const QString &assetId) const; QString getDescription(const QString &assetId) const;
/* @brief Set an asset as favorite (or not)*/ /* @brief Set an asset as favorite (or not)*/
virtual void setFavorite(const QString & assetId, bool favorite) = 0; virtual void setFavorite(const QString &assetId, bool favorite) = 0;
/* @brief Returns a DomElement representing the asset's properties */ /* @brief Returns a DomElement representing the asset's properties */
QDomElement getXml(const QString &assetId) const; QDomElement getXml(const QString &assetId) const;
......
...@@ -115,14 +115,14 @@ QVariant AssetTreeModel::data(const QModelIndex &index, int role) const ...@@ -115,14 +115,14 @@ QVariant AssetTreeModel::data(const QModelIndex &index, int role) const
} }
std::shared_ptr<TreeItem> item = getItemById((int)index.internalId()); std::shared_ptr<TreeItem> item = getItemById((int)index.internalId());
switch(role) { switch (role) {
case IdRole: case IdRole:
return item->dataColumn(AssetTreeModel::idCol); return item->dataColumn(AssetTreeModel::idCol);
case FavoriteRole: case FavoriteRole:
return item->dataColumn(AssetTreeModel::favCol); return item->dataColumn(AssetTreeModel::favCol);
case NameRole: case NameRole:
return item->dataColumn(index.column()); return item->dataColumn(index.column());
default: default:
return QVariant(); return QVariant();
} }
} }
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
#include "assets/assetlist/view/qmltypes/asseticonprovider.hpp" #include "assets/assetlist/view/qmltypes/asseticonprovider.hpp"
#include <KDeclarative/KDeclarative> #include <KDeclarative/KDeclarative>
#include <kdeclarative_version.h>
#include <QQmlContext> #include <QQmlContext>
#include <QQuickItem> #include <QQuickItem>
#include <QStandardPaths> #include <QStandardPaths>
#include <kdeclarative_version.h>
AssetListWidget::AssetListWidget(QWidget *parent) AssetListWidget::AssetListWidget(QWidget *parent)
: QQuickWidget(parent) : QQuickWidget(parent)
......
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
#include <KColorScheme> #include <KColorScheme>
#include <KColorUtils> #include <KColorUtils>
#include <KSqueezedTextLabel>
#include <KDualAction> #include <KDualAction>
#include <KSqueezedTextLabel>
#include <QApplication> #include <QApplication>
#include <QDebug> #include <QDebug>
#include <QHBoxLayout> #include <QHBoxLayout>
...@@ -59,8 +59,8 @@ AssetPanel::AssetPanel(QWidget *parent) ...@@ -59,8 +59,8 @@ AssetPanel::AssetPanel(QWidget *parent)
buttonToolbar->setIconSize(iconSize); buttonToolbar->setIconSize(iconSize);
// spacer // spacer
QWidget* empty = new QWidget(); QWidget *empty = new QWidget();
empty->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum); empty->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
buttonToolbar->addWidget(empty); buttonToolbar->addWidget(empty);
m_switchBuiltStack = new QToolButton(this); m_switchBuiltStack = new QToolButton(this);
...@@ -118,9 +118,7 @@ AssetPanel::AssetPanel(QWidget *parent) ...@@ -118,9 +118,7 @@ AssetPanel::AssetPanel(QWidget *parent)
connect(m_effectStackWidget, &EffectStackView::seekToPos, this, &AssetPanel::seekToPos); connect(m_effectStackWidget, &EffectStackView::seekToPos, this, &AssetPanel::seekToPos);
connect(m_effectStackWidget, &EffectStackView::reloadEffect, this, &AssetPanel::reloadEffect); connect(m_effectStackWidget, &EffectStackView::reloadEffect, this, &AssetPanel::reloadEffect);
connect(m_transitionWidget, &TransitionStackView::seekToTransPos, this, &AssetPanel::seekToPos); connect(m_transitionWidget, &TransitionStackView::seekToTransPos, this, &AssetPanel::seekToPos);
connect(m_effectStackWidget, &EffectStackView::updateEnabledState, [this]() { connect(m_effectStackWidget, &EffectStackView::updateEnabledState, [this]() { m_enableStackButton->setActive(m_effectStackWidget->isStackEnabled()); });
m_enableStackButton->setActive(m_effectStackWidget->isStackEnabled());
});
} }
void AssetPanel::showTransition(int tid, std::shared_ptr<AssetParameterModel> transitionModel) void AssetPanel::showTransition(int tid, std::shared_ptr<AssetParameterModel> transitionModel)
...@@ -189,7 +187,7 @@ void AssetPanel::showEffectStack(const QString &itemName, std::shared_ptr<Effect ...@@ -189,7 +187,7 @@ void AssetPanel::showEffectStack(const QString &itemName, std::shared_ptr<Effect
m_enableStackButton->setActive(effectsModel->isStackEnabled()); m_enableStackButton->setActive(effectsModel->isStackEnabled());
if (showSplit) { if (showSplit) {
m_splitButton->setEnabled(effectsModel->rowCount() > 0); m_splitButton->setEnabled(effectsModel->rowCount() > 0);
QObject::connect(effectsModel.get(), &EffectStackModel::dataChanged, [&](){ QObject::connect(effectsModel.get(), &EffectStackModel::dataChanged, [&]() {
if (m_effectStackWidget->isEmpty()) { if (m_effectStackWidget->isEmpty()) {
m_splitButton->setActive(false); m_splitButton->setActive(false);
} }
......
...@@ -22,13 +22,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -22,13 +22,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "cornershelper.hpp" #include "cornershelper.hpp"
#include "assets/keyframes/model/keyframemodellist.hpp" #include "assets/keyframes/model/keyframemodellist.hpp"
#include "assets/model/assetparametermodel.hpp" #include "assets/model/assetparametermodel.hpp"
#include "gentime.h"
#include "core.h" #include "core.h"
#include "gentime.h"
#include "monitor/monitor.h" #include "monitor/monitor.h"
#include <QSize> #include <QSize>
CornersHelper::CornersHelper(Monitor *monitor, std::shared_ptr< AssetParameterModel> model, QPersistentModelIndex index, QObject *parent) CornersHelper::CornersHelper(Monitor *monitor, std::shared_ptr<AssetParameterModel> model, QPersistentModelIndex index, QObject *parent)
: KeyframeMonitorHelper(monitor, model, index, parent) : KeyframeMonitorHelper(monitor, model, index, parent)
{ {
} }
...@@ -37,7 +37,7 @@ void CornersHelper::slotUpdateFromMonitorData(const QVariantList &v) ...@@ -37,7 +37,7 @@ void CornersHelper::slotUpdateFromMonitorData(const QVariantList &v)
{ {
const QVariantList points = QVariant(v).toList(); const QVariantList points = QVariant(v).toList();
QSize frameSize = pCore->getCurrentFrameSize(); QSize frameSize = pCore->getCurrentFrameSize();
int ix =0; int ix = 0;
for (int i = 0; i < points.size(); i++) { for (int i = 0; i < points.size(); i++) {
QPointF pt = points.at(i).toPointF(); QPointF pt = points.at(i).toPointF();
double x = (pt.x() / frameSize.width() + 1) / 3; double x = (pt.x() / frameSize.width() + 1) / 3;
...@@ -50,8 +50,8 @@ void CornersHelper::slotUpdateFromMonitorData(const QVariantList &v) ...@@ -50,8 +50,8 @@ void CornersHelper::slotUpdateFromMonitorData(const QVariantList &v)
void CornersHelper::refreshParams(int pos) void CornersHelper::refreshParams(int pos)
{ {
QVariantList points{QPointF(),QPointF(),QPointF(),QPointF()}; QVariantList points{QPointF(), QPointF(), QPointF(), QPointF()};
QList <double>coords; QList<double> coords;
QSize frameSize = pCore->getCurrentFrameSize(); QSize frameSize = pCore->getCurrentFrameSize();
for (const auto &ix : m_indexes) { for (const auto &ix : m_indexes) {
ParamType type = m_model->data(ix, AssetParameterModel::TypeRole).value<ParamType>(); ParamType type = m_model->data(ix, AssetParameterModel::TypeRole).value<ParamType>();
...@@ -63,34 +63,34 @@ void CornersHelper::refreshParams(int pos) ...@@ -63,34 +63,34 @@ void CornersHelper::refreshParams(int pos)
continue; continue;
} }
double value = m_model->getKeyframeModel()->getInterpolatedValue(pos, ix).toDouble(); double value = m_model->getKeyframeModel()->getInterpolatedValue(pos, ix).toDouble();
value = ((3 * value) - 1) * (paramName%2 == 0 ? frameSize.width() : frameSize.height()); value = ((3 * value) - 1) * (paramName % 2 == 0 ? frameSize.width() : frameSize.height());
switch (paramName) { switch (paramName) {
case 0: case 0:
points[0] = QPointF(value, points.at(0).toPointF().y()); points[0] = QPointF(value, points.at(0).toPointF().y());
break; break;
case 1: case 1:
points[0] = QPointF(points.at(0).toPointF().x(), value); points[0] = QPointF(points.at(0).toPointF().x(), value);
break; break;
case 2: case 2:
points[1] = QPointF(value, points.at(1).toPointF().y()); points[1] = QPointF(value, points.at(1).toPointF().y());
break; break;
case 3: case 3:
points[1] = QPointF(points.at(1).toPointF().x(), value); points[1] = QPointF(points.at(1).toPointF().x(), value);
break; break;
case 4: case 4:
points[2] = QPointF(value, points.at(2).toPointF().y()); points[2] = QPointF(value, points.at(2).toPointF().y());
break; break;
case 5: case 5:
points[2] = QPointF(points.at(2).toPointF().x(), value); points[2] = QPointF(points.at(2).toPointF().x(), value);
break; break;
case 6: case 6:
points[3] = QPointF(value, points.at(3).toPointF().y()); points[3] = QPointF(value, points.at(3).toPointF().y());
break; break;
case 7: case 7:
points[3] = QPointF(points.at(3).toPointF().x(), value); points[3] = QPointF(points.at(3).toPointF().x(), value);
break; break;
default: default:
break; break;
} }
} }
if (m_monitor) { if (m_monitor) {
......
...@@ -24,9 +24,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -24,9 +24,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "assets/keyframes/model/keyframemonitorhelper.hpp" #include "assets/keyframes/model/keyframemonitorhelper.hpp"
#include <QObject>
#include <QPersistentModelIndex> #include <QPersistentModelIndex>
#include <QVariant> #include <QVariant>
#include <QObject>
#include <memory> #include <memory>
...@@ -43,14 +43,13 @@ public: ...@@ -43,14 +43,13 @@ public:
@param model is the asset this parameter belong to @param model is the asset this parameter belong to
@param index is the index of this parameter in its model @param index is the index of this parameter in its model
*/ */
explicit CornersHelper(Monitor *monitor, std::shared_ptr< AssetParameterModel> model, QPersistentModelIndex index, QObject *parent = nullptr); explicit CornersHelper(Monitor *monitor, std::shared_ptr<AssetParameterModel> model, QPersistentModelIndex index, QObject *parent = nullptr);
/** @brief Send data update to the monitor /** @brief Send data update to the monitor
*/ */
void refreshParams(int pos) override; void refreshParams(int pos) override;
private slots: private slots:
void slotUpdateFromMonitorData(const QVariantList &v) override; void slotUpdateFromMonitorData(const QVariantList &v) override;
}; };
#endif #endif
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
***************************************************************************/ ***************************************************************************/
#include "keyframemodel.hpp" #include "keyframemodel.hpp"
#include "rotoscoping/bpoint.h"
#include "rotoscoping/rotohelper.hpp"
#include "core.h" #include "core.h"
#include "doc/docundostack.hpp" #include "doc/docundostack.hpp"
#include "macros.hpp" #include "macros.hpp"
#include "rotoscoping/bpoint.h"
#include "rotoscoping/rotohelper.hpp"
#include <QDebug> #include <QDebug>
#include <QJsonDocument> #include <QJsonDocument>
...@@ -130,7 +130,7 @@ bool KeyframeModel::addKeyframe(GenTime pos, KeyframeType type, QVariant value) ...@@ -130,7 +130,7 @@ bool KeyframeModel::addKeyframe(GenTime pos, KeyframeType type, QVariant value)
bool KeyframeModel::removeKeyframe(GenTime pos, Fun &undo, Fun &redo, bool notify) bool KeyframeModel::removeKeyframe(GenTime pos, Fun &undo, Fun &redo, bool notify)
{ {
qDebug() << "Going to remove keyframe at " << pos.frames(pCore->getCurrentFps())<<" NOTIFY: "<<notify; qDebug() << "Going to remove keyframe at " << pos.frames(pCore->getCurrentFps()) << " NOTIFY: " << notify;
qDebug() << "before" << getAnimProperty(); qDebug() << "before" << getAnimProperty();
QWriteLocker locker(&m_lock); QWriteLocker locker(&m_lock);
Q_ASSERT(m_keyframeList.count(pos) > 0); Q_ASSERT(m_keyframeList.count(pos) > 0);
...@@ -209,7 +209,7 @@ bool KeyframeModel::moveKeyframe(GenTime oldPos, GenTime pos, QVariant newVal, F ...@@ -209,7 +209,7 @@ bool KeyframeModel::moveKeyframe(GenTime oldPos, GenTime pos, QVariant newVal, F
Fun local_undo = []() { return true; }; Fun local_undo = []() { return true; };
Fun local_redo = []() { return true; }; Fun local_redo = []() { return true; };
qDebug() << getAnimProperty(); qDebug() << getAnimProperty();
//TODO: use the new Animation::key_set_frame to move a keyframe // TODO: use the new Animation::key_set_frame to move a keyframe
bool res = removeKeyframe(oldPos, local_undo, local_redo); bool res = removeKeyframe(oldPos, local_undo, local_redo);
qDebug() << "Move keyframe finished deletion:" << res; qDebug() << "Move keyframe finished deletion:" << res;
qDebug() << getAnimProperty(); qDebug() << getAnimProperty();
...@@ -613,7 +613,7 @@ bool KeyframeModel::removeAllKeyframes(Fun &undo, Fun &redo) ...@@ -613,7 +613,7 @@ bool KeyframeModel::removeAllKeyframes(Fun &undo, Fun &redo)
std::vector<GenTime> all_pos; std::vector<GenTime> all_pos;
Fun local_undo = []() { return true; }; Fun local_undo = []() { return true; };
Fun local_redo = []() { return true; }; Fun local_redo = []() { return true; };
int kfrCount = m_keyframeList.size() - 1; int kfrCount = (int)m_keyframeList.size() - 1;
// we trigger only one global remove/insertrow event // we trigger only one global remove/insertrow event
Fun update_redo_start = [this, kfrCount]() { Fun update_redo_start = [this, kfrCount]() {
beginRemoveRows(QModelIndex(), 1, kfrCount); beginRemoveRows(QModelIndex(), 1, kfrCount);
...@@ -787,7 +787,6 @@ void KeyframeModel::parseAnimProperty(const QString &prop) ...@@ -787,7 +787,6 @@ void KeyframeModel::parseAnimProperty(const QString &prop)
connect(this, &KeyframeModel::modelChanged, this, &KeyframeModel::sendModification); connect(this, &KeyframeModel::modelChanged, this, &KeyframeModel::sendModification);
} }
void KeyframeModel::resetAnimProperty(const QString &prop) void KeyframeModel::resetAnimProperty(const QString &prop)
{ {
Fun undo = []() { return true; }; Fun undo = []() { return true; };
...@@ -847,7 +846,7 @@ void KeyframeModel::resetAnimProperty(const QString &prop) ...@@ -847,7 +846,7 @@ void KeyframeModel::resetAnimProperty(const QString &prop)
effectName = i18n("effect"); effectName = i18n("effect");
} }
Fun update_local = [this]() { Fun update_local = [this]() {
emit dataChanged(index(0), index(m_keyframeList.size()), {}); emit dataChanged(index(0), index((int)m_keyframeList.size()), {});
return true; return true;
}; };
update_local(); update_local();
...@@ -887,7 +886,7 @@ QVariant KeyframeModel::updateInterpolated(QVariant interpValue, double val) ...@@ -887,7 +886,7 @@ QVariant KeyframeModel::updateInterpolated(QVariant interpValue, double val)
QStringList vals = interpValue.toString().split(QLatin1Char(' ')); QStringList vals = interpValue.toString().split(QLatin1Char(' '));
QLocale locale; QLocale locale;
if (!vals.isEmpty()) { if (!vals.isEmpty()) {
vals[vals.size() -1] = locale.toString(val);