Commit 85f6cd3a authored by Vincent Pinon's avatar Vincent Pinon
Browse files

Fix more GCC warnings

parent f6a0a362
......@@ -199,7 +199,7 @@ void AbstractTreeModel::deregisterItem(int id, TreeItem *item)
int AbstractTreeModel::clipsCount() const
{
return m_allItems.size();
return (int)m_allItems.size();
}
std::shared_ptr<TreeItem> AbstractTreeModel::getItemById(int id) const
......
......@@ -278,5 +278,6 @@ ObjectId AssetPanel::effectStackOwner()
void AssetPanel::parameterChanged(QString name, int value)
{
Q_UNUSED(name)
emit changeSpeed(value);
}
......@@ -156,7 +156,7 @@ void AssetParameterView::refresh(const QModelIndex &topLeft, const QModelIndex &
Q_ASSERT(bottomRight.row() < (int)m_widgets.size());
for (int i = topLeft.row(); i <= bottomRight.row(); ++i) {
m_widgets[i]->slotRefresh();
m_widgets[(uint)i]->slotRefresh();
}
}
......
......@@ -2032,6 +2032,12 @@ const QString Bin::getDocumentProperty(const QString &key)
void Bin::slotUpdateJobStatus(const QString &id, int jobType, int status, const QString &label, const QString &actionName, const QString &details)
{
Q_UNUSED(id)
Q_UNUSED(jobType)
Q_UNUSED(status)
Q_UNUSED(label)
Q_UNUSED(actionName)
Q_UNUSED(details)
// TODO refac
/*
std::shared_ptr<ProjectClip> clip = m_itemModel->getClipByBinID(id);
......@@ -2331,6 +2337,9 @@ void Bin::slotItemDropped(const QList<QUrl> &urls, const QModelIndex &parent)
void Bin::slotExpandUrl(const ItemInfo &info, const QString &url, QUndoCommand *command)
{
Q_UNUSED(info)
Q_UNUSED(url)
Q_UNUSED(command)
// TODO reimplement this
/*
// Create folder to hold imported clips
......@@ -2493,6 +2502,11 @@ Timecode Bin::projectTimecode() const
void Bin::slotStartFilterJob(const ItemInfo &info, const QString &id, QMap<QString, QString> &filterParams, QMap<QString, QString> &consumerParams,
QMap<QString, QString> &extraParams)
{
Q_UNUSED(info)
Q_UNUSED(id)
Q_UNUSED(filterParams)
Q_UNUSED(consumerParams)
Q_UNUSED(extraParams)
// TODO refac
/*
std::shared_ptr<ProjectClip> clip = getBinClip(id);
......@@ -2700,6 +2714,7 @@ void Bin::slotGotFilterJobResults(const QString &id, int startPos, int track, co
void Bin::slotGetCurrentProjectImage(const QString &clipId, bool request)
{
Q_UNUSED(clipId)
// TODO refact : look at this
// if (!clipId.isEmpty()) {
// (pCore->projectManager()->currentTimeline()->hideClip(clipId, request));
......@@ -2858,6 +2873,8 @@ void Bin::slotUpdateClipProperties(const QString &id, const QMap<QString, QStrin
void Bin::updateTimelineProducers(const QString &id, const QMap<QString, QString> &passProperties)
{
Q_UNUSED(id)
Q_UNUSED(passProperties)
// TODO REFAC
// pCore->projectManager()->currentTimeline()->updateClipProperties(id, passProperties);
// m_doc->renderer()->updateSlowMotionProducers(id, passProperties);
......
......@@ -126,6 +126,7 @@ void BinPlaylist::setRetainIn(Mlt::Tractor *modelTractor)
void BinPlaylist::saveDocumentProperties(const QMap<QString, QString> &props, const QMap<QString, QString> &metadata,
std::shared_ptr<MarkerListModel> guideModel)
{
Q_UNUSED(guideModel)
// Clear previous properites
Mlt::Properties playlistProps(m_binPlaylist->get_properties());
Mlt::Properties docProperties;
......
......@@ -341,6 +341,7 @@ QPixmap ProjectClip::thumbnail(int width, int height)
bool ProjectClip::setProducer(std::shared_ptr<Mlt::Producer> producer, bool replaceProducer)
{
Q_UNUSED(replaceProducer)
qDebug() << "################### ProjectClip::setproducer";
updateProducer(std::move(producer));
connectEffectStack();
......@@ -913,14 +914,14 @@ void ProjectClip::registerTimelineClip(std::weak_ptr<TimelineModel> timeline, in
Q_ASSERT(m_registeredClips.count(clipId) == 0);
Q_ASSERT(!timeline.expired());
m_registeredClips[clipId] = std::move(timeline);
setRefCount(m_registeredClips.size());
setRefCount((uint)m_registeredClips.size());
}
void ProjectClip::deregisterTimelineClip(int clipId)
{
Q_ASSERT(m_registeredClips.count(clipId) > 0);
m_registeredClips.erase(clipId);
setRefCount(m_registeredClips.size());
setRefCount((uint)m_registeredClips.size());
}
QList<int> ProjectClip::timelineInstances() const
......
......@@ -212,7 +212,7 @@ void MltDeviceCapture::emitFrameUpdated(Mlt::Frame &frame)
const uchar *image = frame.get_image(format, width, height);
QImage qimage(width, height, QImage::Format_RGB888);
// QImage qimage(width, height, QImage::Format_ARGB32_Premultiplied);
memcpy(qimage.bits(), image, (size_t)width * height * 3);
memcpy(qimage.bits(), image, (size_t)(width * height * 3));
emit frameUpdated(qimage);
}
......@@ -249,7 +249,7 @@ void MltDeviceCapture::showAudio(Mlt::Frame &frame)
// Data format: [ c00 c10 c01 c11 c02 c12 c03 c13 ... c0{samples-1} c1{samples-1} for 2 channels.
// So the vector is of size samples*channels.
audioShortVector sampleVector(samples * num_channels);
memcpy(sampleVector.data(), data, static_cast<size_t>(samples * num_channels * sizeof(qint16)));
memcpy(sampleVector.data(), data, (size_t)(samples * num_channels) * sizeof(qint16));
if (samples > 0) {
emit audioSamplesSignal(sampleVector, freq, num_channels, samples);
}
......
......@@ -772,7 +772,7 @@ void KdenliveSettingsDialog::updateSettings()
updateCapturePath = true;
}
if (m_configCapture.kcfg_v4l_format->currentIndex() != KdenliveSettings::v4l_format()) {
if (m_configCapture.kcfg_v4l_format->currentIndex() != (int)KdenliveSettings::v4l_format()) {
saveCurrentV4lProfile();
KdenliveSettings::setV4l_format(0);
}
......
......@@ -371,7 +371,7 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
}
// Unsupported document versions
if (version == 0.5 || version == 0.7) {
if (version <= 0.5 || version == 0.7) {
// 0.7 is unsupported
// qCDebug(KDENLIVE_LOG) << "Unable to open document with version " << version;
KMessageBox::sorry(QApplication::activeWindow(), i18n("This project type is unsupported (version %1) and can't be loaded.", version),
......
......@@ -818,6 +818,7 @@ QStringList KdenliveDoc::getBinFolderClipIds(const QString &folderId) const
void KdenliveDoc::slotCreateTextTemplateClip(const QString &group, const QString &groupId, QUrl path)
{
Q_UNUSED(group)
// TODO refac: this seem to be a duplicate of ClipCreationDialog::createTitleTemplateClip. See if we can merge
QString titlesFolder = QDir::cleanPath(m_projectFolder + QStringLiteral("/titles/"));
if (path.isEmpty()) {
......@@ -1323,6 +1324,8 @@ void KdenliveDoc::slotSwitchProfile(const QString &profile_path)
void KdenliveDoc::switchProfile(std::unique_ptr<ProfileParam> &profile, const QString &id, const QDomElement &xml)
{
Q_UNUSED(id)
Q_UNUSED(xml)
// Request profile update
QString matchingProfile = ProfileRepository::get()->findMatchingProfile(profile.get());
if (matchingProfile.isEmpty() && (profile->width() % 8 != 0)) {
......@@ -1511,6 +1514,7 @@ void KdenliveDoc::checkPreviewStack()
void KdenliveDoc::saveMltPlaylist(const QString &fileName)
{
Q_UNUSED(fileName)
// TODO REFAC
// m_render->preparePreviewRendering(fileName);
}
......
......@@ -304,7 +304,7 @@ void DvdWizardVob::slotAddVobFile(const QUrl &url, const QString &chapters, bool
double fps = profile.fps();
profile.from_producer(*producer);
profile.set_explicit(1);
if (profile.fps() != fps) {
if (abs(profile.fps()-fps)>0.001) {
// fps changed, rebuild producer
delete producer;
producer = new Mlt::Producer(profile, resource.toUtf8().data());
......@@ -793,7 +793,7 @@ void DvdWizardVob::slotTranscodedClip(const QString &src, const QString &transco
double fps = profile.fps();
profile.from_producer(*producer);
profile.set_explicit(1);
if (profile.fps() != fps) {
if (abs(profile.fps()-fps)>0.001) {
// fps changed, rebuild producer
delete producer;
producer = new Mlt::Producer(profile, resource.toUtf8().data());
......
......@@ -209,16 +209,16 @@ bool EffectStackModel::adjustStackLength(bool adjustFromEnd, int oldIn, int newI
} else if (fadeOutDuration > 0 && fadeOuts.contains(std::static_pointer_cast<TreeItem>(rootItem->child(i))->getId())) {
std::shared_ptr<EffectItemModel> effect = std::static_pointer_cast<EffectItemModel>(rootItem->child(i));
int effectDuration = qMin(fadeOutDuration, duration);
int newIn = out - effectDuration;
int oldIn = effect->filter().get_int("in");
int newFadeIn = out - effectDuration;
int oldFadeIn = effect->filter().get_int("in");
int oldOut = effect->filter().get_int("out");
int referenceEffectIn = effect->filter().get_int("_refin");
if (referenceEffectIn <= 0) {
referenceEffectIn = oldIn;
referenceEffectIn = oldFadeIn;
effect->filter().set("_refin", referenceEffectIn);
}
Fun operation = [this, effect, newIn, out]() {
effect->setParameter(QStringLiteral("in"), newIn, false);
Fun operation = [this, effect, newFadeIn, out]() {
effect->setParameter(QStringLiteral("in"), newFadeIn, false);
effect->setParameter(QStringLiteral("out"), out, false);
return true;
};
......@@ -509,13 +509,13 @@ bool EffectStackModel::checkConsistency()
qDebug() << "ERROR: unavailable service";
return false;
}
if (ptr->filter_count() != allFilters.size()) {
if (ptr->filter_count() != (int)allFilters.size()) {
qDebug() << "ERROR: Wrong filter count";
return false;
}
for (uint i = 0; i < allFilters.size(); ++i) {
auto mltFilter = ptr->filter(i)->get_filter();
auto mltFilter = ptr->filter((int)i)->get_filter();
auto currentFilter = allFilters[i]->filter().get_filter();
if (mltFilter != currentFilter) {
qDebug() << "ERROR: filter " << i << "differ";
......
......@@ -158,7 +158,7 @@ NegQColor ColorWheelItem::colorForPoint(const QPoint &point)
}
if (m_isInSquare) {
qreal value = 1.0 - qreal(point.y() - m_margin) / (wheelSize() - m_margin * 2);
if (m_zeroShift != 0) {
if (qAbs(m_zeroShift)>0) {
value = value - m_zeroShift;
}
return NegQColor::fromHsvF(m_color.hueF(), m_color.saturationF(), value);
......@@ -291,7 +291,7 @@ void ColorWheelItem::drawWheelDot(QPainter &painter)
void ColorWheelItem::drawSliderBar(QPainter &painter)
{
qreal value = 1.0 - m_color.valueF();
if (m_zeroShift != 0) {
if (qAbs(m_zeroShift) > 0) {
value -= m_zeroShift;
}
int ws = wheelSize() * qApp->devicePixelRatio();
......
......@@ -219,7 +219,7 @@ void AudioThumbJob::updateFfmpegProgress()
const QStringList lines = result.split(QLatin1Char('\n'));
for (const QString &data : lines) {
if (data.startsWith(QStringLiteral("out_time_ms"))) {
long ms = data.section(QLatin1Char('='), 1).toLong();
double ms = data.section(QLatin1Char('='), 1).toDouble();
emit jobProgress((int) (ms / m_binClip->duration().ms() / 10));
} else {
m_logDetails += data + QStringLiteral("\n");
......
......@@ -35,7 +35,6 @@
#include <unistd.h>
#include "mediactrl.h"
#include <linux/input.h>
static char *_shuttle_name = (char *)"Shuttle";
static char *_jog_name = (char *)"Jog";
......
......@@ -22,6 +22,7 @@
#define MEDIACTRL_H
#include <sys/time.h>
#include <linux/input.h>
// just to make the code more readable
#define KEY_RELEASE 0x00
......
......@@ -474,7 +474,7 @@ void GLWidget::paintGL()
// Set model view.
QMatrix4x4 modelView;
if (m_zoom != 1.0) {
if (qAbs(m_zoom-1.0)>0.01) {
if ((offset().x() != 0) || (offset().y() != 0)) modelView.translate(-offset().x() * devicePixelRatio(), offset().y() * devicePixelRatio());
modelView.scale(zoom(), zoom());
}
......@@ -571,18 +571,18 @@ void GLWidget::wheelEvent(QWheelEvent *event)
{
if (((event->modifiers() & Qt::ControlModifier) != 0u) && ((event->modifiers() & Qt::ShiftModifier) != 0u)) {
if (event->delta() > 0) {
if (m_zoom == 1.0f) {
if (qAbs(m_zoom-1.0)<0.01) {
setZoom(2.0f);
} else if (m_zoom == 2.0f) {
} else if (qAbs(m_zoom-2.0)<0.01) {
setZoom(3.0f);
} else if (m_zoom < 1.0f) {
} else if (m_zoom < 1.0) {
setZoom(m_zoom * 2);
}
} else {
if (m_zoom == 3.0f) {
setZoom(2.0f);
} else if (m_zoom == 2.0f) {
setZoom(1.0f);
if (qAbs(m_zoom-3.0)<0.01) {
setZoom(2.0);
} else if (qAbs(m_zoom-2.0)<0.01) {
setZoom(1.0);
} else if (m_zoom > 0.2) {
setZoom(m_zoom / 2);
}
......@@ -599,7 +599,7 @@ void GLWidget::requestSeek()
return;
}
if (m_proxy->seekPosition() != SEEK_INACTIVE) {
if (m_producer->get_speed() != 0) {
if (qAbs(m_producer->get_speed()) > 0.001) {
m_consumer->purge();
}
m_producer->seek(m_proxy->seekPosition());
......@@ -615,7 +615,7 @@ void GLWidget::seek(int pos)
// Testing puspose only
if (m_proxy->seekPosition() == SEEK_INACTIVE) {
m_proxy->setSeekPosition(pos);
if (m_producer->get_speed() != 0) {
if (qAbs(m_producer->get_speed()) > 0.001) {
m_consumer->purge();
}
m_producer->seek(pos);
......@@ -630,7 +630,7 @@ void GLWidget::seek(int pos)
void GLWidget::requestRefresh()
{
if ((m_producer != nullptr) && (m_producer->get_speed() == 0)) {
if ((m_producer != nullptr) && (qAbs(m_producer->get_speed()) < 0.001)) {
m_refreshTimer.start();
}
}
......@@ -657,12 +657,12 @@ bool GLWidget::checkFrameNumber(int pos)
if (m_proxy->seekPosition() != SEEK_INACTIVE) {
m_producer->set_speed(0);
m_producer->seek(m_proxy->seekPosition());
if (speed == 0.) {
if (qAbs(speed) < 0.001) {
m_consumer->set("refresh", 1);
} else {
m_producer->set_speed(speed);
}
} else if (speed == 0.) {
} else if (qAbs(speed) < 0.001) {
if (m_isLoopMode) {
if (pos >= m_producer->get_int("out") - 1) {
m_consumer->purge();
......@@ -1276,7 +1276,8 @@ QRect GLWidget::displayRect() const
QPoint GLWidget::offset() const
{
return QPoint(m_offset.x() - (m_monitorProfile->width() * m_zoom - width()) / 2, m_offset.y() - (m_monitorProfile->height() * m_zoom - height()) / 2);
return QPoint(m_offset.x() - ((int)((float)m_monitorProfile->width() * m_zoom) - width()) / 2,
m_offset.y() - ((int)((float)m_monitorProfile->height() * m_zoom) - height()) / 2);
}
void GLWidget::setZoom(float zoom)
......@@ -1698,7 +1699,7 @@ void GLWidget::switchPlay(bool play, double speed)
m_consumer->stop();
}
}
if (currentSpeed == 0) {
if (qAbs(currentSpeed) < 0.001) {
m_consumer->start();
m_consumer->set("refresh", 1);
} else {
......
......@@ -702,8 +702,8 @@ void Monitor::resizeEvent(QResizeEvent *event)
{
Q_UNUSED(event)
if (m_glMonitor->zoom() > 0.0f) {
float horizontal = float(m_horizontalScroll->value()) / m_horizontalScroll->maximum();
float vertical = float(m_verticalScroll->value()) / m_verticalScroll->maximum();
float horizontal = float(m_horizontalScroll->value()) / float(m_horizontalScroll->maximum());
float vertical = float(m_verticalScroll->value()) / float(m_verticalScroll->maximum());
adjustScrollBars(horizontal, vertical);
} else {
m_horizontalScroll->hide();
......@@ -715,24 +715,24 @@ void Monitor::adjustScrollBars(float horizontal, float vertical)
{
if (m_glMonitor->zoom() > 1.0f) {
m_horizontalScroll->setPageStep(m_glWidget->width());
m_horizontalScroll->setMaximum(m_glMonitor->profileSize().width() * m_glMonitor->zoom() - m_horizontalScroll->pageStep());
m_horizontalScroll->setMaximum((int)((float)m_glMonitor->profileSize().width() * m_glMonitor->zoom()) - m_horizontalScroll->pageStep());
m_horizontalScroll->setValue(qRound(horizontal * m_horizontalScroll->maximum()));
emit m_horizontalScroll->valueChanged(m_horizontalScroll->value());
m_horizontalScroll->show();
} else {
int max = m_glMonitor->profileSize().width() * m_glMonitor->zoom() - m_glWidget->width();
int max = (int)((float)m_glMonitor->profileSize().width() * m_glMonitor->zoom()) - m_glWidget->width();
emit m_horizontalScroll->valueChanged(qRound(0.5 * max));
m_horizontalScroll->hide();
}
if (m_glMonitor->zoom() > 1.0f) {
m_verticalScroll->setPageStep(m_glWidget->height());
m_verticalScroll->setMaximum(m_glMonitor->profileSize().height() * m_glMonitor->zoom() - m_verticalScroll->pageStep());
m_verticalScroll->setValue(qRound(vertical * m_verticalScroll->maximum()));
m_verticalScroll->setMaximum((int)((float)m_glMonitor->profileSize().height() * m_glMonitor->zoom()) - m_verticalScroll->pageStep());
m_verticalScroll->setValue((int)((float)m_verticalScroll->maximum()*vertical));
emit m_verticalScroll->valueChanged(m_verticalScroll->value());
m_verticalScroll->show();
} else {
int max = m_glMonitor->profileSize().height() * m_glMonitor->zoom() - m_glWidget->height();
int max = (int)((float)m_glMonitor->profileSize().height() * m_glMonitor->zoom()) - m_glWidget->height();
emit m_verticalScroll->valueChanged(qRound(0.5 * max));
m_verticalScroll->hide();
}
......@@ -740,7 +740,7 @@ void Monitor::adjustScrollBars(float horizontal, float vertical)
void Monitor::setZoom()
{
if (m_glMonitor->zoom() == 1.0f) {
if (qAbs(m_glMonitor->zoom() - 1.0) < 0.01) {
m_horizontalScroll->hide();
m_verticalScroll->hide();
m_glMonitor->setOffsetX(m_horizontalScroll->value(), m_horizontalScroll->maximum());
......
......@@ -116,6 +116,7 @@ void ProjectManager::init(const QUrl &projectUrl, const QString &clipList)
void ProjectManager::newFile(bool showProjectSettings, bool force)
{
Q_UNUSED(force)
// fix mantis#3160
QUrl startFile = QUrl::fromLocalFile(KdenliveSettings::defaultprojectfolder() + QStringLiteral("/_untitled.kdenlive"));
if (checkForBackupFile(startFile)) {
......@@ -325,6 +326,7 @@ void ProjectManager::saveRecentFiles()
void ProjectManager::slotSaveSelection(const QString &path)
{
Q_UNUSED(path)
// TODO refac : look at this
// m_trackView->projectView()->exportTimelineSelection(path);
}
......
......@@ -606,7 +606,7 @@ void Render::switchPlay(bool play, double speed)
m_mltConsumer->stop();
}
}
if (currentSpeed == 0) {
if (qFuzzyIsNull(currentSpeed)) {
m_mltConsumer->start();
m_isRefreshing = true;
m_mltConsumer->set("refresh", 1);
......@@ -631,13 +631,13 @@ void Render::play(double speed)
return;
}
double current_speed = m_mltProducer->get_speed();
if (current_speed == speed) {
if (qFuzzyCompare(current_speed, speed)) {
return;
}
if (m_isZoneMode) {
resetZoneMode();
}
if (speed != 0 && m_mltConsumer->get_int("real_time") != m_qmlView->realTime()) {
if (qFuzzyIsNull(speed) && m_mltConsumer->get_int("real_time") != m_qmlView->realTime()) {
m_mltConsumer->set("real_time", m_qmlView->realTime());
m_mltConsumer->set("buffer", 25);
m_mltConsumer->set("prefill", 1);
......@@ -646,7 +646,7 @@ void Render::play(double speed)
m_mltConsumer->stop();
}
}
if (current_speed == 0) {
if (qFuzzyIsNull(current_speed)) {
m_mltConsumer->start();
m_isRefreshing = true;
m_mltConsumer->set("refresh", 1);
......@@ -735,7 +735,7 @@ void Render::seekToFrameDiff(int diff)
void Render::doRefresh()
{
if ((m_mltProducer != nullptr) && (playSpeed() == 0) && m_isActive) {
if ((m_mltProducer != nullptr) && qFuzzyIsNull(playSpeed()) && m_isActive) {
if (m_isRefreshing) {
m_refreshTimer.start();
} else {
......@@ -794,7 +794,7 @@ bool Render::isPlaying() const
if ((m_mltConsumer == nullptr) || m_mltConsumer->is_stopped()) {
return false;
}
return playSpeed() != 0;
return !qFuzzyIsNull(playSpeed());
}
double Render::playSpeed() const
......@@ -815,7 +815,7 @@ GenTime Render::seekPosition() const
int Render::seekFramePosition() const
{
if ((m_mltProducer != nullptr) && m_mltProducer->get_speed() == 0) {
if ((m_mltProducer != nullptr) && qFuzzyIsNull(m_mltProducer->get_speed())) {
return (int)m_mltProducer->position();
}
if (m_mltConsumer) {
......@@ -859,7 +859,7 @@ bool Render::checkFrameNumber(int pos)
double speed = m_mltProducer->get_speed();
m_mltProducer->set_speed(0);
m_mltProducer->seek(requestedSeekPosition);
if (speed == 0) {
if (qFuzzyIsNull(speed)) {
m_mltConsumer->set("refresh", 1);
} else {
m_mltProducer->set_speed(speed);
......@@ -874,7 +874,7 @@ bool Render::checkFrameNumber(int pos)
m_mltProducer->set_speed(1.0);
m_mltConsumer->set("refresh", 1);
} else {
if (m_mltProducer->get_speed() == 0) {
if (qFuzzyIsNull(m_mltProducer->get_speed())) {
return false;
}
}
......
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