Commit ae0d37ff authored by Nicolas Carion's avatar Nicolas Carion
Browse files

clang-format

parent ac744a04
Pipeline #1483 failed with stage
in 10 minutes and 13 seconds
......@@ -144,11 +144,11 @@ template <typename AssetType> bool AbstractAssetsRepository<AssetType>::parseInf
eff.setAttribute(QStringLiteral("id"), id);
////qCDebug(KDENLIVE_LOG)<<"Effect: "<<id;
Mlt::Properties param_props((mlt_properties) metadata->get_data("parameters"));
Mlt::Properties param_props((mlt_properties)metadata->get_data("parameters"));
for (int j = 0; param_props.is_valid() && j < param_props.count(); ++j) {
QDomElement params = doc.createElement(QStringLiteral("parameter"));
Mlt::Properties paramdesc((mlt_properties) param_props.get_data(param_props.get_name(j)));
Mlt::Properties paramdesc((mlt_properties)param_props.get_data(param_props.get_name(j)));
params.setAttribute(QStringLiteral("name"), paramdesc.get("identifier"));
if (params.attribute(QStringLiteral("name")) == QLatin1String("argument")) {
// This parameter has to be given as attribute when using command line, do not show it in Kdenlive
......
......@@ -23,9 +23,9 @@
#include "core.h"
#include "doc/docundostack.hpp"
#include "macros.hpp"
#include "profiles/profilemodel.hpp"
#include "rotoscoping/bpoint.h"
#include "rotoscoping/rotohelper.hpp"
#include "profiles/profilemodel.hpp"
#include <QDebug>
#include <QJsonDocument>
......@@ -700,12 +700,12 @@ QString KeyframeModel::getAnimProperty() const
for (const auto &keyframe : m_keyframeList) {
if (first) {
switch (m_paramType) {
case ParamType::AnimatedRect:
mlt_prop.anim_set("key", keyframe.second.second.toString().toUtf8().constData(), keyframe.first.frames(pCore->getCurrentFps()));
break;
default:
mlt_prop.anim_set("key", keyframe.second.second.toDouble(), keyframe.first.frames(pCore->getCurrentFps()));
break;
case ParamType::AnimatedRect:
mlt_prop.anim_set("key", keyframe.second.second.toString().toUtf8().constData(), keyframe.first.frames(pCore->getCurrentFps()));
break;
default:
mlt_prop.anim_set("key", keyframe.second.second.toDouble(), keyframe.first.frames(pCore->getCurrentFps()));
break;
}
anim.reset(mlt_prop.get_anim("key"));
anim->key_set_type(ix, convertToMltType(keyframe.second.first));
......@@ -714,12 +714,12 @@ QString KeyframeModel::getAnimProperty() const
continue;
}
switch (m_paramType) {
case ParamType::AnimatedRect:
mlt_prop.anim_set("key", keyframe.second.second.toString().toUtf8().constData(), keyframe.first.frames(pCore->getCurrentFps()));
break;
default:
mlt_prop.anim_set("key", keyframe.second.second.toDouble(), keyframe.first.frames(pCore->getCurrentFps()));
break;
case ParamType::AnimatedRect:
mlt_prop.anim_set("key", keyframe.second.second.toString().toUtf8().constData(), keyframe.first.frames(pCore->getCurrentFps()));
break;
default:
mlt_prop.anim_set("key", keyframe.second.second.toDouble(), keyframe.first.frames(pCore->getCurrentFps()));
break;
}
anim->key_set_type(ix, convertToMltType(keyframe.second.first));
ix++;
......@@ -766,7 +766,7 @@ void KeyframeModel::parseAnimProperty(const QString &prop)
Mlt::Animation anim = mlt_prop.get_animation("key");
qDebug() << "Found" << anim.key_count() << ", OUT: "<<out<<", animation properties: "<<prop;
qDebug() << "Found" << anim.key_count() << ", OUT: " << out << ", animation properties: " << prop;
bool useDefaultType = !prop.contains(QLatin1Char('='));
for (int i = 0; i < anim.key_count(); ++i) {
int frame;
......@@ -778,14 +778,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(locale.toString(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(locale.toString(rect.o)));
break;
}
default:
value = QVariant(mlt_prop.anim_get_double("key", frame));
break;
}
if (i == 0 && frame > in) {
// Always add a keyframe at start pos
......
......@@ -335,6 +335,6 @@ void KeyframeView::paintEvent(QPaintEvent *event)
p.drawPolygon(position);
}
p.setOpacity(0.5);
p.drawLine(m_offset, m_lineHeight, m_offset, m_lineHeight + headOffset );
p.drawLine(width() - m_offset, m_lineHeight, width() - m_offset, m_lineHeight + headOffset );
p.drawLine(m_offset, m_lineHeight, m_offset, m_lineHeight + headOffset);
p.drawLine(width() - m_offset, m_lineHeight, width() - m_offset, m_lineHeight + headOffset);
}
......@@ -182,7 +182,7 @@ void AssetParameterModel::setParameter(const QString &name, const QString &param
Q_ASSERT(m_asset->is_valid());
QLocale locale;
locale.setNumberOptions(QLocale::OmitGroupSeparator);
qDebug() << "// PROCESSING PARAM CHANGE: " << name << ", UPDATE: "<<update<<", VAL: "<<paramValue;
qDebug() << "// PROCESSING PARAM CHANGE: " << name << ", UPDATE: " << update << ", VAL: " << paramValue;
// TODO: this does not really belong here, but I don't see another way to do it so that undo works
if (data(paramIndex, AssetParameterModel::TypeRole).value<ParamType>() == ParamType::Curve) {
QStringList vals = paramValue.split(QLatin1Char(';'), QString::SkipEmptyParts);
......
......@@ -212,7 +212,7 @@ void AssetParameterView::refresh(const QModelIndex &topLeft, const QModelIndex &
if (!bottomRight.isValid()) {
max = m_widgets.size() - 1;
} else {
max = (size_t) bottomRight.row();
max = (size_t)bottomRight.row();
}
Q_ASSERT(max < (int)m_widgets.size());
for (auto i = (size_t)topLeft.row(); i <= max; ++i) {
......
......@@ -26,8 +26,8 @@
#include "curves/cubic/kis_curve_widget.h"
#include "curves/curveparamwidget.h"
#include "doubleparamwidget.hpp"
#include "hideparamwidget.hpp"
#include "geometryeditwidget.hpp"
#include "hideparamwidget.hpp"
#include "keyframewidget.hpp"
#include "listparamwidget.h"
#include "lumaliftgainparam.hpp"
......
......@@ -24,9 +24,8 @@
template <typename Curve_t>
AbstractCurveWidget<Curve_t>::AbstractCurveWidget(QWidget *parent)
: __dummy_AbstractCurveWidget(parent)
,
m_pixmapCache(nullptr)
, m_pixmapCache(nullptr)
{
setMouseTracking(true);
setAutoFillBackground(false);
......
......@@ -34,6 +34,4 @@ void HideParamWidget::slotShowComment(bool show)
Q_UNUSED(show);
}
void HideParamWidget::slotRefresh()
{
}
void HideParamWidget::slotRefresh() {}
......@@ -282,9 +282,11 @@ bool ClipCreator::createClipsFromList(const QList<QUrl> &list, bool checkRemovab
}
if (checkRemovable && isOnRemovableDevice(file) && !isOnRemovableDevice(pCore->currentDoc()->projectDataFolder())) {
int answer = KMessageBox::warningContinueCancel(
QApplication::activeWindow(), i18n("Clip <b>%1</b><br /> is on a removable device, will not be available when device is unplugged or mounted at a different position. You "
QApplication::activeWindow(),
i18n("Clip <b>%1</b><br /> is on a removable device, will not be available when device is unplugged or mounted at a different position. You "
"may want to copy it first to your hard-drive. Would you like to add it anyways?",
file.path()), i18n("Removable device"), KStandardGuiItem::cont(), KStandardGuiItem::cancel(), QStringLiteral("confirm_removable_device"));
file.path()),
i18n("Removable device"), KStandardGuiItem::cont(), KStandardGuiItem::cancel(), QStringLiteral("confirm_removable_device"));
if (answer == KMessageBox::Cancel) continue;
}
......
......@@ -22,18 +22,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "mediacapture.h"
#include <QAudioProbe>
MediaCapture::MediaCapture(QObject* parent)
MediaCapture::MediaCapture(QObject *parent)
: QObject(parent)
, m_volume(1.)
{
m_probe.reset(new QAudioProbe(this));
connect(m_probe.get(), &QAudioProbe::audioBufferProbed,
this, &MediaCapture::processBuffer);
connect(m_probe.get(), &QAudioProbe::audioBufferProbed, this, &MediaCapture::processBuffer);
}
MediaCapture::~MediaCapture()
{
}
MediaCapture::~MediaCapture() {}
void MediaCapture::displayErrorMessage()
{
......@@ -71,7 +68,7 @@ void MediaCapture::recordVideo(bool record)
// TO DO - fix video capture
if (!m_videoRecorder) {
QList<QCameraInfo> availableCameras = QCameraInfo::availableCameras();
foreach (const QCameraInfo& cameraInfo, availableCameras) {
foreach (const QCameraInfo &cameraInfo, availableCameras) {
if (cameraInfo == QCameraInfo::defaultCamera()) {
m_camera.reset(new QCamera(cameraInfo, this));
break;
......@@ -130,8 +127,7 @@ int MediaCapture::getState()
return -1;
}
template <class T>
QVector<qreal> getBufferLevels(const T *buffer, int frames, int channels)
template <class T> QVector<qreal> getBufferLevels(const T *buffer, int frames, int channels)
{
QVector<qreal> max_values;
max_values.fill(0, channels);
......@@ -139,8 +135,7 @@ QVector<qreal> getBufferLevels(const T *buffer, int frames, int channels)
for (int i = 0; i < frames; ++i) {
for (int j = 0; j < channels; ++j) {
qreal value = qAbs(qreal(buffer[i * channels + j]));
if (value > max_values.at(j))
max_values.replace(j, value);
if (value > max_values.at(j)) max_values.replace(j, value);
}
}
......@@ -148,14 +143,12 @@ QVector<qreal> getBufferLevels(const T *buffer, int frames, int channels)
}
// This function returns the maximum possible sample value for a given audio format
qreal getPeakValue(const QAudioFormat& format)
qreal getPeakValue(const QAudioFormat &format)
{
// Note: Only the most common sample formats are supported
if (!format.isValid())
return qreal(0);
if (!format.isValid()) return qreal(0);
if (format.codec() != "audio/pcm")
return qreal(0);
if (format.codec() != "audio/pcm") return qreal(0);
switch (format.sampleType()) {
case QAudioFormat::Unknown:
......@@ -165,51 +158,39 @@ qreal getPeakValue(const QAudioFormat& format)
return qreal(0);
return qreal(1.00003);
case QAudioFormat::SignedInt:
if (format.sampleSize() == 32)
return qreal(INT_MAX);
if (format.sampleSize() == 16)
return qreal(SHRT_MAX);
if (format.sampleSize() == 8)
return qreal(CHAR_MAX);
if (format.sampleSize() == 32) return qreal(INT_MAX);
if (format.sampleSize() == 16) return qreal(SHRT_MAX);
if (format.sampleSize() == 8) return qreal(CHAR_MAX);
break;
case QAudioFormat::UnSignedInt:
if (format.sampleSize() == 32)
return qreal(UINT_MAX);
if (format.sampleSize() == 16)
return qreal(USHRT_MAX);
if (format.sampleSize() == 8)
return qreal(UCHAR_MAX);
if (format.sampleSize() == 32) return qreal(UINT_MAX);
if (format.sampleSize() == 16) return qreal(USHRT_MAX);
if (format.sampleSize() == 8) return qreal(UCHAR_MAX);
break;
}
return qreal(0);
}
QVector<qreal> getBufferLevels(const QAudioBuffer& buffer)
QVector<qreal> getBufferLevels(const QAudioBuffer &buffer)
{
QVector<qreal> values;
if (!buffer.format().isValid() || buffer.format().byteOrder() != QAudioFormat::LittleEndian)
return values;
if (!buffer.format().isValid() || buffer.format().byteOrder() != QAudioFormat::LittleEndian) return values;
if (buffer.format().codec() != "audio/pcm")
return values;
if (buffer.format().codec() != "audio/pcm") return values;
int channelCount = buffer.format().channelCount();
values.fill(0, channelCount);
qreal peak_value = getPeakValue(buffer.format());
if (qFuzzyCompare(peak_value, qreal(0)))
return values;
if (qFuzzyCompare(peak_value, qreal(0))) return values;
switch (buffer.format().sampleType()) {
case QAudioFormat::Unknown:
case QAudioFormat::UnSignedInt:
if (buffer.format().sampleSize() == 32)
values = getBufferLevels(buffer.constData<quint32>(), buffer.frameCount(), channelCount);
if (buffer.format().sampleSize() == 16)
values = getBufferLevels(buffer.constData<quint16>(), buffer.frameCount(), channelCount);
if (buffer.format().sampleSize() == 8)
values = getBufferLevels(buffer.constData<quint8>(), buffer.frameCount(), channelCount);
if (buffer.format().sampleSize() == 32) values = getBufferLevels(buffer.constData<quint32>(), buffer.frameCount(), channelCount);
if (buffer.format().sampleSize() == 16) values = getBufferLevels(buffer.constData<quint16>(), buffer.frameCount(), channelCount);
if (buffer.format().sampleSize() == 8) values = getBufferLevels(buffer.constData<quint8>(), buffer.frameCount(), channelCount);
for (int i = 0; i < values.size(); ++i)
values[i] = qAbs(values.at(i) - peak_value / 2) / (peak_value / 2);
break;
......@@ -221,12 +202,9 @@ QVector<qreal> getBufferLevels(const QAudioBuffer& buffer)
}
break;
case QAudioFormat::SignedInt:
if (buffer.format().sampleSize() == 32)
values = getBufferLevels(buffer.constData<qint32>(), buffer.frameCount(), channelCount);
if (buffer.format().sampleSize() == 16)
values = getBufferLevels(buffer.constData<qint16>(), buffer.frameCount(), channelCount);
if (buffer.format().sampleSize() == 8)
values = getBufferLevels(buffer.constData<qint8>(), buffer.frameCount(), channelCount);
if (buffer.format().sampleSize() == 32) values = getBufferLevels(buffer.constData<qint32>(), buffer.frameCount(), channelCount);
if (buffer.format().sampleSize() == 16) values = getBufferLevels(buffer.constData<qint16>(), buffer.frameCount(), channelCount);
if (buffer.format().sampleSize() == 8) values = getBufferLevels(buffer.constData<qint8>(), buffer.frameCount(), channelCount);
for (int i = 0; i < values.size(); ++i)
values[i] /= peak_value;
break;
......@@ -235,14 +213,13 @@ QVector<qreal> getBufferLevels(const QAudioBuffer& buffer)
return values;
}
void MediaCapture::processBuffer(const QAudioBuffer& buffer)
void MediaCapture::processBuffer(const QAudioBuffer &buffer)
{
m_levels = getBufferLevels(buffer);
emit levelsChanged();
emit levelsChanged();
}
QVector<qreal> MediaCapture::levels() const
{
return m_levels;
}
......@@ -22,27 +22,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef MEDIACAPTURE_H
#define MEDIACAPTURE_H
#include <QMediaRecorder>
#include <QAudioRecorder>
#include <QAudioBuffer>
#include <QAudioEncoderSettings>
#include <QVideoEncoderSettings>
#include <QAudioRecorder>
#include <QCamera>
#include <QCameraInfo>
#include <QMediaRecorder>
#include <QStringList>
#include <QAudioBuffer>
#include <QUrl>
#include <QVideoEncoderSettings>
#include <memory>
class QAudioRecorder;
class QAudioProbe;
class MediaCapture : public QObject
class MediaCapture : public QObject
{
Q_OBJECT
Q_PROPERTY(QVector<qreal> levels READ levels NOTIFY levelsChanged)
public:
MediaCapture(QObject* parent);
MediaCapture(QObject *parent);
~MediaCapture();
void recordAudio(bool);
void recordVideo(bool);
......@@ -72,8 +72,8 @@ private:
QVector<qreal> m_levels;
private slots:
void processBuffer(const QAudioBuffer& buffer);
void processBuffer(const QAudioBuffer &buffer);
signals:
void levelsChanged();
};
......
......@@ -19,7 +19,6 @@ the Free Software Foundation, either version 3 of the License, or
#include <QUrl>
#include <memory>
class Bin;
class DocUndoStack;
class EffectStackModel;
......
......@@ -185,10 +185,7 @@ public:
GenTime cropDuration;
/** Track number */
int track{0};
ItemInfo()
{
}
ItemInfo() {}
bool isValid() const { return startPos != endPos; }
bool contains(GenTime pos) const
{
......@@ -213,10 +210,7 @@ public:
int a_track{0};
/** Does the user request for a special a_track */
bool forceTrack{0};
TransitionInfo()
{
}
TransitionInfo() {}
};
class CommentedTime
......
......@@ -568,9 +568,10 @@ bool KdenliveDoc::saveSceneList(const QString &path, const QString &scene)
}
QString message;
if (m_documentOpenStatus == UpgradedProject) {
message = i18n("Your project file was upgraded to the latest Kdenlive document version.\nTo make sure you do not lose data, a backup copy called %1 "
"was created.",
backupFile);
message =
i18n("Your project file was upgraded to the latest Kdenlive document version.\nTo make sure you do not lose data, a backup copy called %1 "
"was created.",
backupFile);
} else {
message = i18n("Your project file was modified by Kdenlive.\nTo make sure you do not lose data, a backup copy called %1 was created.", backupFile);
}
......
......@@ -154,7 +154,6 @@ protected:
/* @brief Deregister the existence of a new element*/
void deregisterItem(int id, TreeItem *item) override;
std::weak_ptr<Mlt::Service> m_masterService;
std::vector<std::weak_ptr<Mlt::Service>> m_childServices;
bool m_effectStackEnabled;
......
......@@ -791,7 +791,6 @@ void CollapsibleEffectView::prepareImportClipKeyframes()
emit importClipKeyframes(AVWidget, m_itemInfo, m_effect.cloneNode().toElement(), QMap<QString, QString>());
}
void CollapsibleEffectView::enableView(bool enabled)
{
m_enabledButton->setActive(enabled);
......
......@@ -91,7 +91,7 @@ struct dummy
template <typename T, bool Noprepare, typename... Args>
static typename std::enable_if<!Detect_prepareJob<T>::value || Noprepare, int>::type
exec(const std::shared_ptr<JobManager>& ptr, const std::vector<QString> &binIds, int parentId, QString undoString, Args &&... args)
exec(const std::shared_ptr<JobManager> &ptr, const std::vector<QString> &binIds, int parentId, QString undoString, Args &&... args)
{
auto defaultCreate = [](const QString &id, Args... local_args) { return AbstractClipJob::make<T>(id, std::forward<Args>(local_args)...); };
using local_createFn_t = std::function<std::shared_ptr<T>(const QString &, Args...)>;
......
......@@ -333,7 +333,7 @@ bool LoadJob::startJob()
m_producer->set("length", m_producer->frames_to_time(length, mlt_time_clock));
int kdenlive_duration = m_producer->time_to_frames(Xml::getXmlProperty(m_xml, QStringLiteral("kdenlive:duration")).toUtf8().constData());
if (kdenlive_duration > 0) {
m_producer->set("kdenlive:duration", m_producer->frames_to_time(kdenlive_duration , mlt_time_clock));
m_producer->set("kdenlive:duration", m_producer->frames_to_time(kdenlive_duration, mlt_time_clock));
} else {
m_producer->set("kdenlive:duration", m_producer->get("length"));
}
......
......@@ -3691,7 +3691,8 @@ void MainWindow::forceIconSet(bool force)
bool useDarkIcons = background.value() < 100;
KdenliveSettings::setUse_dark_breeze(useDarkIcons);
}
if (KMessageBox::warningContinueCancel(this, i18n("Kdenlive needs to be restarted to apply the icon theme change. Restart now?")) == KMessageBox::Continue) {
if (KMessageBox::warningContinueCancel(this, i18n("Kdenlive needs to be restarted to apply the icon theme change. Restart now?")) ==
KMessageBox::Continue) {
slotRestart();
}
}
......
......@@ -142,7 +142,7 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
, m_editMarker(nullptr)
, m_forceSizeFactor(0)
, m_lastMonitorSceneType(MonitorSceneDefault)
{
{
auto *layout = new QVBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
......@@ -2053,7 +2053,7 @@ void Monitor::panView(QPoint diff)
}
void Monitor::requestSeek(int pos)
{
{
m_glMonitor->seek(pos);
}
......
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