Commit 4ba9c744 authored by Vincent Pinon's avatar Vincent Pinon

Fix some GCC warnings

parent af5e8662
......@@ -43,7 +43,7 @@ add_definitions(-DTRANSLATION_DOMAIN=\"kdenlive\")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++14")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fsanitize=address -fno-omit-frame-pointer")
# To be switched on when releasing.
option(RELEASE_BUILD "Remove Git revision from program version (use for stable releases)" ON)
......
......@@ -96,7 +96,7 @@ void AssetParameterView::setRange(QPair<int, int> range)
{
qDebug() << "SETTING RANGE" << range;
QMutexLocker lock(&m_lock);
for (int i = 0; i < m_widgets.size(); ++i) {
for (uint i = 0; i < m_widgets.size(); ++i) {
auto w = m_widgets[i];
w->slotSetRange(range);
}
......@@ -155,7 +155,7 @@ void AssetParameterView::refresh(const QModelIndex &topLeft, const QModelIndex &
// We make sure the range is valid
Q_ASSERT(bottomRight.row() < (int)m_widgets.size());
for (auto i = (size_t)topLeft.row(); i <= (size_t)bottomRight.row(); ++i) {
for (int i = topLeft.row(); i <= bottomRight.row(); ++i) {
m_widgets[i]->slotRefresh();
}
}
......
......@@ -65,7 +65,7 @@ void DoubleParamWidget::slotRefresh()
// Connect signal
connect(m_doubleWidget, &DoubleWidget::valueChanged,
[this, locale](double value) { emit valueChanged(m_index, locale.toString(value / m_doubleWidget->factor), true); });
[this, locale](double val) { emit valueChanged(m_index, locale.toString(val / m_doubleWidget->factor), true); });
}
void DoubleParamWidget::slotShowComment(bool show)
......
......@@ -89,7 +89,7 @@ void PositionEditWidget::slotUpdatePosition()
void PositionEditWidget::setAbsolute(bool absolute)
{
m_absolute = true;
m_absolute = absolute;
}
void PositionEditWidget::slotSetRange(QPair <int, int> range)
......
......@@ -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, width * height * 3);
memcpy(qimage.bits(), image, (size_t)width * height * 3);
emit frameUpdated(qimage);
}
......
......@@ -60,7 +60,7 @@ void EffectStackModel::loadEffects()
auto effect = EffectItemModel::construct(ptr->filter(i), shared_from_this());
// effect->setParameters
Fun redo = addItem_lambda(effect, rootItem->getId());
bool res = redo();
redo();
connect(effect.get(), &AssetParameterModel::modelChanged, this, &EffectStackModel::modelChanged);
}
} else {
......@@ -406,7 +406,7 @@ bool EffectStackModel::checkConsistency()
return false;
}
for (int i = 0; i < allFilters.size(); ++i) {
for (uint i = 0; i < allFilters.size(); ++i) {
auto mltFilter = ptr->filter(i)->get_filter();
auto currentFilter = allFilters[i]->filter().get_filter();
if (mltFilter != currentFilter) {
......
......@@ -58,8 +58,8 @@ CollapsibleEffectView::CollapsibleEffectView(std::shared_ptr<EffectItemModel> ef
, m_itemInfo(info)
, m_original_effect(original_effect)
, m_isMovable(true)*/
, m_model(effectModel)
, m_view(nullptr)
, m_model(effectModel)
, m_regionEffect(false)
{
QString effectId = effectModel->getAssetId();
......@@ -298,6 +298,7 @@ void CollapsibleEffectView::slotActivateEffect(QModelIndex ix)
void CollapsibleEffectView::setActive(bool activate)
{
Q_UNUSED(activate)
/*
decoframe->setProperty("active", activate);
decoframe->setStyleSheet(decoframe->styleSheet());
......@@ -559,6 +560,7 @@ void CollapsibleEffectView::updateFrameInfo()
void CollapsibleEffectView::setActiveKeyframe(int kf)
{
Q_UNUSED(kf)
/*
if (m_paramWidget) {
m_paramWidget->setActiveKeyframe(kf);
......@@ -568,6 +570,7 @@ void CollapsibleEffectView::setActiveKeyframe(int kf)
void CollapsibleEffectView::setupWidget(const ItemInfo &info)
{
Q_UNUSED(info)
/*
if (m_effect.isNull()) {
// //qCDebug(KDENLIVE_LOG) << "// EMPTY EFFECT STACK";
......@@ -655,6 +658,7 @@ void CollapsibleEffectView::slotSyncEffectsPos(int pos)
void CollapsibleEffectView::dragEnterEvent(QDragEnterEvent *event)
{
Q_UNUSED(event)
/*
if (event->mimeData()->hasFormat(QStringLiteral("kdenlive/effectslist"))) {
frame->setProperty("target", true);
......@@ -786,6 +790,8 @@ void CollapsibleEffectView::setRange(QPair<int, int> range)
void CollapsibleEffectView::setKeyframes(const QString &tag, const QString &keyframes)
{
Q_UNUSED(tag)
Q_UNUSED(keyframes)
/*
m_paramWidget->setKeyframes(tag, keyframes);
*/
......
......@@ -63,17 +63,14 @@ void WidgetDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option
QStyleOptionViewItem opt(option);
initStyleOption(&opt, index);
QStyle *style = opt.widget ? opt.widget->style() : QApplication::style();
const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1;
// QRect r = QStyle::alignedRect(opt.direction, Qt::AlignVCenter | Qt::AlignLeft, opt.decorationSize, r1);
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, opt.widget);
}
EffectStackView::EffectStackView(AssetPanel *parent)
: QWidget(parent)
, m_model(nullptr)
, m_thumbnailer(new AssetIconProvider(true))
, m_range(-1, -1)
, m_model(nullptr)
{
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
m_lay = new QVBoxLayout(this);
......@@ -173,6 +170,7 @@ void EffectStackView::setModel(std::shared_ptr<EffectStackModel> model, QPair<in
void EffectStackView::loadEffects(QPair<int, int> range, int start, int end)
{
Q_UNUSED(start)
qDebug() << "MUTEX LOCK!!!!!!!!!!!! loadEffects";
QMutexLocker lock(&m_mutex);
m_range = range;
......@@ -259,6 +257,7 @@ void EffectStackView::slotAdjustDelegate(std::shared_ptr<EffectItemModel> effect
void EffectStackView::refresh(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles)
{
Q_UNUSED(roles)
loadEffects(m_range, topLeft.row(), bottomRight.row() + 1);
}
......
......@@ -442,7 +442,7 @@ QMimeData *EffectsListWidget::mimeData(const QList<QTreeWidgetItem *> list) cons
QDomDocument doc;
bool transitionMode = false;
for (QTreeWidgetItem *item : list) {
if (item->flags() & Qt::ItemIsDragEnabled != 0) {
if ((item->flags() & Qt::ItemIsDragEnabled) != 0) {
int type = item->data(0, TypeRole).toInt();
if (type == EffectsList::TRANSITION_TYPE) {
transitionMode = true;
......
......@@ -24,8 +24,8 @@
AbstractClipJob::AbstractClipJob(JOBTYPE type, const QString &id, QObject *parent)
: QObject(parent)
, m_jobType(type)
, m_clipId(id)
, m_jobType(type)
{
}
......
......@@ -75,14 +75,14 @@ AnalysisTree::AnalysisTree(QWidget *parent)
// virtual
QMimeData *AnalysisTree::mimeData(const QList<QTreeWidgetItem *> list) const
{
QString data;
QString mimeData;
for (QTreeWidgetItem *item : list) {
if ((item->flags() & Qt::ItemIsDragEnabled) != 0) {
data.append(item->text(1));
mimeData.append(item->text(1));
}
}
auto *mime = new QMimeData;
mime->setData(QStringLiteral("kdenlive/geometry"), data.toUtf8());
mime->setData(QStringLiteral("kdenlive/geometry"), mimeData.toUtf8());
return mime;
}
......
......@@ -52,7 +52,7 @@
#else
#define check_error(fn) \
{ \
int err = fn->glGetError(); \
uint err = fn->glGetError(); \
if (err != GL_NO_ERROR) { \
qCCritical(KDENLIVE_LOG) << "GL error" << hex << err << dec << "at" << __FILE__ << ":" << __LINE__; \
} \
......@@ -75,11 +75,11 @@ using namespace Mlt;
GLWidget::GLWidget(int id, QObject *parent)
: QQuickView((QWindow *)parent)
, sendFrameForAnalysis(false)
, m_id(id)
, m_shader(nullptr)
, m_glslManager(nullptr)
, m_consumer(nullptr)
, m_producer(nullptr)
, m_id(id)
, m_shader(nullptr)
, m_initSem(0)
, m_analyseSem(1)
, m_isInitialized(false)
......@@ -437,7 +437,7 @@ void GLWidget::paintGL()
} else if (m_glslManager) {
m_mutex.lock();
if (m_sharedFrame.is_valid()) {
m_texture[0] = *((GLuint *)m_sharedFrame.get_image());
m_texture[0] = *((const GLuint *)m_sharedFrame.get_image());
}
}
......@@ -468,7 +468,7 @@ void GLWidget::paintGL()
// Setup an orthographic projection.
QMatrix4x4 projection;
projection.scale(2.0f / width, 2.0f / height);
projection.scale(2.0f / (float)width, 2.0f / (float)height);
m_shader->setUniformValue(m_projectionLocation, projection);
check_error(f);
......@@ -524,7 +524,7 @@ void GLWidget::paintGL()
f->glViewport(0, 0, fullWidth, fullHeight);
QMatrix4x4 projection2;
projection2.scale(2.0f / width, 2.0f / height);
projection2.scale(2.0f / (float)width, 2.0f / (float)height);
m_shader->setUniformValue(m_projectionLocation, projection2);
f->glDrawArrays(GL_TRIANGLE_STRIP, 0, vertices.size());
......@@ -555,13 +555,14 @@ void GLWidget::paintGL()
void GLWidget::slotZoomScene(double value)
{
if (value >= 3) {
int val = value;
if (val >= 3) {
setZoom(value - 2.0f);
} else if (value == 2) {
} else if (val == 2) {
setZoom(0.5);
} else if (value == 1) {
} else if (val == 1) {
setZoom(0.25);
} else if (value == 0) {
} else if (val == 0) {
setZoom(0.125);
}
}
......@@ -1514,7 +1515,7 @@ void FrameRenderer::showGLFrame(Mlt::Frame frame)
frame.set("movit.convert.use_texture", 1);
mlt_image_format format = mlt_image_glsl_texture;
const GLuint *textureId = (GLuint *)frame.get_image(format, width, height);
frame.get_image(format, width, height);
m_context->makeCurrent(m_surface);
GLsync sync = (GLsync)frame.get_data("movit.convert.fence");
if (sync) {
......@@ -1558,7 +1559,7 @@ void FrameRenderer::showGLNoSyncFrame(Mlt::Frame frame)
frame.set("movit.convert.use_texture", 1);
mlt_image_format format = mlt_image_glsl_texture;
const GLuint *textureId = (GLuint *)frame.get_image(format, width, height);
frame.get_image(format, width, height);
m_context->makeCurrent(m_surface);
m_context->functions()->glFinish();
......
......@@ -31,12 +31,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
const double log_factor = 1.0 / log10(1.0 / 127);
static inline double levelToDB(double dB)
static inline double levelToDB(double level)
{
if (dB == 0) {
return 0;
if (level <= 0) {
return -100;
}
return 100 * (1.0 - log10(dB) * log_factor);
return 100 * (1.0 - log10(level) * log_factor);
}
MonitorAudioLevel::MonitorAudioLevel(Mlt::Profile *profile, int height, QWidget *parent)
......@@ -82,12 +82,7 @@ void MonitorAudioLevel::refreshScope(const QSize & /*size*/, bool /*full*/)
QVector<int> levels;
for (int i = 0; i < audioChannels; i++) {
QString s = QStringLiteral("meta.media.audio_level.%1").arg(i);
double audioLevel = mFrame.get_double(s.toLatin1().constData());
if (audioLevel == 0.0) {
levels << -100;
} else {
levels << (int)levelToDB(audioLevel);
}
levels << (int)levelToDB(mFrame.get_double(s.toLatin1().constData()));
}
QMetaObject::invokeMethod(this, "setAudioValues", Qt::QueuedConnection, Q_ARG(const QVector<int> &, levels));
}
......
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