From: Montel Laurent Date: Thu, 16 May 2013 21:44:26 +0000 (+0200) Subject: const'ref X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=9aad7a157711be17032fb5e77136e88eb2c93b8e;p=kdenlive const'ref --- diff --git a/src/abstractclipitem.h b/src/abstractclipitem.h index f2a5bed5..4999a72f 100644 --- a/src/abstractclipitem.h +++ b/src/abstractclipitem.h @@ -67,7 +67,7 @@ public: bool isItemLocked() const; void closeAnimation(); - virtual OPERATIONTYPE operationMode(QPointF pos) = 0; + virtual OPERATIONTYPE operationMode(const QPointF &pos) = 0; virtual GenTime startPos() const ; virtual void setTrack(int track); virtual GenTime endPos() const ; diff --git a/src/archivewidget.cpp b/src/archivewidget.cpp index 2b0327e6..597044aa 100644 --- a/src/archivewidget.cpp +++ b/src/archivewidget.cpp @@ -832,9 +832,10 @@ void ArchiveWidget::createArchive() // Add project file bool result = false; if (m_temp) { - archive.addLocalFile(m_temp->fileName(), m_name + ".kdenlive"); - result = archive.close(); - delete m_temp; + archive.addLocalFile(m_temp->fileName(), m_name + ".kdenlive"); + result = archive.close(); + delete m_temp; + m_temp = 0; } emit archivingFinished(result); } diff --git a/src/clipitem.cpp b/src/clipitem.cpp index 269e7a76..cfddd99c 100644 --- a/src/clipitem.cpp +++ b/src/clipitem.cpp @@ -128,7 +128,8 @@ ClipItem::~ClipItem() blockSignals(true); m_endThumbTimer.stop(); m_startThumbTimer.stop(); - if (scene()) scene()->removeItem(this); + if (scene()) + scene()->removeItem(this); if (m_clipType == VIDEO || m_clipType == AV || m_clipType == SLIDESHOW || m_clipType == PLAYLIST) { //disconnect(m_clip->thumbProducer(), SIGNAL(thumbReady(int,QImage)), this, SLOT(slotThumbReady(int,QImage))); //disconnect(m_clip, SIGNAL(gotAudioData()), this, SLOT(slotGotAudioData())); @@ -337,15 +338,15 @@ void ClipItem::initEffect(QDomElement effect, int diff, int offset) } } -const QString ClipItem::adjustKeyframes(QString keyframes, int offset) +const QString ClipItem::adjustKeyframes(const QString &keyframes, int offset) { QStringList result; // Simple keyframes const QStringList list = keyframes.split(';', QString::SkipEmptyParts); foreach(const QString &keyframe, list) { - int pos = keyframe.section(':', 0, 0).toInt() - offset; - QString newKey = QString::number(pos) + ":" + keyframe.section(':', 1); - result.append(newKey); + int pos = keyframe.section(':', 0, 0).toInt() - offset; + QString newKey = QString::number(pos) + ":" + keyframe.section(':', 1); + result.append(newKey); } return result.join(";"); } @@ -426,7 +427,7 @@ bool ClipItem::checkKeyFrames(int width, int height, int previousDuration, int c return clipEffectsModified; } -void ClipItem::setKeyframes(const int ix, const QStringList keyframes) +void ClipItem::setKeyframes(const int ix, const QStringList &keyframes) { QDomElement effect = m_effectList.at(ix); if (effect.attribute("disable") == "1") return; @@ -670,7 +671,7 @@ void ClipItem::slotSetEndThumb(const QImage &img) } } -void ClipItem::slotThumbReady(int frame, QImage img) +void ClipItem::slotThumbReady(int frame, const QImage &img) { if (scene() == NULL) return; QRectF r = boundingRect(); @@ -931,8 +932,8 @@ void ClipItem::paint(QPainter *painter, } if (m_isMainSelectedClip) { - framePen.setColor(Qt::red); - textBgColor = Qt::red; + framePen.setColor(Qt::red); + textBgColor = Qt::red; } // only paint details if clip is big enough @@ -1057,7 +1058,7 @@ void ClipItem::paint(QPainter *painter, } -OPERATIONTYPE ClipItem::operationMode(QPointF pos) +OPERATIONTYPE ClipItem::operationMode(const QPointF &pos) { if (isItemLocked()) return NONE; const double scale = projectScene()->scale().x(); diff --git a/src/clipitem.h b/src/clipitem.h index d71ebb5e..72eb0d4a 100644 --- a/src/clipitem.h +++ b/src/clipitem.h @@ -54,7 +54,7 @@ public: virtual int type() const; void resizeStart(int posx, bool size = true, bool emitChange = true); void resizeEnd(int posx, bool emitChange = true); - OPERATIONTYPE operationMode(QPointF pos); + OPERATIONTYPE operationMode(const QPointF &pos); static int itemHeight(); const QString clipProducer() const; int clipType() const; @@ -149,7 +149,7 @@ public: /** @brief Sets params with keyframes and updates the visible keyframes. * @param ix Number of the effect * @param keyframes a list of strings of keyframes (one string per param), which should be used */ - void setKeyframes(const int ix, const QStringList keyframes); + void setKeyframes(const int ix, const QStringList &keyframes); void setEffectList(const EffectsList effectList); void setSpeed(const double speed, int strobe); double speed() const; @@ -161,7 +161,7 @@ public: int hasEffect(const QString &tag, const QString &id) const; /** @brief Adjust keyframes to the new clip. */ - const QString adjustKeyframes(QString keyframes, int offset); + const QString adjustKeyframes(const QString &keyframes, int offset); /** @brief Makes sure all keyframes are in the clip's cropped duration. * @param cutPos the frame number where the new clip starts * @return Whether or not changes were made */ @@ -253,7 +253,7 @@ private slots: void animate(qreal value); void slotSetStartThumb(const QImage &img); void slotSetEndThumb(const QImage &img); - void slotThumbReady(int frame, QImage img); + void slotThumbReady(int frame, const QImage &img); /** @brief The thumbnailer has finished to cache all required thumbs. */ void slotGotThumbsCache(); diff --git a/src/definitions.h b/src/definitions.h index 20e87240..592156e1 100644 --- a/src/definitions.h +++ b/src/definitions.h @@ -242,7 +242,7 @@ public: if (!found) addParam(name, value); } - QString paramValue(const QString &name, QString defaultValue = QString()) const { + QString paramValue(const QString &name, const QString &defaultValue = QString()) const { for (int i = 0; i < size(); ++i) { if (at(i).name() == name) return at(i).value(); } @@ -274,7 +274,7 @@ public: GenTime time() const { return t; } - void setComment(QString comm) { + void setComment(const QString &comm) { c = comm; } void setMarkerType(int t) { @@ -301,7 +301,7 @@ public: return Qt::cyan; break; } - }; + } /* Implementation of > operator; Works identically as with basic types. */ bool operator>(CommentedTime op) const { @@ -332,9 +332,6 @@ private: GenTime t; QString c; int type; - - - }; QDebug operator << (QDebug qd, const ItemInfo &info); diff --git a/src/dvdwizardmenu.cpp b/src/dvdwizardmenu.cpp index 89d20dcb..82e16c87 100644 --- a/src/dvdwizardmenu.cpp +++ b/src/dvdwizardmenu.cpp @@ -218,7 +218,7 @@ bool DvdWizardMenu::isComplete() const } if (!m_view.background_image->isHidden()) { - // Make sure user selected a valid image / video file + // Make sure user selected a valid image / video file if (!QFile::exists(m_view.background_image->url().path())) { #if KDE_IS_VERSION(4,7,0) m_menuMessage->setText(i18n("Missing background image")); @@ -779,7 +779,7 @@ QDomElement DvdWizardMenu::toXml() const } -void DvdWizardMenu::loadXml(DVDFORMAT format, QDomElement xml) +void DvdWizardMenu::loadXml(DVDFORMAT format, const QDomElement &xml) { kDebug() << "// LOADING MENU"; if (xml.isNull()) return; diff --git a/src/dvdwizardmenu.h b/src/dvdwizardmenu.h index a67a1eed..8a74612c 100644 --- a/src/dvdwizardmenu.h +++ b/src/dvdwizardmenu.h @@ -164,7 +164,7 @@ public: int menuMovieLength() const; void changeProfile(DVDFORMAT format); QDomElement toXml() const; - void loadXml(DVDFORMAT format, QDomElement xml); + void loadXml(DVDFORMAT format, const QDomElement &xml); void prepareUnderLines(); void resetUnderLines(); diff --git a/src/stopmotion/stopmotion.h b/src/stopmotion/stopmotion.h index df5e0d2b..4c348952 100644 --- a/src/stopmotion/stopmotion.h +++ b/src/stopmotion/stopmotion.h @@ -40,9 +40,9 @@ public: void setImage(const QImage &img); protected: - virtual void paintEvent(QPaintEvent* event); - virtual void wheelEvent(QWheelEvent* event); - virtual void mousePressEvent(QMouseEvent*); + void paintEvent(QPaintEvent* event); + void wheelEvent(QWheelEvent* event); + void mousePressEvent(QMouseEvent*); private: QImage m_img; @@ -250,8 +250,8 @@ signals: /** @brief Ask to add sequence to current project. */ void addOrUpdateSequence(const QString &); - void doCreateThumbs(QImage, int); - void gotFrame(QImage); + void doCreateThumbs(const QImage&, int); + void gotFrame(const QImage&); }; #endif diff --git a/src/transition.cpp b/src/transition.cpp index d43d56d8..0d7462dc 100644 --- a/src/transition.cpp +++ b/src/transition.cpp @@ -289,7 +289,7 @@ QVariant Transition::itemChange(GraphicsItemChange change, const QVariant &value } -OPERATIONTYPE Transition::operationMode(QPointF pos) +OPERATIONTYPE Transition::operationMode(const QPointF &pos) { if (isItemLocked()) return NONE; diff --git a/src/transition.h b/src/transition.h index aa9a9cae..4e928774 100644 --- a/src/transition.h +++ b/src/transition.h @@ -55,7 +55,7 @@ public: int transitionEndTrack() const; QString transitionTag() const; QStringList transitionInfo() const; - OPERATIONTYPE operationMode(QPointF pos); + OPERATIONTYPE operationMode(const QPointF &pos); static int itemHeight(); static int itemOffset(); //const QMap < QString, QString > transitionParameters() const;