Commit e8f43a6f authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Still const'ref. Minor optimization

parent ba6cfa60
......@@ -279,7 +279,7 @@ void AbstractClipItem::drawKeyFrames(QPainter *painter, const QTransform &transf
x2 = br.right();
if (limitedKeyFrames) {
QMap<int, int>::const_iterator end = m_keyframes.constEnd();
end--;
--end;
x2 = x1 + maxw * (end.key() - start);
x1 += maxw * (m_keyframes.constBegin().key() - start);
}
......
......@@ -107,7 +107,7 @@ QPainterPath AbstractGroupItem::transitionGroupShape(QPointF offset) const
return groupShape(TRANSITIONWIDGET, offset);
}
QPainterPath AbstractGroupItem::groupShape(GRAPHICSRECTITEM type, QPointF offset) const
QPainterPath AbstractGroupItem::groupShape(GRAPHICSRECTITEM type, const QPointF &offset) const
{
QPainterPath path;
QList<QGraphicsItem *> children = childItems();
......@@ -130,7 +130,7 @@ QPainterPath AbstractGroupItem::groupShape(GRAPHICSRECTITEM type, QPointF offset
return path;
}
QPainterPath AbstractGroupItem::spacerGroupShape(GRAPHICSRECTITEM type, QPointF offset) const
QPainterPath AbstractGroupItem::spacerGroupShape(GRAPHICSRECTITEM type, const QPointF &offset) const
{
QPainterPath path;
QList<QGraphicsItem *> children = childItems();
......@@ -212,7 +212,7 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant
int xpos = projectScene()->getSnapPointForPos((int)(start.x() + newPos.x() - pos().x()), KdenliveSettings::snaptopoints());
xpos = qMax(xpos, 0);
//kDebug()<<"GRP XPOS:"<<xpos<<", START:"<<start.x()<<",NEW:"<<newPos.x()<<"; SCENE:"<<scenePos().x()<<",POS:"<<pos().x();
//kDebug()<<"GRP XPOS:"<<xpos<<", START:"<<start.x()<<",NEW:"<<newPos.x()<<"; SCENE:"<<scenePos().x()<<",POS:"<<pos().x();
newPos.setX((int)(pos().x() + xpos - (int) start.x()));
QStringList lockedTracks = property("locked_tracks").toStringList();
int proposedTrack = (property("y_absolute").toInt() + newPos.y()) / trackHeight;
......
......@@ -71,8 +71,8 @@ protected:
private:
void fixItemRect();
QPainterPath groupShape(GRAPHICSRECTITEM type, QPointF offset) const;
QPainterPath spacerGroupShape(GRAPHICSRECTITEM type, QPointF offset) const;
QPainterPath groupShape(GRAPHICSRECTITEM type, const QPointF &offset) const;
QPainterPath spacerGroupShape(GRAPHICSRECTITEM type, const QPointF &offset) const;
/** Stores the original info of the items beeing resized. */
QList <ItemInfo> m_resizeInfos;
};
......
......@@ -648,7 +648,7 @@ void ClipItem::slotGetEndThumb()
}
void ClipItem::slotSetStartThumb(QImage img)
void ClipItem::slotSetStartThumb(const QImage &img)
{
if (!img.isNull() && img.format() == QImage::Format_ARGB32) {
QPixmap pix = QPixmap::fromImage(img);
......@@ -659,7 +659,7 @@ void ClipItem::slotSetStartThumb(QImage img)
}
}
void ClipItem::slotSetEndThumb(QImage img)
void ClipItem::slotSetEndThumb(const QImage &img)
{
if (!img.isNull() && img.format() == QImage::Format_ARGB32) {
QPixmap pix = QPixmap::fromImage(img);
......@@ -690,12 +690,12 @@ void ClipItem::slotThumbReady(int frame, QImage img)
}
}
void ClipItem::slotSetStartThumb(const QPixmap pix)
void ClipItem::slotSetStartThumb(const QPixmap &pix)
{
m_startPix = pix;
}
void ClipItem::slotSetEndThumb(const QPixmap pix)
void ClipItem::slotSetEndThumb(const QPixmap &pix)
{
m_endPix = pix;
}
......
......@@ -251,16 +251,16 @@ private slots:
void slotGotAudioData();
void slotPrepareAudioThumb(double pixelForOneFrame, int startpixel, int endpixel, int channels, int pixelHeight);
void animate(qreal value);
void slotSetStartThumb(QImage img);
void slotSetEndThumb(QImage img);
void slotSetStartThumb(const QImage &img);
void slotSetEndThumb(const QImage &img);
void slotThumbReady(int frame, QImage img);
/** @brief The thumbnailer has finished to cache all required thumbs. */
void slotGotThumbsCache();
public slots:
void slotFetchThumbs();
void slotSetStartThumb(const QPixmap pix);
void slotSetEndThumb(const QPixmap pix);
void slotSetStartThumb(const QPixmap &pix);
void slotSetEndThumb(const QPixmap &pix);
void slotUpdateRange();
signals:
......
......@@ -527,7 +527,7 @@ void ClipManager::slotAddClip(KIO::Job *job, const KUrl &, const KUrl &dst)
slotAddClipList(KUrl::List () << dst, data);
}
void ClipManager::slotAddClipList(const KUrl::List urls, QMap <QString, QString> data)
void ClipManager::slotAddClipList(const KUrl::List &urls, QMap <QString, QString> data)
{
QUndoCommand *addClips = new QUndoCommand();
// Update list of removable volumes
......@@ -641,7 +641,7 @@ void ClipManager::slotAddClipList(const KUrl::List urls, QMap <QString, QString>
}
}
void ClipManager::slotAddClipFile(const KUrl &url, QMap <QString, QString> data)
void ClipManager::slotAddClipFile(const KUrl &url, const QMap <QString, QString> &data)
{
slotAddClipList(KUrl::List(url), data);
}
......
......@@ -88,14 +88,14 @@ Q_OBJECT public:
* @param url file to add
* @param group name of the group to insert the file in (can be empty)
* @param groupId id of the group (if any) */
void slotAddClipFile(const KUrl &url, QMap <QString, QString> data);
void slotAddClipFile(const KUrl &url, const QMap<QString, QString> &data);
/** @brief Adds a list of files to the project.
* @param urls files to add
* @param group name of the group to insert the files in (can be empty)
* @param groupId id of the group (if any)
* It checks for duplicated items and asks to the user for instructions. */
void slotAddClipList(const KUrl::List urls, QMap <QString, QString> data);
void slotAddClipList(const KUrl::List &urls, QMap <QString, QString> data);
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);
......
......@@ -5669,7 +5669,7 @@ void CustomTrackView::slotLoadClipMarkers(const QString &id)
else delete command;
}
void CustomTrackView::addMarker(const QString &id, const CommentedTime marker)
void CustomTrackView::addMarker(const QString &id, const CommentedTime &marker)
{
DocClipBase *base = m_document->clipManager()->getClipById(id);
if (base == NULL) return;
......
......@@ -76,7 +76,7 @@ public:
void deleteClip(ItemInfo info, bool refresh = true);
void slotDeleteClipMarker(const QString &comment, const QString &id, const GenTime &position);
void slotDeleteAllClipMarkers(const QString &id);
void addMarker(const QString &id, const CommentedTime marker);
void addMarker(const QString &id, const CommentedTime &marker);
void addData(const QString &id, const QString &key, const QString &data);
void setScale(double scaleFactor, double verticalScale);
void deleteClip(const QString &clipId);
......
......@@ -51,8 +51,6 @@ private slots:
private:
QString m_projectWildcard;
signals:
};
......
......@@ -328,7 +328,7 @@ QString GeometryWidget::getExtraValue(const QString &name) const
return val;
}
void GeometryWidget::setupParam(const QDomElement elem, int minframe, int maxframe)
void GeometryWidget::setupParam(const QDomElement &elem, int minframe, int maxframe)
{
m_inPoint = minframe;
m_outPoint = maxframe;
......
......@@ -66,7 +66,7 @@ public slots:
* @param elem DomElement representing this effect parameter
* @param minframe In point of the clip
* @param maxframe Out point of the clip */
void setupParam(const QDomElement elem, int minframe, int maxframe);
void setupParam(const QDomElement &elem, int minframe, int maxframe);
/** @brief Updates position of the local timeline to @param relTimelinePos. */
void slotSyncPosition(int relTimelinePos);
void slotResetKeyframes();
......
......@@ -252,7 +252,7 @@ void SplineItem::hoverMoveEvent(QGraphicsSceneHoverEvent* event)
unsetCursor();
}
int SplineItem::getClosestPointOnCurve(QPointF point, double *tFinal)
int SplineItem::getClosestPointOnCurve(const QPointF &point, double *tFinal)
{
// TODO: proper minDiff
qreal diff = 10000, param = 0;
......
......@@ -51,7 +51,7 @@ protected:
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
private:
int getClosestPointOnCurve(QPointF point, double *tFinal);
int getClosestPointOnCurve(const QPointF &point, double *tFinal);
bool m_closed;
bool m_editing;
......
......@@ -98,7 +98,7 @@ void SimpleKeyframeWidget::slotSetPosition(int pos, bool update)
emit positionChanged(pos);
}
int SimpleKeyframeWidget::getPosition()
int SimpleKeyframeWidget::getPosition() const
{
return m_time->getValue();
}
......
......@@ -37,7 +37,7 @@ public:
explicit SimpleKeyframeWidget(const Timecode &t, int duration, QWidget* parent = 0);
~SimpleKeyframeWidget();
int getPosition();
int getPosition() const;
void setKeyframes(const QList <int> &keyframes);
void addKeyframe(int pos = -1);
......@@ -60,7 +60,6 @@ private:
QToolButton *m_buttonAddDelete;
QToolButton *m_buttonPrevious;
QToolButton *m_buttonNext;
//QToolButton *m_buttonSync;
TimecodeDisplay *m_time;
};
......
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