From d7224c861d0935141cd4f9c57eea1b1902578148 Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Thu, 30 May 2013 09:16:50 +0200 Subject: [PATCH] const'ref, Remove not necessary virtual keyword. Fix includes --- src/beziercurve/cubicbezierspline.cpp | 8 ++++---- src/beziercurve/cubicbezierspline.h | 2 +- src/commands/addclipcommand.cpp | 12 ++++++++---- src/commands/addclipcommand.h | 4 ++-- src/commands/addclipcutcommand.cpp | 12 ++++++++---- src/commands/addclipcutcommand.h | 4 ++-- src/commands/addeffectcommand.cpp | 25 +++++++++++++++++-------- src/commands/addeffectcommand.h | 4 ++-- src/commands/addextradatacommand.cpp | 6 ++++-- src/commands/addextradatacommand.h | 10 ++-------- src/commands/addfoldercommand.cpp | 18 ++++++++++++------ src/commands/addfoldercommand.h | 4 ++-- src/commands/addmarkercommand.cpp | 10 ++++++---- src/commands/addmarkercommand.h | 8 ++------ src/commands/addtimelineclipcommand.cpp | 14 +++++++++----- src/commands/addtimelineclipcommand.h | 7 +++---- testingArea/audioOffset.cpp | 17 +++++------------ 17 files changed, 89 insertions(+), 76 deletions(-) diff --git a/src/beziercurve/cubicbezierspline.cpp b/src/beziercurve/cubicbezierspline.cpp index 13b1b73e..45cca94c 100644 --- a/src/beziercurve/cubicbezierspline.cpp +++ b/src/beziercurve/cubicbezierspline.cpp @@ -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 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 CubicBezierSpline::points() +QList CubicBezierSpline::points() const { return m_points; } diff --git a/src/beziercurve/cubicbezierspline.h b/src/beziercurve/cubicbezierspline.h index 21024bd2..7cd0275e 100644 --- a/src/beziercurve/cubicbezierspline.h +++ b/src/beziercurve/cubicbezierspline.h @@ -49,7 +49,7 @@ public: QString toString() const; /** @brief Returns a list of the points defining the spline. */ - QList points(); + QList 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); diff --git a/src/commands/addclipcommand.cpp b/src/commands/addclipcommand.cpp index 44df4d5b..d8cc2e48 100644 --- a/src/commands/addclipcommand.cpp +++ b/src/commands/addclipcommand.cpp @@ -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); } diff --git a/src/commands/addclipcommand.h b/src/commands/addclipcommand.h index a549ee68..bf8a3419 100644 --- a/src/commands/addclipcommand.h +++ b/src/commands/addclipcommand.h @@ -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; diff --git a/src/commands/addclipcutcommand.cpp b/src/commands/addclipcutcommand.cpp index 09920054..6faec763 100644 --- a/src/commands/addclipcutcommand.cpp +++ b/src/commands/addclipcutcommand.cpp @@ -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); } diff --git a/src/commands/addclipcutcommand.h b/src/commands/addclipcutcommand.h index 3fc21264..e1c8c234 100644 --- a/src/commands/addclipcutcommand.h +++ b/src/commands/addclipcutcommand.h @@ -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; diff --git a/src/commands/addeffectcommand.cpp b/src/commands/addeffectcommand.cpp index f858ecb3..399ec59f 100644 --- a/src/commands/addeffectcommand.cpp +++ b/src/commands/addeffectcommand.cpp @@ -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); } diff --git a/src/commands/addeffectcommand.h b/src/commands/addeffectcommand.h index 0f01a725..0c29c48b 100644 --- a/src/commands/addeffectcommand.h +++ b/src/commands/addeffectcommand.h @@ -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; diff --git a/src/commands/addextradatacommand.cpp b/src/commands/addextradatacommand.cpp index c5ff3289..f2aa5411 100644 --- a/src/commands/addextradatacommand.cpp +++ b/src/commands/addextradatacommand.cpp @@ -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")); } diff --git a/src/commands/addextradatacommand.h b/src/commands/addextradatacommand.h index 784d17f4..b3c1d8fa 100644 --- a/src/commands/addextradatacommand.h +++ b/src/commands/addextradatacommand.h @@ -19,13 +19,7 @@ #define EXTRADATACOMMAND_H #include -#include -#include -#include -#include -#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; diff --git a/src/commands/addfoldercommand.cpp b/src/commands/addfoldercommand.cpp index 392a666d..3f5c562f 100644 --- a/src/commands/addfoldercommand.cpp +++ b/src/commands/addfoldercommand.cpp @@ -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); } diff --git a/src/commands/addfoldercommand.h b/src/commands/addfoldercommand.h index c9e52c51..c4e91525 100644 --- a/src/commands/addfoldercommand.h +++ b/src/commands/addfoldercommand.h @@ -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; diff --git a/src/commands/addmarkercommand.cpp b/src/commands/addmarkercommand.cpp index f315f3f4..46a7d9c1 100644 --- a/src/commands/addmarkercommand.cpp +++ b/src/commands/addmarkercommand.cpp @@ -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() { diff --git a/src/commands/addmarkercommand.h b/src/commands/addmarkercommand.h index f89ca937..09334584 100644 --- a/src/commands/addmarkercommand.h +++ b/src/commands/addmarkercommand.h @@ -19,10 +19,6 @@ #define MARKERCOMMAND_H #include -#include -#include -#include -#include #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; diff --git a/src/commands/addtimelineclipcommand.cpp b/src/commands/addtimelineclipcommand.cpp index f6befebf..5cc0fe70 100644 --- a/src/commands/addtimelineclipcommand.cpp +++ b/src/commands/addtimelineclipcommand.cpp @@ -23,7 +23,7 @@ #include -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; } diff --git a/src/commands/addtimelineclipcommand.h b/src/commands/addtimelineclipcommand.h index 7d508c39..7a7a1d9d 100644 --- a/src/commands/addtimelineclipcommand.h +++ b/src/commands/addtimelineclipcommand.h @@ -22,7 +22,6 @@ #define TIMELINECLIPCOMMAND_H #include -#include #include #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; diff --git a/testingArea/audioOffset.cpp b/testingArea/audioOffset.cpp index fd2e9c3b..f71b1052 100644 --- a/testingArea/audioOffset.cpp +++ b/testingArea/audioOffset.cpp @@ -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; -- 2.39.2