Commit cc00a839 authored by Julius Künzel's avatar Julius Künzel
Browse files

CppCheck fixes Pt. 3

parent 3853a4af
Pipeline #106646 passed with stage
in 5 minutes and 17 seconds
......@@ -40,7 +40,8 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
m_isAudio = assetXml.attribute(QStringLiteral("type")) == QLatin1String("audio");
bool needsLocaleConversion = false;
QChar separator, oldSeparator;
QChar separator;
QChar oldSeparator;
// Check locale, default effects xml has no LC_NUMERIC defined and always uses the C locale
if (assetXml.hasAttribute(QStringLiteral("LC_NUMERIC"))) {
QLocale effectLocale = QLocale(assetXml.attribute(QStringLiteral("LC_NUMERIC"))); // Check if effect has a special locale → probably OK
......
......@@ -51,7 +51,7 @@ signals:
public slots:
/** @brief Toggle the comments on or off
*/
virtual void slotShowComment(bool) { qDebug() << "DEBUG: show_comment not correctly overridden"; }
virtual void slotShowComment(bool /*show*/) { qDebug() << "DEBUG: show_comment not correctly overridden"; }
/** @brief refresh the properties to reflect changes in the model
*/
......
......@@ -6,6 +6,7 @@
#include "coloreditwidget.hpp"
#include "assets/model/assetparametermodel.hpp"
#include "widgets/colorpickerwidget.h"
#include "utils/qcolorutils.h"
#include <QHBoxLayout>
#include <QLabel>
......@@ -13,64 +14,6 @@
#include <KColorButton>
static QColor stringToColor(QString strColor)
{
bool ok = false;
QColor color("black");
uint intval = 0;
if (strColor.startsWith(QLatin1String("0x"))) {
if (strColor.length() == 10) {
// 0xRRGGBBAA
intval = strColor.toUInt(&ok, 16);
color.setRgb(int((intval >> 24) & 0xff), // r
(intval >> 16) & 0xff, // g
(intval >> 8) & 0xff, // b
intval & 0xff); // a
} else {
// 0xRRGGBB, 0xRGB
color.setNamedColor(strColor.replace(0, 2, QLatin1Char('#')));
}
} else {
if (strColor.length() == 9) {
// #AARRGGBB
strColor = strColor.replace('#', QLatin1String("0x"));
intval = strColor.toUInt(&ok, 16);
color.setRgb((intval >> 16) & 0xff, // r
(intval >> 8) & 0xff, // g
intval & 0xff, // b
int((intval >> 24) & 0xff)); // a
} else if (strColor.length() == 8) {
// 0xRRGGBB
strColor = strColor.replace('#', QLatin1String("0x"));
color.setNamedColor(strColor);
} else {
// #RRGGBB, #RGB
color.setNamedColor(strColor);
}
}
return color;
}
static QString colorToString(const QColor &color, bool alpha)
{
QString colorStr;
QTextStream stream(&colorStr);
stream << "0x";
stream.setIntegerBase(16);
stream.setFieldWidth(2);
stream.setFieldAlignment(QTextStream::AlignRight);
stream.setPadChar('0');
stream << color.red() << color.green() << color.blue();
if (alpha) {
stream << color.alpha();
} else {
// MLT always wants 0xRRGGBBAA format
stream << "ff";
}
return colorStr;
}
ColorEditWidget::ColorEditWidget(std::shared_ptr<AssetParameterModel> model, QModelIndex index, QWidget *parent)
: AbstractParamWidget(std::move(model), index, parent)
{
......@@ -91,7 +34,7 @@ ColorEditWidget::ColorEditWidget(std::shared_ptr<AssetParameterModel> model, QMo
rightSideLayout->setContentsMargins(0, 0, 0, 0);
rightSideLayout->setSpacing(0);
m_button = new KColorButton(stringToColor(color), rightSide);
m_button = new KColorButton(QColorUtils::stringToColor(color), rightSide);
if (alphaEnabled) {
m_button->setAlphaChannelEnabled(alphaEnabled);
}
......@@ -122,12 +65,12 @@ void ColorEditWidget::slotRefresh()
{
QSignalBlocker bk(this);
QString color = m_model->data(m_index, AssetParameterModel::ValueRole).toString();
m_button->setColor(stringToColor(color));
m_button->setColor(QColorUtils::stringToColor(color));
}
QString ColorEditWidget::getColor() const
{
return colorToString(m_button->color(), m_button->isAlphaChannelEnabled());
return QColorUtils::colorToString(m_button->color(), m_button->isAlphaChannelEnabled());
}
void ColorEditWidget::setColor(const QColor &color)
......
......@@ -8,7 +8,7 @@
#ifndef COLORWHEELPARAM_H
#define COLORWHEELPARAM_H
#include "utils/negqcolor.h"
#include "utils/qcolorutils.h"
#include <QPainter>
#include <QResizeEvent>
......
......@@ -236,18 +236,6 @@ void KisCurveWidget::mouseMoveEvent(QMouseEvent *e)
}
}
double KisCurveWidget::io2sp(int x) const
{
int rangeLen = m_inOutMax - m_inOutMin;
return double(x - m_inOutMin) / rangeLen;
}
int KisCurveWidget::sp2io(double x) const
{
int rangeLen = m_inOutMax - m_inOutMin;
return int(x * rangeLen + 0.5) + m_inOutMin;
}
bool KisCurveWidget::jumpOverExistingPoints(QPointF &pt, int skipIndex)
{
for (QPointF &it : m_curve.points()) {
......
......@@ -81,10 +81,6 @@ private:
bool m_guideVisible;
QColor m_colorGuide;
/* Working range of them */
int m_inOutMin;
int m_inOutMax;
};
#endif /* KIS_CURVE_WIDGET_H */
......@@ -830,7 +830,6 @@ void KeyframeImport::importSelectedData()
bool useOpacity = m_dataCombo->currentData(Qt::UserRole + 4).toBool();
if (ix == m_targetCombo->currentData().toModelIndex() || fakeRect) {
// Import our keyframes
int frame = 0;
KeyframeImport::ImportRoles convertMode = static_cast<KeyframeImport::ImportRoles> (m_sourceCombo->currentData().toInt());
if (convertMode == ImportRoles::RotoData && m_targetCombo->currentText() == i18n("Rotoscoping shape")) {
QJsonObject json = QJsonDocument::fromJson(selectedData().toLocal8Bit()).object();
......@@ -843,6 +842,7 @@ void KeyframeImport::importSelectedData()
mlt_keyframe_type type;
mlt_rect firstRect = animData->anim_get_rect("key", anim->key_get_frame(0));
for (int i = 0; i < anim->key_count(); i++) {
int frame = 0;
int error = anim->key_get(i, frame, type);
if (error) {
continue;
......@@ -1080,8 +1080,7 @@ void KeyframeImport::updateView()
qDebug()<<"=== Original parameter not found";
return;
}
QString kfrData = m_originalParams.value(ix);
animData->set("original", kfrData.toUtf8().constData());
animData->set("original", m_originalParams.value(ix).toUtf8().constData());
std::shared_ptr<Mlt::Animation> animo(new Mlt::Animation(animData->get_animation("original")));
animo->interpolate();
// wether we are mapping to a fake rectangle
......
......@@ -88,7 +88,7 @@ void UrlListParamWidget::slotRefresh()
m_list->clear();
QStringList names = m_model->data(m_index, AssetParameterModel::ListNamesRole).toStringList();
QStringList values = m_model->data(m_index, AssetParameterModel::ListValuesRole).toStringList();
QString value = m_model->data(m_index, AssetParameterModel::ValueRole).toString();
QString currentValue = m_model->data(m_index, AssetParameterModel::ValueRole).toString();
QString filter = m_model->data(m_index, AssetParameterModel::FilterRole).toString();
filter.remove(0, filter.indexOf("(")+1);
filter.remove(filter.indexOf(")")-1, -1);
......@@ -127,14 +127,14 @@ void UrlListParamWidget::slotRefresh()
}
}
// add all matching files in the location of the current item too
if (!value.isEmpty()) {
QString path = QUrl(value).adjusted(QUrl::RemoveFilename).toString();
if (!currentValue.isEmpty()) {
QString path = QUrl(currentValue).adjusted(QUrl::RemoveFilename).toString();
QDir dir(path);
for (const auto &filename : dir.entryList(m_fileExt, QDir::Files)) {
values.append(dir.filePath(filename));
}
// make sure the current value is added. If it is a duplicate we remove it later
values << value;
values << currentValue;
}
values.removeDuplicates();
......@@ -164,8 +164,8 @@ void UrlListParamWidget::slotRefresh()
m_list->addItem(i18n("Custom…"), QStringLiteral("custom_file"));
// select current value
if (!value.isEmpty()) {
int ix = m_list->findData(value);
if (!currentValue.isEmpty()) {
int ix = m_list->findData(currentValue);
if (ix > -1) {
m_list->setCurrentIndex(ix);
m_currentIndex = ix;
......
......@@ -1900,7 +1900,7 @@ const QString Bin::setDocument(KdenliveDoc *project, const QString &id)
QAction *disableEffects = pCore->window()->actionCollection()->action(QStringLiteral("disable_bin_effects"));
if (disableEffects) {
if (binEffectsDisabled != disableEffects->isChecked()) {
QSignalBlocker bk(disableEffects);
QSignalBlocker effectBk(disableEffects);
disableEffects->setChecked(binEffectsDisabled);
}
}
......@@ -1940,26 +1940,25 @@ void Bin::rebuildFilters(QMap <QString, QString> tags)
}
// Add rating filters
m_filterMenu->addSeparator();
QAction *rateFilter;
for (int i = 1; i< 6; ++i) {
rateFilter = new QAction(QIcon::fromTheme(QStringLiteral("favorite")), i18np("%1 star", "%1 stars", i), &m_filterRateGroup);
for (int i = 1; i < 6; ++i) {
auto *rateFilter = new QAction(QIcon::fromTheme(QStringLiteral("favorite")), i18np("%1 star", "%1 stars", i), &m_filterRateGroup);
rateFilter->setData(QString(".%1").arg(2 * i));
rateFilter->setCheckable(true);
m_filterMenu->addAction(rateFilter);
}
// Add unused filter
m_filterMenu->addSeparator();
QAction *unusedFilter = new QAction(i18n("Unused clips"), this);
auto *unusedFilter = new QAction(i18n("Unused clips"), this);
unusedFilter->setData(QStringLiteral("unused"));
unusedFilter->setCheckable(true);
m_filterMenu->addAction(unusedFilter);
// Add type filters
m_filterMenu->addSeparator();
QMenu *typeMenu = new QMenu(i18n("Filter by type"), m_filterMenu);
auto *typeMenu = new QMenu(i18n("Filter by type"), m_filterMenu);
m_filterMenu->addMenu(typeMenu);
m_filterMenu->addSeparator();
QAction *typeFilter = new QAction(QIcon::fromTheme(QStringLiteral("video-x-generic")), i18n("AV Clip"), &m_filterTypeGroup);
auto *typeFilter = new QAction(QIcon::fromTheme(QStringLiteral("video-x-generic")), i18n("AV Clip"), &m_filterTypeGroup);
typeFilter->setData(ClipType::AV);
typeFilter->setCheckable(true);
typeMenu->addAction(typeFilter);
......@@ -3478,7 +3477,7 @@ void Bin::switchTag(const QString &tag, bool add)
for (auto &clp : children) {
allClips <<clp->clipId();
}
} else if (parentItem->itemType() != AbstractProjectItem::FolderItem) {
} else {
allClips <<parentItem->clipId();
}
}
......@@ -4812,8 +4811,7 @@ bool Bin::addProjectClipInFolder(const QString &path, const QString &parentFolde
Fun redo = []() { return true; };
// Check if folder exists
QString folderId = QStringLiteral("-1");
bool found = false;
QString folderId = QStringLiteral("-1");
// We first try to see if it exists
std::shared_ptr<ProjectFolder> baseFolder = m_itemModel->getFolderByBinId(parentFolder);
if (!baseFolder) {
......@@ -4823,6 +4821,7 @@ bool Bin::addProjectClipInFolder(const QString &path, const QString &parentFolde
// Put clip in parentFolder
folderId = baseFolder->clipId();
} else {
bool found = false;
for (int i = 0; i < baseFolder->childCount(); ++i) {
auto currentItem = std::static_pointer_cast<AbstractProjectItem>(baseFolder->child(i));
if (currentItem->itemType() == AbstractProjectItem::FolderItem && currentItem->name() == folderName) {
......
......@@ -2142,8 +2142,8 @@ QStringList ProjectClip::getAudioStreamEffect(int streamIndex) const
void ProjectClip::updateTimelineOnReload()
{
if (m_registeredClips.size() > 0 && m_registeredClips.size() < 3) {
bool reloadProducer = true;
for (const auto &clip : m_registeredClips) {
bool reloadProducer = true;
if (auto timeline = clip.second.lock()) {
if (timeline->getClipPlaytime(clip.first) < static_cast<int>(frameDuration())) {
reloadProducer = false;
......
......@@ -402,10 +402,10 @@ const QVector<uint8_t> ProjectItemModel::getAudioLevelsByBinID(const QString &bi
double ProjectItemModel::getAudioMaxLevel(const QString &binId, int stream)
{
READ_LOCK();
for (const auto &clip : m_allItems) {
auto c = std::static_pointer_cast<AbstractProjectItem>(clip.second.lock());
if (c->itemType() == AbstractProjectItem::ClipItem && c->clipId() == binId) {
auto clip = std::static_pointer_cast<ProjectClip>(c);
for (const auto &item : m_allItems) {
auto i = std::static_pointer_cast<AbstractProjectItem>(item.second.lock());
if (i->itemType() == AbstractProjectItem::ClipItem && i->clipId() == binId) {
auto clip = std::static_pointer_cast<ProjectClip>(i);
if (clip) {
return clip->getAudioMax(stream);
}
......
......@@ -1572,7 +1572,7 @@ void RenderWidget::generateRenderFiles(QDomDocument doc, const QString &playlist
QString playlistName = playlistPath;
myConsumer.setAttribute(QStringLiteral("mlt_service"), QStringLiteral("avformat"));
if (passes == 2 && i == 1) {
playlistName = playlistName.section(QLatin1Char('.'), 0, -2) + QString("-pass%1.").arg(i + 1) + playlistName.section(QLatin1Char('.'), -1);
playlistName = playlistName.section(QLatin1Char('.'), 0, -2) + QString("-pass%1.").arg(2) + playlistName.section(QLatin1Char('.'), -1);
}
playlists << playlistName;
myConsumer.setAttribute(QStringLiteral("target"), mytarget);
......
......@@ -967,7 +967,7 @@ void TextBasedEdit::slotProcessSpeech()
}
val = obj2.last();
if (val.isObject() && val.toObject().keys().contains("end")) {
double ms = val.toObject().value("end").toDouble() + m_clipOffset;
ms = val.toObject().value("end").toDouble() + m_clipOffset;
sentenceZone.second = ms;
m_lastPosition = GenTime(ms).frames(pCore->getCurrentFps());
if (m_clipDuration > 0.) {
......
......@@ -955,13 +955,13 @@ void RemapView::wheelEvent(QWheelEvent *event)
update();
return;
}
int change = event->angleDelta().y() > 0 ? -1 : 1;
int pos = qBound(0, m_position + change, m_duration - 1);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
if (event->position().y() < m_bottomView) {
#else
if (event->y() < m_bottomView) {
#endif
int change = event->angleDelta().y() > 0 ? -1 : 1;
int pos = qBound(0, m_position + change, m_duration - 1);
emit seekToPos(pos + m_inFrame, -1);
} else {
// Wheel on zoom bar, scroll
......@@ -1425,9 +1425,9 @@ void RemapView::paintEvent(QPaintEvent *event)
QMapIterator<int, int> i(m_keyframes);
while (i.hasNext()) {
i.next();
double outPos = (double)(i.key() - m_inFrame) * m_scale;
double inPos = (double)(i.value() - m_inFrame) * m_scale;
if ((inPos < m_zoomStart && outPos < m_zoomStart) || (qFloor(inPos) > zoomEnd && qFloor(outPos) > zoomEnd)) {
double kfOutPos = (double)(i.key() - m_inFrame) * m_scale;
double kfInPos = (double)(i.value() - m_inFrame) * m_scale;
if ((kfInPos < m_zoomStart && kfOutPos < m_zoomStart) || (qFloor(kfInPos) > zoomEnd && qFloor(kfOutPos) > zoomEnd)) {
continue;
}
if (m_currentKeyframe.first == i.key()) {
......@@ -1440,18 +1440,18 @@ void RemapView::paintEvent(QPaintEvent *event)
p.setPen(m_colKeyframe);
p.setBrush(m_colKeyframe);
}
inPos -= m_zoomStart;
inPos *= m_zoomFactor;
inPos += m_offset;
outPos -= m_zoomStart;
outPos *= m_zoomFactor;
outPos += m_offset;
kfInPos -= m_zoomStart;
kfInPos *= m_zoomFactor;
kfInPos += m_offset;
kfOutPos -= m_zoomStart;
kfOutPos *= m_zoomFactor;
kfOutPos += m_offset;
p.drawLine(inPos, m_lineHeight + m_lineHeight * 0.75, outPos, m_bottomView - m_lineHeight * 1.75);
p.drawLine(inPos, m_lineHeight, inPos, m_lineHeight + m_lineHeight / 2);
p.drawLine(outPos, m_bottomView - m_lineHeight, outPos, m_bottomView - m_lineHeight * 1.5);
p.drawEllipse(QRectF(inPos - m_lineHeight / 4.0, m_lineHeight + m_lineHeight / 2, m_lineHeight / 2, m_lineHeight / 2));
p.drawEllipse(QRectF(outPos - m_lineHeight / 4.0, m_bottomView - 2 * m_lineHeight, m_lineHeight / 2, m_lineHeight / 2));
p.drawLine(kfInPos, m_lineHeight + m_lineHeight * 0.75, kfOutPos, m_bottomView - m_lineHeight * 1.75);
p.drawLine(kfInPos, m_lineHeight, kfInPos, m_lineHeight + m_lineHeight / 2);
p.drawLine(kfOutPos, m_bottomView - m_lineHeight, kfOutPos, m_bottomView - m_lineHeight * 1.5);
p.drawEllipse(QRectF(kfInPos - m_lineHeight / 4.0, m_lineHeight + m_lineHeight / 2, m_lineHeight / 2, m_lineHeight / 2));
p.drawEllipse(QRectF(kfOutPos - m_lineHeight / 4.0, m_bottomView - 2 * m_lineHeight, m_lineHeight / 2, m_lineHeight / 2));
}
/*
......@@ -1771,12 +1771,12 @@ void TimeRemap::setClip(std::shared_ptr<ProjectClip> clip, int in, int out)
case mlt_service_chain_type: {
Mlt::Chain fromChain(*track.get());
int count = fromChain.link_count();
for (int i = 0; i < count; i++) {
QScopedPointer<Mlt::Link> fromLink(fromChain.link(i));
for (int j = 0; j < count; j++) {
QScopedPointer<Mlt::Link> fromLink(fromChain.link(j));
if (fromLink && fromLink->is_valid() && fromLink->get("mlt_service")) {
if (fromLink->get("mlt_service") == QLatin1String("timeremap")) {
// Found a timeremap effect, read params
m_view->m_remapLink = std::make_shared<Mlt::Link>(fromChain.link(i)->get_link());
m_view->m_remapLink = std::make_shared<Mlt::Link>(fromChain.link(j)->get_link());
QString mapData(fromLink->get("map"));
m_view->loadKeyframes(mapData);
keyframesLoaded = true;
......@@ -1789,20 +1789,20 @@ void TimeRemap::setClip(std::shared_ptr<ProjectClip> clip, int in, int out)
case mlt_service_playlist_type: {
// that is a single track
Mlt::Playlist local_playlist(*track);
int max = local_playlist.count();
qDebug()<<"==== PLAYLIST COUNT: "<<max;
if (max == 1) {
int count = local_playlist.count();
qDebug()<<"==== PLAYLIST COUNT: "<<count;
if (count == 1) {
Mlt::Producer prod = local_playlist.get_clip(0)->parent();
qDebug()<<"==== GOT PROD TYPE: "<<prod.type()<<" = "<<prod.get("mlt_service")<<" = "<<prod.get("resource");
if (prod.type() == mlt_service_chain_type) {
Mlt::Chain fromChain(prod);
int count = fromChain.link_count();
for (int i = 0; i < count; i++) {
QScopedPointer<Mlt::Link> fromLink(fromChain.link(i));
for (int j = 0; j < count; j++) {
QScopedPointer<Mlt::Link> fromLink(fromChain.link(j));
if (fromLink && fromLink->is_valid() && fromLink->get("mlt_service")) {
if (fromLink->get("mlt_service") == QLatin1String("timeremap")) {
// Found a timeremap effect, read params
m_view->m_remapLink = std::make_shared<Mlt::Link>(fromChain.link(i)->get_link());
m_view->m_remapLink = std::make_shared<Mlt::Link>(fromChain.link(j)->get_link());
QString mapData(fromLink->get("map"));
m_view->loadKeyframes(mapData);
keyframesLoaded = true;
......
......@@ -1800,14 +1800,14 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
newNodeTag.appendChild(text);
root.replaceChild(newNodeTag, nodelist);
QDomElement e = doc.documentElement();
e.setAttribute("id", newId);
//QDomElement e = doc.documentElement();
//e.setAttribute("id", newId);
auto params = doc.elementsByTagName(QStringLiteral("parameter"));
for (int i = 0; i < params.count(); i++) {
QString paramName = params.at(i).attributes().namedItem("name").nodeValue();
for (int j = 0; j < params.count(); j++) {
QString paramName = params.at(j).attributes().namedItem("name").nodeValue();
if(paramName == QStringLiteral("transition.geometry")) {
QDomElement e = params.at(i).toElement();
QDomElement e = params.at(j).toElement();
e.setAttribute("name", QStringLiteral("transition.rect"));
}
}
......
......@@ -1710,7 +1710,7 @@ QDir KdenliveDoc::getCacheDir(CacheType type, bool *ok) const
// Use specified folder to store all files
kdenliveCacheDir = m_projectFolder;
}
basePath = kdenliveCacheDir + QLatin1Char('/') + documentId;
basePath = kdenliveCacheDir + QLatin1Char('/') + documentId; // CacheBase
switch (type) {
case SystemCacheRoot:
return QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
......
......@@ -10,7 +10,7 @@
#ifndef COLORWHEELITEM_H
#define COLORWHEELITEM_H
#include "utils/negqcolor.h"
#include "utils/qcolorutils.h"
#include <QImage>
#include <QQuickPaintedItem>
......
......@@ -216,8 +216,6 @@ void TranscodeTask::run()
QMetaObject::invokeMethod(pCore.get(), "displayBinLogMessage", Qt::QueuedConnection, Q_ARG(QString, i18n("Failed to create file.")),
Q_ARG(int, int(KMessageWidget::Warning)), Q_ARG(QString, m_logDetails));
} else {
QString id = QString::number(m_owner.second);
auto binClip = pCore->projectItemModel()->getClipByBinID(id);
if (m_replaceProducer && binClip) {
QMap <QString, QString> sourceProps;
QMap <QString, QString> newProps;
......@@ -225,7 +223,8 @@ void TranscodeTask::run()
sourceProps.insert(QStringLiteral("kdenlive:clipname"), binClip->clipName());
newProps.insert(QStringLiteral("resource"), destUrl);
newProps.insert(QStringLiteral("kdenlive:clipname"), QFileInfo(destUrl).fileName());
pCore->bin()->slotEditClipCommand(id, sourceProps, newProps);
QString id = QString::number(m_owner.second);
pCore->bin()->slotEditClipCommand(binClip->clipId(), sourceProps, newProps);
} else {
QString folder = QStringLiteral("-1");
if (binClip) {
......@@ -252,7 +251,6 @@ void TranscodeTask::processLogInfo()
{
const QString buffer = QString::fromUtf8(m_jobProcess->readAllStandardError());
m_logDetails.append(buffer);
int progress = 0;
if (m_isFfmpegJob) {
// Parse FFmpeg output
if (m_jobDuration == 0) {
......@@ -267,6 +265,7 @@ void TranscodeTask::processLogInfo()
}
}
} else if (buffer.contains(QLatin1String("time="))) {
int progress = 0;
QString time = buffer.section(QStringLiteral("time="), 1, 1).simplified().section(QLatin1Char(' '), 0, 0);
if (!time.isEmpty()) {
QStringList numbers = time.split(QLatin1Char(':'));
......@@ -288,7 +287,6 @@ void TranscodeTask::processLogInfo()
if (buffer.contains(QLatin1String("percentage:"))) {
m_progress = buffer.section(QStringLiteral("percentage:"), 1).simplified().section(QLatin1Char(' '), 0, 0).toInt();
QMetaObject::invokeMethod(m_object, "updateJobProgress");
//emit jobProgress(progress);
}
}
}
......@@ -127,7 +127,7 @@ void AudioCorrelation::correlate(const qint64 *envMain, size_t sizeMain, const q
t.start();
for (size_t shift = -sizeSub; shift <= sizeMain; ++shift) {
if (shift <= 0) {
if (shift == 0) {
left = envSub - shift;
right = envMain;
size = std::min(sizeSub + shift, sizeMain);
......
......@@ -12,10 +12,10 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
#include <cstdlib>
AudioInfo::AudioInfo(const std::shared_ptr<Mlt::Producer> &producer)
: m_list(QList<AudioStreamInfo *>())
{
// Since we already receive an MLT producer, we do not need to initialize MLT:
// Mlt::Factory::init(nullptr);
m_list = QList<AudioStreamInfo *>();
// Get the number of streams and add the information of each of them if it is an audio stream.
int streams = producer->get_int("meta.media.nb_streams");
for (int i = 0; i < streams; ++i) {
......
Supports Markdown
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