Commit 3935d0f2 authored by Laurent Montel's avatar Laurent Montel 😁

const'ref. REmove not necessary virtual keyword. Fix indent.

parent 45adaf0e
......@@ -41,10 +41,10 @@ public:
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 );
protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
private:
/** @brief Returns the centroid (= 'center of mass') of this polygon. */
......
......@@ -49,11 +49,11 @@ public:
protected:
//virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
private:
double m_dar;
......
......@@ -44,10 +44,10 @@ public:
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 );
protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
private:
double m_dar;
......
......@@ -26,7 +26,7 @@
#include <QGraphicsView>
BPointItem::BPointItem(BPoint point, QGraphicsItem* parent) :
BPointItem::BPointItem(const BPoint &point, QGraphicsItem* parent) :
QAbstractGraphicsShapeItem(parent),
m_selection(-1)
{
......@@ -43,12 +43,12 @@ BPointItem::BPointItem(BPoint point, QGraphicsItem* parent) :
m_view = scene()->views()[0];
}
BPoint BPointItem::getPoint()
BPoint BPointItem::getPoint() const
{
return BPoint(mapToScene(m_point.h1), mapToScene(m_point.p), mapToScene(m_point.h2));
}
void BPointItem::setPoint(BPoint point)
void BPointItem::setPoint(const BPoint &point)
{
setPos(point.p);
prepareGeometryChange();
......@@ -107,7 +107,7 @@ void BPointItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option
m_point.p.y() - handleSizeHalf, handleSize, handleSize));
}
int BPointItem::getSelection(QPointF pos)
int BPointItem::getSelection(const QPointF &pos)
{
QList <qreal> d;
d << QLineF(pos, m_point.h1).length() << QLineF(pos, m_point.p).length() << QLineF(pos, m_point.h2).length();
......
......@@ -29,25 +29,25 @@ class QGraphicsView;
class BPointItem : public QAbstractGraphicsShapeItem
{
public:
explicit BPointItem(BPoint point, QGraphicsItem* parent = 0);
explicit BPointItem(const BPoint &point, QGraphicsItem* parent = 0);
BPoint getPoint();
void setPoint(BPoint point);
BPoint getPoint() const;
void setPoint(const BPoint &point);
enum { Type = UserType + 11 };
virtual int type() const;
virtual QRectF boundingRect() const;
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
/** @brief Gets The action mode for the area @param pos +- 4. */
int getSelection(QPointF pos);
int getSelection(const QPointF &pos);
protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
private:
BPoint m_point;
......
......@@ -64,7 +64,7 @@ SplineItem::SplineItem(const QList< BPoint >& points, QGraphicsItem* parent, QGr
setBrush(Qt::NoBrush);
setAcceptHoverEvents(true);
m_view = scene->views()[0];
m_view = scene->views().first();
setPoints(points);
}
......@@ -74,7 +74,7 @@ int SplineItem::type() const
return Type;
}
bool SplineItem::editing()
bool SplineItem::editing() const
{
return m_editing;
}
......@@ -99,7 +99,7 @@ void SplineItem::updateSpline(bool editing)
emit changed(editing);
}
QList <BPoint> SplineItem::getPoints()
QList <BPoint> SplineItem::getPoints() const
{
QList <BPoint> points;
foreach (QGraphicsItem *child, childItems())
......
......@@ -36,19 +36,19 @@ public:
virtual int type() const;
bool editing();
bool editing() const;
void updateSpline(bool editing = false);
QList <BPoint> getPoints();
QList <BPoint> getPoints() const;
void setPoints(const QList <BPoint> &points);
void removeChild(QGraphicsItem *child);
protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
private:
int getClosestPointOnCurve(const QPointF &point, double *tFinal);
......
......@@ -62,8 +62,8 @@ protected:
QProcess *m_jobProcess;
signals:
void jobProgress(QString, int, int);
void cancelRunningJob(const QString, stringMap);
void jobProgress(const QString&, int, int);
void cancelRunningJob(const QString &, const stringMap&);
};
......
......@@ -67,7 +67,7 @@ private:
QMap <QString, QString> m_extra;
signals:
void gotFilterJobResults(const QString &id, int startPos, int track, stringMap result, stringMap extra);
void gotFilterJobResults(const QString &id, int startPos, int track, const stringMap &result, const stringMap &extra);
};
#endif
......@@ -21,13 +21,16 @@
#include "proxyclipjob.h"
#include "kdenlivesettings.h"
#include "kdenlivedoc.h"
#include <QProcess>
#include <KDebug>
#include <KLocale>
ProxyJob::ProxyJob(CLIPTYPE cType, const QString &id, const QStringList& parameters) : AbstractClipJob(PROXYJOB, cType, id, parameters),
m_jobDuration(0),
m_isFfmpegJob(true)
ProxyJob::ProxyJob(CLIPTYPE cType, const QString &id, const QStringList& parameters)
: AbstractClipJob(PROXYJOB, cType, id, parameters),
m_jobDuration(0),
m_isFfmpegJob(true)
{
m_jobStatus = JOBWAITING;
description = i18n("proxy");
......@@ -51,7 +54,7 @@ void ProxyJob::startJob()
mltParameters << m_src;
mltParameters << "-consumer" << "avformat:" + m_dest;
QStringList params = m_proxyParams.split('-', QString::SkipEmptyParts);
foreach(const QString &s, params) {
QString t = s.simplified();
if (t.count(' ') == 0) {
......@@ -65,14 +68,14 @@ void ProxyJob::startJob()
//TODO: currently, when rendering an xml file through melt, the display ration is lost, so we enforce it manualy
double display_ratio;
if (m_src.startsWith("consumer:")) display_ratio = KdenliveDoc::getDisplayRatio(m_src.section(":", 1));
else display_ratio = KdenliveDoc::getDisplayRatio(m_src);
if (m_src.startsWith("consumer:")) display_ratio = KdenliveDoc::getDisplayRatio(m_src.section(":", 1));
else display_ratio = KdenliveDoc::getDisplayRatio(m_src);
mltParameters << "aspect=" + QLocale().toString(display_ratio);
// Ask for progress reporting
mltParameters << "progress=1";
m_jobProcess = new QProcess;
m_jobProcess = new QProcess;
m_jobProcess->setProcessChannelMode(QProcess::MergedChannels);
m_jobProcess->start(KdenliveSettings::rendererpath(), mltParameters);
m_jobProcess->waitForStarted();
......@@ -82,13 +85,13 @@ void ProxyJob::startJob()
// Image proxy
QImage i(m_src);
if (i.isNull()) {
m_errorMessage.append(i18n("Cannot load image %1.", m_src));
m_errorMessage.append(i18n("Cannot load image %1.", m_src));
setStatus(JOBCRASHED);
return;
}
return;
}
QImage proxy;
// Images are scaled to profile size.
// Images are scaled to profile size.
//TODO: Make it be configurable?
if (i.width() > i.height()) proxy = i.scaledToWidth(m_renderWidth);
else proxy = i.scaledToHeight(m_renderHeight);
......@@ -98,40 +101,40 @@ void ProxyJob::startJob()
QMatrix matrix;
switch ( m_exif ) {
case 2:
matrix.scale( -1, 1 );
break;
case 3:
matrix.rotate( 180 );
break;
case 4:
matrix.scale( 1, -1 );
break;
case 5:
matrix.rotate( 270 );
matrix.scale( -1, 1 );
break;
case 6:
matrix.rotate( 90 );
break;
case 7:
matrix.rotate( 90 );
matrix.scale( -1, 1 );
break;
case 8:
matrix.rotate( 270 );
break;
case 2:
matrix.scale( -1, 1 );
break;
case 3:
matrix.rotate( 180 );
break;
case 4:
matrix.scale( 1, -1 );
break;
case 5:
matrix.rotate( 270 );
matrix.scale( -1, 1 );
break;
case 6:
matrix.rotate( 90 );
break;
case 7:
matrix.rotate( 90 );
matrix.scale( -1, 1 );
break;
case 8:
matrix.rotate( 270 );
break;
}
processed = proxy.transformed( matrix );
processed.save(m_dest);
} else {
proxy.save(m_dest);
}
else proxy.save(m_dest);
setStatus(JOBDONE);
return;
}
else {
return;
} else {
m_isFfmpegJob = true;
QStringList parameters;
QStringList parameters;
parameters << "-i" << m_src;
QString params = m_proxyParams;
foreach(const QString &s, params.split(' '))
......@@ -182,8 +185,11 @@ void ProxyJob::processLogInfo()
{
if (!m_jobProcess || m_jobStatus == JOBABORTED) return;
QString log = m_jobProcess->readAll();
if (!log.isEmpty()) m_logDetails.append(log + '\n');
else return;
if (!log.isEmpty())
m_logDetails.append(log + '\n');
else
return;
int progress;
if (m_isFfmpegJob) {
// Parse FFmpeg output
......@@ -233,14 +239,14 @@ const QString ProxyJob::statusMessage()
{
QString statusInfo;
switch (m_jobStatus) {
case JOBWORKING:
statusInfo = i18n("Creating proxy");
break;
case JOBWAITING:
statusInfo = i18n("Waiting - proxy");
break;
default:
break;
case JOBWORKING:
statusInfo = i18n("Creating proxy");
break;
case JOBWAITING:
statusInfo = i18n("Waiting - proxy");
break;
default:
break;
}
return statusInfo;
}
......
......@@ -22,8 +22,6 @@
#define PROXYCLIPJOB
#include <QObject>
#include <QProcess>
#include "abstractclipjob.h"
......
......@@ -27,7 +27,7 @@
#endif
AbstractAudioScopeWidget::AbstractAudioScopeWidget(bool trackMouse, QWidget *parent) :
AbstractScopeWidget(trackMouse, parent),
AbstractScopeWidget(trackMouse, parent),
m_freq(0),
m_nChannels(0),
m_nSamples(0),
......
......@@ -44,8 +44,8 @@ protected:
when calculation has finished, to allow multi-threading.
accelerationFactor hints how much faster than usual the calculation should be accomplished, if possible. */
virtual QImage renderAudioScope(uint accelerationFactor,
const QVector<int16_t> &audioFrame, const int freq, const int num_channels, const int num_samples,
const int newData) = 0;
const QVector<int16_t> &audioFrame, const int freq, const int num_channels, const int num_samples,
const int newData) = 0;
int m_freq;
int m_nChannels;
......
......@@ -222,8 +222,8 @@ void AudioSignal::showAudio(const QByteArray &arr)
double AudioSignal::valueToPixel(double in)
{
//in=0 -> return 0 (null length from max), in=127/127 return 1 (max length )
return 1.0- log10( in)/log10(1.0/127.0);
//in=0 -> return 0 (null length from max), in=127/127 return 1 (max length )
return 1.0- log10( in)/log10(1.0/127.0);
}
#include "audiosignal.moc"
......@@ -31,15 +31,15 @@
#define MIN_FREQ_VALUE 1000
Spectrogram::Spectrogram(QWidget *parent) :
AbstractAudioScopeWidget(true, parent)
, m_fftTools()
, m_fftHistory()
, m_fftHistoryImg()
, m_dBmin(-70)
, m_dBmax(0)
, m_freqMax(0)
, m_customFreq(false)
, m_parameterChanged(false)
AbstractAudioScopeWidget(true, parent)
, m_fftTools()
, m_fftHistory()
, m_fftHistoryImg()
, m_dBmin(-70)
, m_dBmax(0)
, m_freqMax(0)
, m_customFreq(false)
, m_parameterChanged(false)
{
ui = new Ui::Spectrogram_UI;
ui->setupUi(this);
......@@ -148,21 +148,21 @@ QString Spectrogram::widgetName() const
QRect Spectrogram::scopeRect()
{
m_scopeRect = QRect(
QPoint(
QPoint(
10, // Left
ui->verticalSpacer->geometry().top()+6 // Top
),
AbstractAudioScopeWidget::rect().bottomRight()
);
),
AbstractAudioScopeWidget::rect().bottomRight()
);
m_innerScopeRect = QRect(
QPoint(
QPoint(
m_scopeRect.left()+66, // Left
m_scopeRect.top()+6 // Top
), QPoint(
), QPoint(
ui->verticalSpacer->geometry().right()-70,
ui->verticalSpacer->geometry().bottom()-40
)
);
)
);
return m_scopeRect;
}
......@@ -277,7 +277,7 @@ QImage Spectrogram::renderHUD(uint)
x = leftDist + mouseX;
davinci.drawLine(x, topDist, x, topDist + m_innerScopeRect.height()+6);
davinci.drawText(x-10, y, i18n("%1 kHz", QString("%1")
.arg((double)(m_mousePos.x()-m_innerScopeRect.left())/m_innerScopeRect.width() * m_freqMax/1000, 0, 'f', 2)));
.arg((double)(m_mousePos.x()-m_innerScopeRect.left())/m_innerScopeRect.width() * m_freqMax/1000, 0, 'f', 2)));
}
// Draw the dB brightness scale
......@@ -309,7 +309,7 @@ QImage Spectrogram::renderAudioScope(uint, const QVector<int16_t> &audioFrame, c
if (
audioFrame.size() > 63
&& m_innerScopeRect.width() > 0 && m_innerScopeRect.height() > 0
) {
) {
if (!m_customFreq) {
m_freqMax = freq / 2;
}
......@@ -428,7 +428,7 @@ QImage Spectrogram::renderAudioScope(uint, const QVector<int16_t> &audioFrame, c
#ifdef DEBUG_SPECTROGRAM
qDebug() << "Rendered " << y-topDist << "lines from " << m_fftHistory.size() << " available samples in " << start.elapsed() << " ms"
<< (completeRedraw ? "" : " (re-used old image)");
<< (completeRedraw ? "" : " (re-used old image)");
uint storedBytes = 0;
for (QList< QVector<float> >::iterator it = m_fftHistory.begin(); it != m_fftHistory.end(); it++) {
storedBytes += (*it).size() * sizeof((*it)[0]);
......
......@@ -91,7 +91,10 @@ void Histogram::writeConfig()
scopeConfig.sync();
}
QString Histogram::widgetName() const { return QString("Histogram"); }
QString Histogram::widgetName() const
{
return QString::fromLatin1("Histogram");
}
bool Histogram::isHUDDependingOnInput() const { return false; }
bool Histogram::isScopeDependingOnInput() const { return true; }
......
......@@ -30,7 +30,7 @@ public:
explicit Waveform(QWidget *parent = 0);
~Waveform();
virtual QString widgetName() const;
QString widgetName() const;
protected:
virtual void readConfig();
......
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