Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 6dc2841b authored by Vincent Pinon's avatar Vincent Pinon

Fix GCC warnings

parent fad61c57
......@@ -41,7 +41,7 @@ AssetCommand::AssetCommand(std::shared_ptr<AssetParameterModel> model, const QMo
setText(i18n("Edit %1", TransitionsRepository::get()->getName(id)));
}
QVariant previousVal = m_model->data(index, AssetParameterModel::ValueRole);
m_oldValue = previousVal.type() == QMetaType::Double ? locale.toString(previousVal.toDouble()) : previousVal.toString();
m_oldValue = previousVal.type() == QVariant::Double ? locale.toString(previousVal.toDouble()) : previousVal.toString();
}
void AssetCommand::undo()
......
......@@ -291,7 +291,7 @@ void KeyframeWidget::addParameter(const QPersistentModelIndex &index)
double defaultValue = m_model->data(index, AssetParameterModel::DefaultRole).toDouble();
int decimals = m_model->data(index, AssetParameterModel::DecimalsRole).toInt();
double factor = locale.toDouble(m_model->data(index, AssetParameterModel::FactorRole).toString());
factor = factor == 0 ? 1 : factor;
factor = qFuzzyIsNull(factor) ? 1 : factor;
auto doubleWidget = new DoubleWidget(name, value * factor, min, max, defaultValue, comment, -1, suffix, decimals, this);
doubleWidget->factor = factor;
connect(doubleWidget, &DoubleWidget::valueChanged,
......
......@@ -81,6 +81,7 @@ void FileWatcher::slotUrlModified(const QString &path)
void FileWatcher::slotUrlMissing(const QString &path)
{
Q_UNUSED(path)
// TODO handle missing clips by replacing producer with an invalid producer
// const QStringList ids = m_occurences.value(path);
/*for (const QString &id : ids) {
......
......@@ -516,7 +516,7 @@ std::pair<std::shared_ptr<Mlt::Producer>, bool> ProjectClip::giveMasterAndGetTim
if (master->parent().get_int("_loaded") == 1) {
// we already have a clip that shares the same master
if (state == PlaylistState::AudioOnly || timeWarp) {
if (state == PlaylistState::AudioOnly || !qFuzzyIsNull(timeWarp)) {
// In that case, we must create copies
std::shared_ptr<Mlt::Producer> prod(getTimelineProducer(clipId, state, speed)->cut(in, out));
return {prod, false};
......@@ -549,7 +549,7 @@ std::pair<std::shared_ptr<Mlt::Producer>, bool> ProjectClip::giveMasterAndGetTim
m_effectStack->addService(m_audioProducers[clipId]);
return {master, true};
}
if (timeWarp) {
if (!qFuzzyIsNull(timeWarp)) {
m_timewarpProducers[clipId] = std::shared_ptr<Mlt::Producer>(&master->parent());
m_effectStack->addService(m_timewarpProducers[clipId]);
return {master, true};
......
......@@ -54,8 +54,8 @@ QImage ColorTools::yuvColorWheel(const QSize &size, int Y, float scaling, bool m
// Ellipsis equation: x²/a² + y²/b² = 1
// Here: x=ru, y=rv, a=w/2, b=h/2, 1=rr
// For rr > 1, the point lies outside. Don't draw it.
ru = u - w2;
rv = v - h2;
ru = u - double(w2);
rv = v - double(h2);
rr = ru * ru / (w2 * w2) + rv * rv / (h2 * h2);
if (rr > 1) {
continue;
......@@ -278,8 +278,8 @@ QImage ColorTools::yPbPrColorWheel(const QSize &size, int Y, float scaling, bool
if (circleOnly) {
// see yuvColorWheel
rB = b - w2;
rR = r - h2;
rB = b - double(w2);
rR = r - double(h2);
rr = rB * rB / (w2 * w2) + rR * rR / (h2 * h2);
if (rr > 1) {
continue;
......@@ -424,7 +424,7 @@ QImage ColorTools::hsvCurvePlane(const QSize &size, const QColor &baseColor, con
if (!shear) {
plane.setPixel(x, y, col.rgba());
} else {
plane.setPixel(x, int(2 * size.height() + y - x * size.width() / size.height() - offsetY * size.height()) % size.height(), col.rgba());
plane.setPixel(x, (2 * size.height() + y - x * size.width() / size.height() - int(offsetY) * size.height()) % size.height(), col.rgba());
}
}
}
......
......@@ -54,8 +54,8 @@ void EffectStackModel::resetService(std::weak_ptr<Mlt::Service> service)
m_services.emplace_back(std::move(service));
// replant all effects in new service
for (int i = 0; i < rootItem->childCount(); ++i) {
for (const auto &service : m_services) {
std::static_pointer_cast<EffectItemModel>(rootItem->child(i))->plant(service);
for (const auto &s : m_services) {
std::static_pointer_cast<EffectItemModel>(rootItem->child(i))->plant(s);
}
}
}
......@@ -71,7 +71,7 @@ void EffectStackModel::removeService(std::shared_ptr<Mlt::Service> service)
{
std::vector<int> to_delete;
for (int i = int(m_services.size()) - 1; i >= 0; --i) {
if (service.get() == m_services[i].lock().get()) {
if (service.get() == m_services[uint(i)].lock().get()) {
to_delete.push_back(i);
}
}
......@@ -105,12 +105,12 @@ void EffectStackModel::removeEffect(std::shared_ptr<EffectItemModel> effect)
Fun redo = removeItem_lambda(effect->getId());
bool res = redo();
if (res) {
int inFades = fadeIns.size();
int outFades = fadeOuts.size();
int inFades = int(fadeIns.size());
int outFades = int(fadeOuts.size());
fadeIns.erase(effect->getId());
fadeOuts.erase(effect->getId());
inFades = fadeIns.size() - inFades;
outFades = fadeOuts.size() - outFades;
inFades = int(fadeIns.size()) - inFades;
outFades = int(fadeOuts.size()) - outFades;
QString effectName = EffectsRepository::get()->getName(effect->getAssetId());
Fun update = [this, current, currentChanged, inFades, outFades]() {
// Required to build the effect view
......
......@@ -441,6 +441,7 @@ void CollapsibleEffectView::animationFinished()
void CollapsibleEffectView::setGroupIndex(int ix)
{
Q_UNUSED(ix)
/*if (m_info.groupIndex == -1 && ix != -1) {
m_menu->removeAction(m_groupAction);
} else if (m_info.groupIndex != -1 && ix == -1) {
......@@ -452,6 +453,7 @@ void CollapsibleEffectView::setGroupIndex(int ix)
void CollapsibleEffectView::setGroupName(const QString &groupName)
{
Q_UNUSED(groupName)
/*m_info.groupName = groupName;
m_effect.setAttribute(QStringLiteral("kdenlive_info"), m_info.toString());*/
}
......
......@@ -50,9 +50,9 @@ ClipController::ClipController(const QString clipId, std::shared_ptr<Mlt::Produc
, m_clipType(ClipType::Unknown)
, m_hasLimitedDuration(true)
, m_effectStack(producer ? EffectStackModel::construct(producer, {ObjectType::BinClip, clipId.toInt()}, pCore->undoStack()) : nullptr)
, m_controllerBinId(clipId)
, m_hasVideo(false)
, m_hasAudio(false)
, m_hasVideo(false)
, m_controllerBinId(clipId)
{
if (m_masterProducer && !m_masterProducer->is_valid()) {
qCDebug(KDENLIVE_LOG) << "// WARNING, USING INVALID PRODUCER";
......
......@@ -837,7 +837,7 @@ void ClipPropertiesController::fillProperties()
propertyMap.append(QStringList() << i18n("Scanning") << (scan == 1 ? i18n("Progressive") : i18n("Interlaced")));
snprintf(property, sizeof(property), "meta.media.%d.codec.sample_aspect_ratio", vindex);
double par = m_controller->getProducerDoubleProperty(property);
if (par == 0) {
if (qFuzzyIsNull(par)) {
// Read media aspect ratio
par = m_controller->getProducerDoubleProperty(QStringLiteral("aspect_ratio"));
}
......
......@@ -80,6 +80,7 @@ GLWidget::GLWidget(int id, QObject *parent)
, m_consumer(nullptr)
, m_producer(nullptr)
, m_id(id)
, m_rulerHeight(QFontMetrics(QApplication::font()).lineSpacing() * 0.7)
, m_shader(nullptr)
, m_initSem(0)
, m_analyseSem(1)
......@@ -104,7 +105,6 @@ GLWidget::GLWidget(int id, QObject *parent)
, m_shareContext(nullptr)
, m_audioWaveDisplayed(false)
, m_fbo(nullptr)
, m_rulerHeight(QFontMetrics(QApplication::font()).lineSpacing() * 0.7)
{
KDeclarative::KDeclarative kdeclarative;
kdeclarative.setDeclarativeEngine(engine());
......
......@@ -711,7 +711,7 @@ void Monitor::adjustScrollBars(float horizontal, float vertical)
if (m_glMonitor->zoom() > 1.0f) {
m_horizontalScroll->setPageStep(m_glWidget->width());
m_horizontalScroll->setMaximum((int)((float)m_glMonitor->profileSize().width() * m_glMonitor->zoom()) - m_horizontalScroll->pageStep());
m_horizontalScroll->setValue(qRound(horizontal * m_horizontalScroll->maximum()));
m_horizontalScroll->setValue(qRound(horizontal * float(m_horizontalScroll->maximum())));
emit m_horizontalScroll->valueChanged(m_horizontalScroll->value());
m_horizontalScroll->show();
} else {
......
......@@ -135,7 +135,7 @@ QImage Histogram::renderGfxScope(uint accelFactor, const QImage &qimage)
QImage histogram = m_histogramGenerator->calculateHistogram(m_scopeRect.size(), qimage, componentFlags, rec, m_aUnscaled->isChecked(), accelFactor);
emit signalScopeRenderingFinished(start.elapsed(), accelFactor);
emit signalScopeRenderingFinished(uint(start.elapsed()), accelFactor);
return histogram;
}
QImage Histogram::renderBackground(uint)
......
......@@ -384,7 +384,6 @@ bool ClipModel::useTimewarpProducer(double speed, int extraSpace, Fun &undo, Fun
return true;
};
int newDuration = int(double(oldDuration) * previousSpeed / speed);
int delta = oldDuration - newDuration;
if (extraSpace > 0 && (newDuration >= extraSpace)) {
newDuration = extraSpace;
}
......
......@@ -390,7 +390,6 @@ bool GroupsModel::mergeSingleGroups(int id, Fun &undo, Fun &redo)
return false;
}
for (const auto &group : parents) {
int old = m_upLink[group.first];
setGroup(group.first, group.second);
}
return true;
......
......@@ -508,7 +508,6 @@ bool TimelineFunctions::requestSplitVideo(std::shared_ptr<TimelineItemModel> tim
continue;
}
int position = timeline->getClipPosition(cid);
int track = timeline->getClipTrackId(cid);
QList<int> possibleTracks = QList<int>() << videoTarget;
if (possibleTracks.isEmpty()) {
// No available audio track for splitting, abort
......
......@@ -2156,6 +2156,9 @@ QStringList TimelineModel::extractCompositionLumas() const
void TimelineModel::adjustAssetRange(int clipId, int in, int out)
{
Q_UNUSED(clipId)
Q_UNUSED(in)
Q_UNUSED(out)
// pCore->adjustAssetRange(clipId, in, out);
}
......@@ -2228,7 +2231,6 @@ bool TimelineModel::changeItemSpeed(int clipId, double speed)
int blankSpace = getTrackById(trackId)->getBlankSizeNearClip(clipId, true);
// Check if clip has a split partner
int splitId = m_groups->getSplitPartner(clipId);
bool success = true;
if (splitId > -1) {
int split_trackId = getClipTrackId(splitId);
int partnerSpace = getTrackById(split_trackId)->getBlankSizeNearClip(splitId, true);
......
......@@ -415,7 +415,6 @@ Fun TrackModel::requestClipResize_lambda(int clipId, int in, int out, bool right
int target_clip = clip_loc.second;
Q_ASSERT(target_clip < m_playlists[target_track].count());
int size = out - in + 1;
int state = m_track->get_int("hide");
bool checkRefresh = false;
if (!isHidden() && !isAudioTrack()) {
checkRefresh = true;
......
......@@ -56,9 +56,9 @@ TimelineController::TimelineController(QObject *parent)
, m_position(0)
, m_seekPosition(-1)
, m_activeTrack(0)
, m_zone(-1, -1)
, m_scale(3.0)
, m_timelinePreview(nullptr)
, m_zone(-1, -1)
{
m_disablePreview = pCore->currentDoc()->getAction(QStringLiteral("disable_preview"));
connect(m_disablePreview, &QAction::triggered, this, &TimelineController::disablePreview);
......@@ -1261,7 +1261,7 @@ void TimelineController::invalidateZone(int in, int out)
void TimelineController::changeItemSpeed(int clipId, double speed)
{
if (speed == -1) {
if (qFuzzyCompare(speed,-1)) {
speed = 100 * m_model->getClipSpeed(clipId);
bool ok = false;
double duration = m_model->getItemPlaytime(clipId);
......
......@@ -205,7 +205,7 @@ qreal DragValue::value() const
void DragValue::setMaximum(qreal max)
{
if (m_maximum != max) {
if (!qFuzzyCompare(m_maximum, max)) {
m_maximum = max;
if (m_intEdit) {
m_intEdit->setRange(m_minimum, m_maximum);
......@@ -217,7 +217,7 @@ void DragValue::setMaximum(qreal max)
void DragValue::setMinimum(qreal min)
{
if (m_minimum != min) {
if (!qFuzzyCompare(m_minimum, min)) {
m_minimum = min;
if (m_intEdit) {
m_intEdit->setRange(m_minimum, m_maximum);
......@@ -450,12 +450,12 @@ void CustomLabel::mouseMoveEvent(QMouseEvent *e)
}
double nv = value() + diff * m_step;
if (nv != value()) {
if (!qFuzzyCompare(nv, value())) {
setNewValue(nv, KdenliveSettings::dragvalue_directupdate());
}
} else {
double nv = minimum() + ((double)maximum() - minimum()) / width() * e->pos().x();
if (nv != value()) {
if (!qFuzzyCompare(nv, value())) {
setNewValue(nv, KdenliveSettings::dragvalue_directupdate());
}
}
......
......@@ -65,16 +65,16 @@ TEST_CASE("Keyframe model", "[KeyframeModel]")
REQUIRE(ok);
auto k1 = model->getClosestKeyframe(GenTime(0.655555), &ok);
REQUIRE(ok);
REQUIRE(k == k1);
REQUIRE(k1 == k);
auto k2 = model->getNextKeyframe(GenTime(0.5), &ok);
REQUIRE(ok);
REQUIRE(k == k2);
REQUIRE(k2 == k);
auto k3 = model->getPrevKeyframe(GenTime(0.5), &ok);
REQUIRE(ok);
REQUIRE(k3 == k0);
auto k4 = model->getPrevKeyframe(GenTime(10), &ok);
REQUIRE(ok);
REQUIRE(k == k4);
REQUIRE(k4 == k);
model->getNextKeyframe(GenTime(10), &ok);
REQUIRE_FALSE(ok);
};
......@@ -100,16 +100,16 @@ TEST_CASE("Keyframe model", "[KeyframeModel]")
REQUIRE(ok);
auto k1 = model->getClosestKeyframe(GenTime(0.655555), &ok);
REQUIRE(ok);
REQUIRE(k == k1);
REQUIRE(k1 == k);
auto k2 = model->getNextKeyframe(GenTime(0.5), &ok);
REQUIRE(ok);
REQUIRE(k == k2);
REQUIRE(k2 == k);
auto k3 = model->getPrevKeyframe(GenTime(0.5), &ok);
REQUIRE(ok);
REQUIRE(k3 == k0);
auto k4 = model->getPrevKeyframe(GenTime(10), &ok);
REQUIRE(ok);
REQUIRE(k == k4);
REQUIRE(k4 == k);
auto k5 = model->getNextKeyframe(GenTime(10), &ok);
REQUIRE(ok);
REQUIRE(k5 == kk);
......@@ -131,7 +131,7 @@ TEST_CASE("Keyframe model", "[KeyframeModel]")
REQUIRE(check_anim_identity(model));
REQUIRE(model->hasKeyframe(GenTime(12.6)));
bool ok;
auto k = model->getKeyframe(GenTime(1.1), &ok);
model->getKeyframe(GenTime(1.1), &ok);
REQUIRE_FALSE(ok);
auto k0 = model->getKeyframe(GenTime(0), &ok);
REQUIRE(ok);
......@@ -139,16 +139,16 @@ TEST_CASE("Keyframe model", "[KeyframeModel]")
REQUIRE(ok);
auto k1 = model->getClosestKeyframe(GenTime(0.655555), &ok);
REQUIRE(ok);
REQUIRE(k == k0);
REQUIRE(k1 == k0);
auto k2 = model->getNextKeyframe(GenTime(0.5), &ok);
REQUIRE(ok);
REQUIRE(kk == k2);
REQUIRE(k2 == kk);
auto k3 = model->getPrevKeyframe(GenTime(0.5), &ok);
REQUIRE(ok);
REQUIRE(k3 == k0);
auto k4 = model->getPrevKeyframe(GenTime(10), &ok);
REQUIRE(ok);
REQUIRE(k0 == k4);
REQUIRE(k4 == k0);
auto k5 = model->getNextKeyframe(GenTime(10), &ok);
REQUIRE(ok);
REQUIRE(k5 == kk);
......@@ -196,16 +196,16 @@ TEST_CASE("Keyframe model", "[KeyframeModel]")
REQUIRE(ok);
auto k1 = model->getClosestKeyframe(GenTime(pos + 10), &ok);
REQUIRE(ok);
REQUIRE(k == k1);
REQUIRE(k1 == k);
auto k2 = model->getNextKeyframe(GenTime(pos - 0.3), &ok);
REQUIRE(ok);
REQUIRE(k == k2);
REQUIRE(k2 == k);
auto k3 = model->getPrevKeyframe(GenTime(pos - 0.3), &ok);
REQUIRE(ok);
REQUIRE(k3 == k0);
auto k4 = model->getPrevKeyframe(GenTime(pos + 0.3), &ok);
REQUIRE(ok);
REQUIRE(k == k4);
REQUIRE(k4 == k);
model->getNextKeyframe(GenTime(pos + 0.3), &ok);
REQUIRE_FALSE(ok);
};
......
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