Commit d7224c86 authored by Laurent Montel's avatar Laurent Montel

const'ref, Remove not necessary virtual keyword. Fix includes

parent 3935d0f2
......@@ -48,12 +48,12 @@ void CubicBezierSpline::fromString(const QString& spline)
{
m_points.clear();
QStringList bpoints = spline.split('|');
const QStringList bpoints = spline.split(QLatin1Char('|'));
foreach(const QString &bpoint, bpoints) {
QStringList points = bpoint.split('#');
const QStringList points = bpoint.split(QLatin1Char('#'));
QList <QPointF> values;
foreach(const QString &point, points) {
QStringList xy = point.split(';');
QStringList xy = point.split(QLatin1Char(';'));
if (xy.count() == 2)
values.append(QPointF(xy.at(0).toDouble(), xy.at(1).toDouble()));
}
......@@ -86,7 +86,7 @@ int CubicBezierSpline::setPoint(int ix, const BPoint& point)
return indexOf(point); // in case it changed
}
QList <BPoint> CubicBezierSpline::points()
QList <BPoint> CubicBezierSpline::points() const
{
return m_points;
}
......
......@@ -49,7 +49,7 @@ public:
QString toString() const;
/** @brief Returns a list of the points defining the spline. */
QList <BPoint> points();
QList <BPoint> points() const;
/** @brief Sets the point at index @param ix to @param point and returns its index (it might have changed during validation). */
int setPoint(int ix, const BPoint &point);
......
......@@ -39,14 +39,18 @@ AddClipCommand::AddClipCommand(KdenliveDoc *doc, const QDomElement &xml, const Q
void AddClipCommand::undo()
{
kDebug() << "---- undoing action";
if (m_doIt) m_doc->deleteClip(m_id);
else m_doc->addClip(m_xml, m_id);
if (m_doIt)
m_doc->deleteClip(m_id);
else
m_doc->addClip(m_xml, m_id);
}
// virtual
void AddClipCommand::redo()
{
kDebug() << "---- redoing action";
if (m_doIt) m_doc->addClip(m_xml, m_id);
else m_doc->deleteClip(m_id);
if (m_doIt)
m_doc->addClip(m_xml, m_id);
else
m_doc->deleteClip(m_id);
}
......@@ -32,8 +32,8 @@ class AddClipCommand : public QUndoCommand
public:
AddClipCommand(KdenliveDoc *doc, const QDomElement &xml, const QString &id, bool doIt, QUndoCommand * parent = 0);
virtual void undo();
virtual void redo();
void undo();
void redo();
private:
KdenliveDoc *m_doc;
......
......@@ -39,13 +39,17 @@ AddClipCutCommand::AddClipCutCommand(ProjectList *list, const QString &id, int i
// virtual
void AddClipCutCommand::undo()
{
if (m_remove) m_list->addClipCut(m_id, m_in, m_out, m_desc, m_newItem);
else m_list->removeClipCut(m_id, m_in, m_out);
if (m_remove)
m_list->addClipCut(m_id, m_in, m_out, m_desc, m_newItem);
else
m_list->removeClipCut(m_id, m_in, m_out);
}
// virtual
void AddClipCutCommand::redo()
{
if (m_remove) m_list->removeClipCut(m_id, m_in, m_out);
else m_list->addClipCut(m_id, m_in, m_out, m_desc, m_newItem);
if (m_remove)
m_list->removeClipCut(m_id, m_in, m_out);
else
m_list->addClipCut(m_id, m_in, m_out, m_desc, m_newItem);
}
......@@ -31,8 +31,8 @@ class AddClipCutCommand : public QUndoCommand
public:
AddClipCutCommand(ProjectList *list, const QString &id, int in, int out, const QString &desc, bool newItem, bool remove, QUndoCommand * parent = 0);
virtual void undo();
virtual void redo();
void undo();
void redo();
private:
ProjectList *m_list;
......
......@@ -33,10 +33,15 @@ AddEffectCommand::AddEffectCommand(CustomTrackView *view, const int track, const
{
QString effectName;
QDomElement namenode = m_effect.firstChildElement("name");
if (!namenode.isNull()) effectName = i18n(namenode.text().toUtf8().data());
else effectName = i18n("effect");
if (doIt) setText(i18n("Add %1", effectName));
else setText(i18n("Delete %1", effectName));
if (!namenode.isNull())
effectName = i18n(namenode.text().toUtf8().data());
else
effectName = i18n("effect");
if (doIt)
setText(i18n("Add %1", effectName));
else
setText(i18n("Delete %1", effectName));
}
......@@ -44,15 +49,19 @@ AddEffectCommand::AddEffectCommand(CustomTrackView *view, const int track, const
void AddEffectCommand::undo()
{
kDebug() << "---- undoing action";
if (m_doIt) m_view->deleteEffect(m_track, m_pos, m_effect);
else m_view->addEffect(m_track, m_pos, m_effect);
if (m_doIt)
m_view->deleteEffect(m_track, m_pos, m_effect);
else
m_view->addEffect(m_track, m_pos, m_effect);
}
// virtual
void AddEffectCommand::redo()
{
kDebug() << "---- redoing action";
if (m_doIt) m_view->addEffect(m_track, m_pos, m_effect);
else m_view->deleteEffect(m_track, m_pos, m_effect);
if (m_doIt)
m_view->addEffect(m_track, m_pos, m_effect);
else
m_view->deleteEffect(m_track, m_pos, m_effect);
}
......@@ -33,8 +33,8 @@ class AddEffectCommand : public QUndoCommand
public:
AddEffectCommand(CustomTrackView *view, const int track, const GenTime &pos, const QDomElement &effect, bool doIt, QUndoCommand * parent = 0);
virtual void undo();
virtual void redo();
void undo();
void redo();
private:
CustomTrackView *m_view;
......
......@@ -29,8 +29,10 @@ AddExtraDataCommand::AddExtraDataCommand(CustomTrackView *view, const QString&id
m_key(key),
m_id(id)
{
if (m_newData.isEmpty()) setText(i18n("Delete data"));
else setText(i18n("Add data"));
if (m_newData.isEmpty())
setText(i18n("Delete data"));
else
setText(i18n("Add data"));
}
......
......@@ -19,13 +19,7 @@
#define EXTRADATACOMMAND_H
#include <QUndoCommand>
#include <QGraphicsView>
#include <QPointF>
#include <QDomElement>
#include <KDebug>
#include "gentime.h"
#include "definitions.h"
class CustomTrackView;
......@@ -33,8 +27,8 @@ class AddExtraDataCommand : public QUndoCommand
{
public:
AddExtraDataCommand(CustomTrackView *view, const QString&id, const QString&key, const QString &oldData, const QString &newData, QUndoCommand * parent = 0);
virtual void undo();
virtual void redo();
void undo();
void redo();
private:
CustomTrackView *m_view;
......
......@@ -30,21 +30,27 @@ AddFolderCommand::AddFolderCommand(ProjectList *view, const QString &folderName,
m_id(clipId),
m_doIt(doIt)
{
if (doIt) setText(i18n("Add folder"));
else setText(i18n("Delete folder"));
if (doIt)
setText(i18n("Add folder"));
else
setText(i18n("Delete folder"));
}
// virtual
void AddFolderCommand::undo()
{
if (m_doIt) m_view->slotAddFolder(m_name, m_id, true);
else m_view->slotAddFolder(m_name, m_id, false);
if (m_doIt)
m_view->slotAddFolder(m_name, m_id, true);
else
m_view->slotAddFolder(m_name, m_id, false);
}
// virtual
void AddFolderCommand::redo()
{
if (m_doIt) m_view->slotAddFolder(m_name, m_id, false);
else m_view->slotAddFolder(m_name, m_id, true);
if (m_doIt)
m_view->slotAddFolder(m_name, m_id, false);
else
m_view->slotAddFolder(m_name, m_id, true);
}
......@@ -30,8 +30,8 @@ class AddFolderCommand : public QUndoCommand
public:
AddFolderCommand(ProjectList *view, const QString &folderName, const QString &clipId, bool doIt, QUndoCommand *parent = 0);
virtual void undo();
virtual void redo();
void undo();
void redo();
private:
ProjectList *m_view;
......
......@@ -28,12 +28,14 @@ AddMarkerCommand::AddMarkerCommand(CustomTrackView *view, const CommentedTime &o
m_newMarker(newMarker),
m_id(id)
{
if (m_newMarker.markerType() < 0) setText(i18n("Delete marker"));
else if (m_oldMarker.comment().isEmpty()) setText(i18n("Add marker"));
else setText(i18n("Edit marker"));
if (m_newMarker.markerType() < 0)
setText(i18n("Delete marker"));
else if (m_oldMarker.comment().isEmpty())
setText(i18n("Add marker"));
else
setText(i18n("Edit marker"));
}
// virtual
void AddMarkerCommand::undo()
{
......
......@@ -19,10 +19,6 @@
#define MARKERCOMMAND_H
#include <QUndoCommand>
#include <QGraphicsView>
#include <QPointF>
#include <QDomElement>
#include <KDebug>
#include "gentime.h"
#include "definitions.h"
......@@ -33,8 +29,8 @@ class AddMarkerCommand : public QUndoCommand
{
public:
AddMarkerCommand(CustomTrackView *view, const CommentedTime &oldMarker, const CommentedTime &newMarker, const QString &id, QUndoCommand * parent = 0);
virtual void undo();
virtual void redo();
void undo();
void redo();
private:
CustomTrackView *m_view;
......
......@@ -23,7 +23,7 @@
#include <KLocale>
AddTimelineClipCommand::AddTimelineClipCommand(CustomTrackView *view, const QDomElement &xml, const QString &clipId, ItemInfo info, EffectsList effects, bool overwrite, bool push, bool doIt, bool doRemove, QUndoCommand * parent) :
AddTimelineClipCommand::AddTimelineClipCommand(CustomTrackView *view, const QDomElement &xml, const QString &clipId, const ItemInfo &info, const EffectsList &effects, bool overwrite, bool push, bool doIt, bool doRemove, QUndoCommand * parent) :
QUndoCommand(parent),
m_view(view),
m_clipInfo(info),
......@@ -43,15 +43,19 @@ AddTimelineClipCommand::AddTimelineClipCommand(CustomTrackView *view, const QDom
// virtual
void AddTimelineClipCommand::undo()
{
if (!m_remove) m_view->deleteClip(m_clipInfo);
else m_view->addClip(m_xml, m_clipId, m_clipInfo, m_effects, m_overwrite, m_push);
if (!m_remove)
m_view->deleteClip(m_clipInfo);
else
m_view->addClip(m_xml, m_clipId, m_clipInfo, m_effects, m_overwrite, m_push);
}
// virtual
void AddTimelineClipCommand::redo()
{
if (m_doIt) {
if (!m_remove) m_view->addClip(m_xml, m_clipId, m_clipInfo, m_effects, m_overwrite, m_push);
else m_view->deleteClip(m_clipInfo);
if (!m_remove)
m_view->addClip(m_xml, m_clipId, m_clipInfo, m_effects, m_overwrite, m_push);
else
m_view->deleteClip(m_clipInfo);
}
m_doIt = true;
}
......
......@@ -22,7 +22,6 @@
#define TIMELINECLIPCOMMAND_H
#include <QUndoCommand>
#include <QDomElement>
#include <KDebug>
#include "gentime.h"
......@@ -34,9 +33,9 @@ class CustomTrackView;
class AddTimelineClipCommand : public QUndoCommand
{
public:
AddTimelineClipCommand(CustomTrackView *view, const QDomElement &xml, const QString &clipId, ItemInfo info, EffectsList effects, bool overwrite, bool push, bool doIt, bool doRemove, QUndoCommand * parent = 0);
virtual void undo();
virtual void redo();
AddTimelineClipCommand(CustomTrackView *view, const QDomElement &xml, const QString &clipId, const ItemInfo &info, const EffectsList &effects, bool overwrite, bool push, bool doIt, bool doRemove, QUndoCommand * parent = 0);
void undo();
void redo();
private:
CustomTrackView *m_view;
......
......@@ -137,11 +137,6 @@ int main(int argc, char *argv[])
envelopeSub->loadStdDev();
envelopeSub->dumpInfo();
// Calculate the correlation and hereby the audio shift
AudioCorrelation corr(envelopeMain);
int index = corr.addChild(envelopeSub, useFFT);
......@@ -149,25 +144,23 @@ int main(int argc, char *argv[])
int shift = corr.getShift(index);
std::cout << " Should be shifted by " << shift << " frames: " << fileSub << std::endl
<< "\trelative to " << fileMain << std::endl
<< "\tin a " << prodMain.get_fps() << " fps profile (" << profile << ")." << std::endl
;
<< "\tin a " << prodMain.get_fps() << " fps profile (" << profile << ")." << std::endl;
if (saveImages) {
QString outImg;
outImg = QString("envelope-main-%1.png")
QString outImg = QString::fromLatin1("envelope-main-%1.png")
.arg(QDateTime::currentDateTime().toString("yyyy-MM-dd-hh:mm:ss"));
envelopeMain->drawEnvelope().save(outImg);
std::cout << "Saved volume envelope as "
<< QFileInfo(outImg).absoluteFilePath().toStdString()
<< std::endl;
outImg = QString("envelope-sub-%1.png")
outImg = QString::fromLatin1("envelope-sub-%1.png")
.arg(QDateTime::currentDateTime().toString("yyyy-MM-dd-hh:mm:ss"));
envelopeSub->drawEnvelope().save(outImg);
std::cout << "Saved volume envelope as "
<< QFileInfo(outImg).absoluteFilePath().toStdString()
<< std::endl;
outImg = QString("correlation-%1.png")
outImg = QString::fromLatin1("correlation-%1.png")
.arg(QDateTime::currentDateTime().toString("yyyy-MM-dd-hh:mm:ss"));
corr.info(index)->toImage().save(outImg);
std::cout << "Saved correlation image as "
......@@ -176,7 +169,7 @@ int main(int argc, char *argv[])
}
// Mlt::Factory::close();
// Mlt::Factory::close();
return 0;
......
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