Commit 3d9ff40b authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use const'ref, change if(foo) delete foo => delete foo not necessary to check...

Use const'ref, change if(foo) delete foo => delete foo not necessary to check it, C++ does it for us

Add explicit keyword when necessary
parent f4699aef
......@@ -27,7 +27,7 @@
#include <QWheelEvent>
ClipDurationDialog::ClipDurationDialog(AbstractClipItem *clip, Timecode tc, GenTime min, GenTime max, QWidget * parent):
ClipDurationDialog::ClipDurationDialog(AbstractClipItem *clip, const Timecode &tc, const GenTime &min, const GenTime &max, QWidget * parent):
QDialog(parent),
m_clip(clip),
m_min(min),
......
......@@ -37,7 +37,7 @@ class ClipDurationDialog : public QDialog, public Ui::ClipDurationDialog_UI
Q_OBJECT
public:
ClipDurationDialog(AbstractClipItem *clip, Timecode tc, GenTime min, GenTime max, QWidget * parent = 0);
explicit ClipDurationDialog(AbstractClipItem *clip, const Timecode &tc, const GenTime &min, const GenTime &max, QWidget * parent = 0);
~ClipDurationDialog();
GenTime startPos() const;
GenTime cropStart() const;
......
......@@ -42,7 +42,7 @@
static int FRAME_SIZE;
ClipItem::ClipItem(DocClipBase *clip, ItemInfo info, double fps, double speed, int strobe, int frame_width, bool generateThumbs) :
ClipItem::ClipItem(DocClipBase *clip, const ItemInfo& info, double fps, double speed, int strobe, int frame_width, bool generateThumbs) :
AbstractClipItem(info, QRectF(), fps),
m_clip(clip),
m_startFade(0),
......
......@@ -46,7 +46,7 @@ class ClipItem : public AbstractClipItem
Q_OBJECT
public:
ClipItem(DocClipBase *clip, ItemInfo info, double fps, double speed, int strobe, int frame_width, bool generateThumbs = true);
ClipItem(DocClipBase *clip, const ItemInfo &info, double fps, double speed, int strobe, int frame_width, bool generateThumbs = true);
virtual ~ ClipItem();
virtual void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option,
......
......@@ -464,7 +464,7 @@ DocClipBase *ClipManager::getClipById(QString clipId)
return NULL;
}
const QList <DocClipBase *> ClipManager::getClipByResource(QString resource)
const QList <DocClipBase *> ClipManager::getClipByResource(const QString &resource)
{
QList <DocClipBase *> list;
QString clipResource;
......@@ -663,7 +663,7 @@ void ClipManager::slotAddXmlClipFile(const QString &name, const QDomElement &xml
m_doc->commandStack()->push(command);
}
void ClipManager::slotAddColorClipFile(const QString &name, const QString &color, QString duration, const QString &group, const QString &groupId)
void ClipManager::slotAddColorClipFile(const QString &name, const QString &color, const QString &duration, const QString &group, const QString &groupId)
{
QDomDocument doc;
QDomElement prod = doc.createElement("producer");
......@@ -982,7 +982,7 @@ bool ClipManager::isOnRemovableDevice(const KUrl &url)
return volumeMatch;
}
void ClipManager::projectTreeThumbReady(const QString &id, int frame, QImage img, int type)
void ClipManager::projectTreeThumbReady(const QString &id, int frame, const QImage &img, int type)
{
switch (type) {
case 2:
......
......@@ -99,10 +99,10 @@ Q_OBJECT public:
void slotAddTextClipFile(const QString &titleName, int out, const QString &xml, const QString &group, const QString &groupId);
void slotAddTextTemplateClip(QString titleName, const KUrl &path, const QString &group, const QString &groupId);
void slotAddXmlClipFile(const QString &name, const QDomElement &xml, const QString &group, const QString &groupId);
void slotAddColorClipFile(const QString &name, const QString &color, QString duration, const QString &group, const QString &groupId);
void slotAddColorClipFile(const QString &name, const QString &color, const QString &duration, const QString &group, const QString &groupId);
void slotAddSlideshowClipFile(QMap <QString, QString> properties, const QString &group, const QString &groupId);
DocClipBase *getClipById(QString clipId);
const QList <DocClipBase *> getClipByResource(QString resource);
const QList <DocClipBase *> getClipByResource(const QString &resource);
void slotDeleteClips(QStringList ids);
void setThumbsProgress(const QString &message, int progress);
void checkAudioThumbs();
......@@ -125,7 +125,7 @@ Q_OBJECT public:
int clipsCount() const;
/** @brief remove a clip id from the queue list. */
void stopThumbs(const QString &id);
void projectTreeThumbReady(const QString &id, int frame, QImage img, int type);
void projectTreeThumbReady(const QString &id, int frame, const QImage &img, int type);
#if KDE_IS_VERSION(4,5,0)
KImageCache* pixmapCache;
......
......@@ -56,7 +56,7 @@ static const int METATAB = 6;
static const int ADVANCEDTAB = 7;
ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidget * parent) :
ClipProperties::ClipProperties(DocClipBase *clip, const Timecode &tc, double fps, QWidget * parent) :
QDialog(parent)
, m_clip(clip)
, m_tc(tc)
......
......@@ -47,7 +47,7 @@ class ClipProperties : public QDialog
Q_OBJECT
public:
ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidget * parent = 0);
ClipProperties(DocClipBase *clip, const Timecode &tc, double fps, QWidget * parent = 0);
ClipProperties(QList <DocClipBase *>cliplist, Timecode tc, QMap <QString, QString> commonproperties, QWidget * parent);
virtual ~ClipProperties();
QMap <QString, QString> properties();
......
......@@ -127,7 +127,7 @@ void ClipTranscode::slotStartTransCode()
QStringList parameters;
QString destination;
QString params = ffmpeg_params->toPlainText().simplified();
if (m_urls.count() > 0 && urls_list->count() > 0) {
if (!m_urls.isEmpty() && urls_list->count() > 0) {
// We are processing multiple clips
source_url->setUrl(m_urls.takeFirst());
destination = dest_url->url().path(KUrl::AddTrailingSlash) + source_url->url().fileName();
......
......@@ -114,7 +114,7 @@ void ComplexParameter::slotParameterChanged(const QString& text)
updateButtonStatus();
}
void ComplexParameter::setupParam(const QDomElement d, const QString& paramName, int from, int to)
void ComplexParameter::setupParam(const QDomElement &d, const QString& paramName, int from, int to)
{
m_param = d;
m_ui.kplotwidget->setPointLists(d, paramName, from, to);
......@@ -125,7 +125,7 @@ void ComplexParameter::itemSelectionChanged()
//kDebug() << "drop";
}
void ComplexParameter::slotUpdateEffectParams(QDomElement e)
void ComplexParameter::slotUpdateEffectParams(const QDomElement &e)
{
m_param = e;
emit parameterChanged();
......
......@@ -45,8 +45,8 @@ public slots:
void slotShowInTimeline();
void slotParameterChanged(const QString&);
void itemSelectionChanged();
void setupParam(const QDomElement, const QString& paramName, int, int);
void slotUpdateEffectParams(QDomElement e);
void setupParam(const QDomElement &, const QString& paramName, int, int);
void slotUpdateEffectParams(const QDomElement &e);
void slotUpdateParameterList(const QStringList &);
signals:
void removeEffect(ClipItem*, QDomElement);
......
......@@ -36,7 +36,7 @@ inline int lerp( const int a, const int b, double t )
return a + (b - a) * t;
}
CornersWidget::CornersWidget(Monitor *monitor, const QDomElement& e, int minFrame, int maxFrame, Timecode tc, int activeKeyframe, QWidget* parent) :
CornersWidget::CornersWidget(Monitor *monitor, const QDomElement& e, int minFrame, int maxFrame, const Timecode &tc, int activeKeyframe, QWidget* parent) :
KeyframeEdit(e, minFrame, maxFrame, tc, activeKeyframe, parent),
m_monitor(monitor),
m_showScene(true),
......
......@@ -40,7 +40,7 @@ public:
* @param isEffect true if used in an effect, false if used in a transition
* @param factor Factor by which the parameters differ from the range 0-1
* @param parent (optional) Parent widget */
explicit CornersWidget(Monitor *monitor, const QDomElement &e, int minFrame, int maxFrame, Timecode tc, int activeKeyframe, QWidget* parent = 0);
explicit CornersWidget(Monitor *monitor, const QDomElement &e, int minFrame, int maxFrame, const Timecode &tc, int activeKeyframe, QWidget* parent = 0);
virtual ~CornersWidget();
virtual void addParameter(QDomElement e, int activeKeyframe = -1);
......
......@@ -99,7 +99,7 @@ void BackupWidget::slotDisplayBackupPreview()
backup_preview->setPixmap(QPixmap());
return;
}
QString path = backup_list->currentItem()->data(Qt::UserRole).toString();
const QString path = backup_list->currentItem()->data(Qt::UserRole).toString();
QPixmap pix(path + ".png");
backup_preview->setPixmap(pix);
}
......
......@@ -218,7 +218,7 @@ const QString DocClipBase::getProperty(const QString &prop) const
return m_properties.value(prop);
}
void DocClipBase::setDuration(GenTime dur)
void DocClipBase::setDuration(const GenTime &dur)
{
m_duration = dur;
m_properties.insert("duration", QString::number((int) dur.frames(KdenliveSettings::project_fps())));
......@@ -380,7 +380,7 @@ QList < CommentedTime > DocClipBase::commentedSnapMarkers() const
}
void DocClipBase::addSnapMarker(const CommentedTime marker)
void DocClipBase::addSnapMarker(const CommentedTime &marker)
{
QList < CommentedTime >::Iterator it = m_snapMarkers.begin();
for (it = m_snapMarkers.begin(); it != m_snapMarkers.end(); ++it) {
......@@ -397,7 +397,7 @@ void DocClipBase::addSnapMarker(const CommentedTime marker)
}
}
void DocClipBase::editSnapMarker(const GenTime & time, QString comment)
void DocClipBase::editSnapMarker(const GenTime & time, const QString &comment)
{
QList < CommentedTime >::Iterator it;
for (it = m_snapMarkers.begin(); it != m_snapMarkers.end(); ++it) {
......
......@@ -89,7 +89,7 @@ public:
const GenTime & duration() const;
const GenTime maxDuration() const;
/** returns the duration of this clip */
void setDuration(GenTime dur);
void setDuration(const GenTime &dur);
/** returns clip type (audio, text, image,...) */
const CLIPTYPE & clipType() const;
......@@ -271,8 +271,8 @@ public slots:
GenTime findPreviousSnapMarker(const GenTime & currTime);
GenTime hasSnapMarkers(const GenTime & time);
QString deleteSnapMarker(const GenTime & time);
void editSnapMarker(const GenTime & time, QString comment);
void addSnapMarker(const CommentedTime marker);
void editSnapMarker(const GenTime & time, const QString &comment);
void addSnapMarker(const CommentedTime &marker);
QList < GenTime > snapMarkers() const;
QString markerComment(GenTime t) const;
CommentedTime markerAt(GenTime t) const;
......
......@@ -31,7 +31,7 @@
#include <KLocalizedString>
DoubleParameterWidget::DoubleParameterWidget(const QString &name, double value, double min, double max, double defaultValue, const QString &comment, int id, const QString suffix, int decimals, QWidget *parent) :
DoubleParameterWidget::DoubleParameterWidget(const QString &name, double value, double min, double max, double defaultValue, const QString &comment, int id, const QString &suffix, int decimals, QWidget *parent) :
QWidget(parent)
{
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
......
......@@ -48,7 +48,7 @@ public:
* @param comment A comment explaining the parameter. Will be shown for the tooltip.
* @param suffix (optional) Suffix to display in spinbox
* @param parent (optional) Parent Widget */
DoubleParameterWidget(const QString &name, double value, double min, double max, double defaultValue, const QString &comment, int id, const QString suffix = QString(), int decimals = 0, QWidget* parent = 0);
explicit DoubleParameterWidget(const QString &name, double value, double min, double max, double defaultValue, const QString &comment, int id, const QString &suffix = QString(), int decimals = 0, QWidget* parent = 0);
~DoubleParameterWidget();
/** @brief Gets the parameter's value. */
......
......@@ -43,7 +43,7 @@
#include <KGlobalSettings>
DragValue::DragValue(const QString &label, double defaultValue, int decimals, double min, double max, int id, const QString suffix, bool showSlider, QWidget* parent) :
DragValue::DragValue(const QString &label, double defaultValue, int decimals, double min, double max, int id, const QString &suffix, bool showSlider, QWidget* parent) :
QWidget(parent),
m_maximum(max),
m_minimum(min),
......
......@@ -85,7 +85,7 @@ public:
* @param suffix The suffix that will be displayed in the spinbox (for example '%')
* @param showSlider If disabled, user can still drag on the label but no progress bar is shown
*/
DragValue(const QString &label, double defaultValue, int decimals, double min = 0, double max = 100, int id = -1, const QString suffix = QString(), bool showSlider = true, QWidget* parent = 0);
explicit DragValue(const QString &label, double defaultValue, int decimals, double min = 0, double max = 100, int id = -1, const QString &suffix = QString(), bool showSlider = true, QWidget* parent = 0);
virtual ~DragValue();
/** @brief Returns the precision = number of decimals */
......
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