Fix misc compile warnings

parent b8b9bfa3
Pipeline #14277 canceled with stage
......@@ -116,7 +116,7 @@ void AudioLevelWidget::drawBackground(int channels)
int labelHeight = fontMetrics().ascent();
for (int i = 0; i < dbLabelCount; i++) {
int value = dbscale.at(i);
QString label = QString().sprintf("%d", value);
QString label = QString::number(value);
//int labelWidth = fontMetrics().width(label);
double xf = m_pixmap.height() - pow(10.0, (double)dbscale.at(i) / 50.0) * m_pixmap.height() * 40.0 / 42;
/*if (xf + labelWidth / 2 > m_pixmap.height()) {
......
......@@ -13,7 +13,6 @@ the Free Software Foundation, either version 3 of the License, or
#include "kdenlive_debug.h"
#include "klocalizedstring.h"
#include <QTime>
#include <QElapsedTimer>
#include <cmath>
#include <iostream>
......
......@@ -15,7 +15,7 @@
#include "core.h"
#include "kdenlive_debug.h"
#include <QImage>
#include <QTime>
#include <QElapsedTimer>
#include <QtConcurrent>
#include <KLocalizedString>
#include <algorithm>
......@@ -106,7 +106,7 @@ AudioEnvelope::AudioSummary AudioEnvelope::loadAndNormalizeEnvelope() const
mlt_audio_format format_s16 = mlt_audio_s16;
int channels = 1;
QTime t;
QElapsedTimer t;
t.start();
m_producer->seek(0);
size_t max = summary.audioAmplitudes.size();
......
......@@ -15,7 +15,7 @@ extern "C" {
}
#include "kdenlive_debug.h"
#include <QTime>
#include <QElapsedTimer>
#include <algorithm>
#include <vector>
......@@ -77,7 +77,7 @@ void FFTCorrelation::correlate(const qint64 *left, const size_t leftSize, const
void FFTCorrelation::convolve(const float *left, const size_t leftSize, const float *right, const size_t rightSize, float *out_convolved)
{
QTime time;
QElapsedTimer time;
time.start();
// To avoid issues with repetition (we are dealing with cosine waves
......
......@@ -151,7 +151,7 @@ void MonitorAudioLevel::drawBackground(int channels)
int y = totalHeight + textHeight;
for (int i = 0; i < dbLabelCount; i++) {
int value = dbscale.at(i);
QString label = QString().sprintf("%d", value);
QString label = QString::number(value);
int labelWidth = fontMetrics().horizontalAdvance(label);
double xf = pow(10.0, (double)dbscale.at(i) / 50.0) * m_pixmap.width() * 40.0 / 42;
if (xf + labelWidth / 2 > m_pixmap.width()) {
......
......@@ -527,17 +527,17 @@ QString SlideshowClip::animationToGeometry(const QString &animation, int &ttl)
{
QString geometry;
if (animation.startsWith(QLatin1String("Pan and zoom"))) {
geometry = QString().sprintf(
geometry = QString::asprintf(
"0=0/0:100%%x100%%;%d=-14%%/-14%%:120%%x120%%;%d=-5%%/-5%%:110%%x110%%;%d=0/0:110%%x110%%;%d=0/-5%%:110%%x110%%;%d=-5%%/0:110%%x110%%", ttl - 1,
ttl, ttl * 2 - 1, ttl * 2, ttl * 3 - 1);
ttl *= 3;
} else if (animation.startsWith(QLatin1String("Pan"))) {
geometry = QString().sprintf("0=-5%%/-5%%:110%%x110%%;%d=0/0:110%%x110%%;%d=0/0:110%%x110%%;%d=0/-5%%:110%%x110%%;%d=0/-5%%:110%%x110%%;%d=-5%%/"
geometry = QString::asprintf("0=-5%%/-5%%:110%%x110%%;%d=0/0:110%%x110%%;%d=0/0:110%%x110%%;%d=0/-5%%:110%%x110%%;%d=0/-5%%:110%%x110%%;%d=-5%%/"
"-5%%:110%%x110%%;%d=0/-5%%:110%%x110%%;%d=-5%%/0:110%%x110%%",
ttl - 1, ttl, ttl * 2 - 1, ttl * 2, ttl * 3 - 1, ttl * 3, ttl * 4 - 1);
ttl *= 4;
} else if (animation.startsWith(QLatin1String("Zoom"))) {
geometry = QString().sprintf("0=0/0:100%%x100%%;%d=-14%%/-14%%:120%%x120%%", ttl - 1);
geometry = QString::asprintf("0=0/0:100%%x100%%;%d=-14%%/-14%%:120%%x120%%", ttl - 1);
}
return geometry;
}
......@@ -20,7 +20,7 @@
#include "audiosignal.h"
#include <QPainter>
#include <QTime>
#include <QElapsedTimer>
#include <cmath>
......@@ -39,7 +39,8 @@ AudioSignal::~AudioSignal() = default;
QImage AudioSignal::renderAudioScope(uint, const audioShortVector &audioFrame, const int, const int num_channels, const int samples, const int)
{
QTime start = QTime::currentTime();
QElapsedTimer timer;
timer.start();
int num_samples = samples > 200 ? 200 : samples;
......@@ -76,7 +77,7 @@ QImage AudioSignal::renderAudioScope(uint, const audioShortVector &audioFrame, c
int dbsize = 20;
if (!horiz) {
// calculate actual width of lowest=longest db scale mark based on drawing font
dbsize = p.fontMetrics().horizontalAdvance(QString().sprintf("%d", m_dbscale.at(m_dbscale.size() - 1)));
dbsize = p.fontMetrics().horizontalAdvance(QString::number(m_dbscale.at(m_dbscale.size() - 1)));
}
bool showdb = width() > (dbsize + 40);
// valpixel=1.0 for 127, 1.0+(1/40) for 1 short oversample, 1.0+(2/40) for longer oversample
......@@ -127,15 +128,15 @@ QImage AudioSignal::renderAudioScope(uint, const audioShortVector &audioFrame, c
for (int l : m_dbscale) {
if (!horiz) {
double xf = pow(10.0, (double)l / 20.0) * (double)height();
p.drawText(width() - dbsize, height() - xf * 40.0 / 42.0 + 20, QString().sprintf("%d", l));
p.drawText(width() - dbsize, height() - xf * 40.0 / 42.0 + 20, QString::number(l));
} else {
double xf = pow(10.0, (double)l / 20.0) * (double)width();
p.drawText(xf * 40 / 42 - 10, height() - 2, QString().sprintf("%d", l));
p.drawText(xf * 40 / 42 - 10, height() - 2, QString::number(l));
}
}
}
p.end();
emit signalScopeRenderingFinished((uint)start.elapsed(), 1);
emit signalScopeRenderingFinished((uint)timer.elapsed(), 1);
return image;
}
......
......@@ -14,7 +14,7 @@
#include "lib/external/kiss_fft/tools/kiss_fftr.h"
#include <QPainter>
#include <QTime>
#include <QElapsedTimer>
#include "klocalizedstring.h"
#include <KConfigGroup>
......@@ -159,7 +159,8 @@ QImage AudioSpectrum::renderAudioScope(uint, const audioShortVector &audioFrame,
m_freqMax = freq / 2;
}
QTime start = QTime::currentTime();
QElapsedTimer timer;
timer.start();
/*******FIXME!!!
#ifdef DETECT_OVERMODULATION
......@@ -308,7 +309,7 @@ QImage AudioSpectrum::renderAudioScope(uint, const audioShortVector &audioFrame,
qCDebug(KDENLIVE_LOG) << widgetName() << " took " << drawTime.elapsed() << " ms for drawing. Average: " << ((float)m_timeTotal / m_showTotal);
#endif
emit signalScopeRenderingFinished((uint)start.elapsed(), 1);
emit signalScopeRenderingFinished((uint)timer.elapsed(), 1);
return spectrum;
}
......@@ -317,7 +318,8 @@ QImage AudioSpectrum::renderAudioScope(uint, const audioShortVector &audioFrame,
}
QImage AudioSpectrum::renderHUD(uint)
{
QTime start = QTime::currentTime();
QElapsedTimer timer;
timer.start();
if (m_innerScopeRect.height() > 0 && m_innerScopeRect.width() > 0) { // May be below 0 if widget is too small
......@@ -437,7 +439,7 @@ QImage AudioSpectrum::renderHUD(uint)
}
}
emit signalHUDRenderingFinished((uint)start.elapsed(), 1);
emit signalHUDRenderingFinished((uint)timer.elapsed(), 1);
return hud;
}
#ifdef DEBUG_AUDIOSPEC
......
......@@ -11,7 +11,7 @@
#include "spectrogram.h"
#include <QPainter>
#include <QTime>
#include <QElapsedTimer>
#include "klocalizedstring.h"
#include <KConfigGroup>
......@@ -165,7 +165,8 @@ QRect Spectrogram::scopeRect()
QImage Spectrogram::renderHUD(uint)
{
if (m_innerScopeRect.width() > 0 && m_innerScopeRect.height() > 0) {
QTime start = QTime::currentTime();
QElapsedTimer timer;
timer.start();
int x, y;
const int minDistY = 30; // Minimum distance between two lines
......@@ -285,7 +286,7 @@ QImage Spectrogram::renderHUD(uint)
davinci.drawText(m_scopeRect.left(), topDist, rectWidth, rectHeight, Qt::AlignRight, i18n("%1\ndB", m_dBmax));
davinci.drawText(m_scopeRect.left(), topDist + m_innerScopeRect.height() - 20, rectWidth, rectHeight, Qt::AlignRight, i18n("%1\ndB", m_dBmin));
emit signalHUDRenderingFinished((uint)start.elapsed(), 1);
emit signalHUDRenderingFinished((uint)timer.elapsed(), 1);
return hud;
}
emit signalHUDRenderingFinished(0, 1);
......@@ -303,7 +304,8 @@ QImage Spectrogram::renderAudioScope(uint, const audioShortVector &audioFrame, c
qCDebug(KDENLIVE_LOG) << "New data for " << widgetName() << ": " << newDataAvailable << QStringLiteral(" (") << newData << " units)";
#endif
QTime start = QTime::currentTime();
QElapsedTimer timer;
timer.start();
int fftWindow = m_ui->windowSize->itemData(m_ui->windowSize->currentIndex()).toInt();
if (fftWindow > num_samples) {
......@@ -424,7 +426,7 @@ QImage Spectrogram::renderAudioScope(uint, const audioShortVector &audioFrame, c
m_fftHistoryImg = spectrum;
emit signalScopeRenderingFinished((uint)start.elapsed(), 1);
emit signalScopeRenderingFinished((uint)timer.elapsed(), 1);
return spectrum;
}
emit signalScopeRenderingFinished(0, 1);
......
......@@ -10,7 +10,7 @@
#include "histogram.h"
#include "histogramgenerator.h"
#include <QTime>
#include <QElapsedTimer>
#include "klocalizedstring.h"
#include <KConfigGroup>
......@@ -124,8 +124,8 @@ QImage Histogram::renderHUD(uint)
}
QImage Histogram::renderGfxScope(uint accelFactor, const QImage &qimage)
{
QTime start = QTime::currentTime();
start.start();
QElapsedTimer timer;
timer.start();
const int componentFlags =
(m_ui->cbY->isChecked() ? 1 : 0) * HistogramGenerator::ComponentY | (m_ui->cbS->isChecked() ? 1 : 0) * HistogramGenerator::ComponentSum |
(m_ui->cbR->isChecked() ? 1 : 0) * HistogramGenerator::ComponentR | (m_ui->cbG->isChecked() ? 1 : 0) * HistogramGenerator::ComponentG |
......@@ -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(uint(start.elapsed()), accelFactor);
emit signalScopeRenderingFinished(uint(timer.elapsed()), accelFactor);
return histogram;
}
QImage Histogram::renderBackground(uint)
......
......@@ -12,7 +12,7 @@
#include "rgbparadegenerator.h"
#include <QPainter>
#include <QRect>
#include <QTime>
#include <QElapsedTimer>
#include "klocalizedstring.h"
#include <KConfigGroup>
......@@ -132,13 +132,13 @@ QImage RGBParade::renderHUD(uint)
QImage RGBParade::renderGfxScope(uint accelerationFactor, const QImage &qimage)
{
QTime start = QTime::currentTime();
start.start();
QElapsedTimer timer;
timer.start();
int paintmode = m_ui->paintMode->itemData(m_ui->paintMode->currentIndex()).toInt();
QImage parade = m_rgbParadeGenerator->calculateRGBParade(m_scopeRect.size(), qimage, (RGBParadeGenerator::PaintMode)paintmode, m_aAxis->isChecked(),
m_aGradRef->isChecked(), accelerationFactor);
emit signalScopeRenderingFinished((uint)start.elapsed(), accelerationFactor);
emit signalScopeRenderingFinished((uint)timer.elapsed(), accelerationFactor);
return parade;
}
......
......@@ -19,7 +19,7 @@
#include <KSharedConfig>
#include <QAction>
#include <QPainter>
#include <QTime>
#include <QElapsedTimer>
#include <cmath>
const float P75 = .75;
......@@ -263,7 +263,8 @@ QImage Vectorscope::renderHUD(uint)
QImage Vectorscope::renderGfxScope(uint accelerationFactor, const QImage &qimage)
{
QTime start = QTime::currentTime();
QElapsedTimer timer;
timer.start();
QImage scope;
if (m_cw <= 0) {
......@@ -276,16 +277,14 @@ QImage Vectorscope::renderGfxScope(uint accelerationFactor, const QImage &qimage
scope = m_vectorscopeGenerator->calculateVectorscope(m_scopeRect.size(), qimage, m_gain, paintMode, colorSpace, m_aAxisEnabled->isChecked(),
accelerationFactor);
}
unsigned int mseconds = (uint)start.msecsTo(QTime::currentTime());
emit signalScopeRenderingFinished(mseconds, accelerationFactor);
emit signalScopeRenderingFinished((uint) timer.elapsed(), accelerationFactor);
return scope;
}
QImage Vectorscope::renderBackground(uint)
{
QTime start = QTime::currentTime();
start.start();
QElapsedTimer timer;
timer.start();
QImage bg(m_visibleRect.size(), QImage::Format_ARGB32);
bg.fill(qRgba(0, 0, 0, 0));
......@@ -487,7 +486,7 @@ QImage Vectorscope::renderBackground(uint)
davinci.drawText(QPoint(m_scopeRect.width() - 40, m_scopeRect.height() - 15), QVariant(m_accelFactorScope).toString().append(QStringLiteral("x")));
}
emit signalBackgroundRenderingFinished((uint)start.elapsed(), 1);
emit signalBackgroundRenderingFinished((uint)timer.elapsed(), 1);
return bg;
}
......
......@@ -18,6 +18,7 @@
#include <KConfigGroup>
#include <KSharedConfig>
#include <QPainter>
#include <QElapsedTimer>
#include <QPoint>
const QSize Waveform::m_textWidth(35, 0);
......@@ -176,15 +177,15 @@ QImage Waveform::renderHUD(uint)
QImage Waveform::renderGfxScope(uint accelFactor, const QImage &qimage)
{
QTime start = QTime::currentTime();
start.start();
QElapsedTimer timer;
timer.start();
const int paintmode = m_ui->paintMode->itemData(m_ui->paintMode->currentIndex()).toInt();
WaveformGenerator::Rec rec = m_aRec601->isChecked() ? WaveformGenerator::Rec_601 : WaveformGenerator::Rec_709;
QImage wave = m_waveformGenerator->calculateWaveform(scopeRect().size() - m_textWidth - QSize(0, m_paddingBottom), qimage,
(WaveformGenerator::PaintMode)paintmode, true, rec, accelFactor);
emit signalScopeRenderingFinished((uint)start.elapsed(), 1);
emit signalScopeRenderingFinished((uint)timer.elapsed(), 1);
return wave;
}
......
......@@ -15,7 +15,7 @@
#include <QImage>
#include <QPainter>
#include <QSize>
#include <QTime>
#include <QElapsedTimer>
#include <vector>
#define CHOP255(a) ((255) < (a) ? (255) : (a))
......
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