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

const'ify. Remove unimplemented function. Fix indent. Optimization

parent cba3c6aa
...@@ -32,7 +32,9 @@ class PropertiesViewDelegate : public QStyledItemDelegate ...@@ -32,7 +32,9 @@ class PropertiesViewDelegate : public QStyledItemDelegate
{ {
Q_OBJECT Q_OBJECT
public: public:
PropertiesViewDelegate(QWidget *parent) : QStyledItemDelegate(parent) { PropertiesViewDelegate(QWidget *parent)
: QStyledItemDelegate(parent)
{
m_height = parent->fontMetrics().height() * 1.2; m_height = parent->fontMetrics().height() * 1.2;
} }
protected: protected:
......
...@@ -68,7 +68,7 @@ private: ...@@ -68,7 +68,7 @@ private:
QStringList m_fixedParams; QStringList m_fixedParams;
signals: signals:
void addClip(KUrl url); void addClip(const KUrl &url);
}; };
......
...@@ -19,7 +19,7 @@ HistogramGenerator::HistogramGenerator() ...@@ -19,7 +19,7 @@ HistogramGenerator::HistogramGenerator()
} }
QImage HistogramGenerator::calculateHistogram(const QSize &paradeSize, const QImage &image, const int &components, QImage HistogramGenerator::calculateHistogram(const QSize &paradeSize, const QImage &image, const int &components,
HistogramGenerator::Rec rec, const bool &unscaled, const uint &accelFactor) const HistogramGenerator::Rec rec, bool unscaled, uint accelFactor) const
{ {
if (paradeSize.height() <= 0 || paradeSize.width() <= 0 || image.width() <= 0 || image.height() <= 0) { if (paradeSize.height() <= 0 || paradeSize.width() <= 0 || image.width() <= 0 || image.height() <= 0) {
return QImage(); return QImage();
...@@ -130,7 +130,7 @@ QImage HistogramGenerator::calculateHistogram(const QSize &paradeSize, const QIm ...@@ -130,7 +130,7 @@ QImage HistogramGenerator::calculateHistogram(const QSize &paradeSize, const QIm
} }
QImage HistogramGenerator::drawComponent(const int *y, const QSize &size, const float &scaling, const QColor &color, QImage HistogramGenerator::drawComponent(const int *y, const QSize &size, const float &scaling, const QColor &color,
const bool &unscaled, const uint &max) const bool unscaled, uint max) const
{ {
QImage component(max, size.height(), QImage::Format_ARGB32); QImage component(max, size.height(), QImage::Format_ARGB32);
component.fill(qRgba(0, 0, 0, 0)); component.fill(qRgba(0, 0, 0, 0));
...@@ -159,7 +159,7 @@ QImage HistogramGenerator::drawComponent(const int *y, const QSize &size, const ...@@ -159,7 +159,7 @@ QImage HistogramGenerator::drawComponent(const int *y, const QSize &size, const
} }
void HistogramGenerator::drawComponentFull(QPainter *davinci, const int *y, const float &scaling, const QRect &rect, void HistogramGenerator::drawComponentFull(QPainter *davinci, const int *y, const float &scaling, const QRect &rect,
const QColor &color, const int &textSpace, const bool &unscaled, const uint &max) const const QColor &color, int textSpace, bool unscaled, uint max) const
{ {
QImage component = drawComponent(y, rect.size() - QSize(0, textSpace), scaling, color, unscaled, max); QImage component = drawComponent(y, rect.size() - QSize(0, textSpace), scaling, color, unscaled, max);
davinci->drawImage(rect.topLeft(), component); davinci->drawImage(rect.topLeft(), component);
......
...@@ -33,12 +33,12 @@ public: ...@@ -33,12 +33,12 @@ public:
components are OR-ed HistogramGenerator::Components flags and decide with components (Y, R, G, B) to paint. components are OR-ed HistogramGenerator::Components flags and decide with components (Y, R, G, B) to paint.
unscaled = true leaves the width at 256 if the widget is wider (to avoid scaling). */ unscaled = true leaves the width at 256 if the widget is wider (to avoid scaling). */
QImage calculateHistogram(const QSize &paradeSize, const QImage &image, const int &components, const HistogramGenerator::Rec rec, QImage calculateHistogram(const QSize &paradeSize, const QImage &image, const int &components, const HistogramGenerator::Rec rec,
const bool &unscaled, const uint &accelFactor = 1) const; bool unscaled, uint accelFactor = 1) const;
QImage drawComponent(const int *y, const QSize &size, const float &scaling, const QColor &color, const bool &unscaled, const uint &max) const; QImage drawComponent(const int *y, const QSize &size, const float &scaling, const QColor &color, bool unscaled, uint max) const;
void drawComponentFull(QPainter *davinci, const int *y, const float &scaling, const QRect &rect, void drawComponentFull(QPainter *davinci, const int *y, const float &scaling, const QRect &rect,
const QColor &color, const int &textSpace, const bool &unscaled, const uint &max) const; const QColor &color, int textSpace, bool unscaled, uint max) const;
enum Components { ComponentY = 1<<0, ComponentR = 1<<1, ComponentG = 1<<2, ComponentB = 1<<3, ComponentSum = 1<<4 }; enum Components { ComponentY = 1<<0, ComponentR = 1<<1, ComponentG = 1<<2, ComponentB = 1<<3, ComponentSum = 1<<4 };
......
...@@ -37,8 +37,8 @@ RGBParadeGenerator::RGBParadeGenerator() ...@@ -37,8 +37,8 @@ RGBParadeGenerator::RGBParadeGenerator()
} }
QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QImage &image, QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QImage &image,
const RGBParadeGenerator::PaintMode paintMode, const bool &drawAxis, const RGBParadeGenerator::PaintMode paintMode, bool drawAxis,
const bool &drawGradientRef, const uint &accelFactor) bool drawGradientRef, uint accelFactor)
{ {
Q_ASSERT(accelFactor >= 1); Q_ASSERT(accelFactor >= 1);
......
...@@ -23,7 +23,7 @@ public: ...@@ -23,7 +23,7 @@ public:
RGBParadeGenerator(); RGBParadeGenerator();
QImage calculateRGBParade(const QSize &paradeSize, const QImage &image, const RGBParadeGenerator::PaintMode paintMode, QImage calculateRGBParade(const QSize &paradeSize, const QImage &image, const RGBParadeGenerator::PaintMode paintMode,
const bool &drawAxis, const bool &drawGradientRef, const uint &accelFactor = 1); bool drawAxis, bool drawGradientRef, uint accelFactor = 1);
static const QColor colHighlight; static const QColor colHighlight;
static const QColor colLight; static const QColor colLight;
......
...@@ -118,7 +118,7 @@ QPoint VectorscopeGenerator::mapToCircle(const QSize &targetSize, const QPointF ...@@ -118,7 +118,7 @@ QPoint VectorscopeGenerator::mapToCircle(const QSize &targetSize, const QPointF
QImage VectorscopeGenerator::calculateVectorscope(const QSize &vectorscopeSize, const QImage &image, const float &gain, QImage VectorscopeGenerator::calculateVectorscope(const QSize &vectorscopeSize, const QImage &image, const float &gain,
const VectorscopeGenerator::PaintMode &paintMode, const VectorscopeGenerator::PaintMode &paintMode,
const VectorscopeGenerator::ColorSpace &colorSpace, const VectorscopeGenerator::ColorSpace &colorSpace,
const bool &, const uint &accelFactor) const bool, uint accelFactor) const
{ {
if (vectorscopeSize.width() <= 0 || vectorscopeSize.height() <= 0 || image.width() <= 0 || image.height() <= 0) { if (vectorscopeSize.width() <= 0 || vectorscopeSize.height() <= 0 || image.width() <= 0 || image.height() <= 0) {
// Invalid size // Invalid size
......
...@@ -30,13 +30,13 @@ public: ...@@ -30,13 +30,13 @@ public:
QImage calculateVectorscope(const QSize &vectorscopeSize, const QImage &image, const float &gain, QImage calculateVectorscope(const QSize &vectorscopeSize, const QImage &image, const float &gain,
const VectorscopeGenerator::PaintMode &paintMode, const VectorscopeGenerator::PaintMode &paintMode,
const VectorscopeGenerator::ColorSpace &colorSpace, const VectorscopeGenerator::ColorSpace &colorSpace,
const bool&, const uint &accelFactor = 1) const; bool, uint accelFactor = 1) const;
QPoint mapToCircle(const QSize &targetSize, const QPointF &point) const; QPoint mapToCircle(const QSize &targetSize, const QPointF &point) const;
static const float scaling; static const float scaling;
signals: signals:
void signalCalculationFinished(QImage image, const uint &ms); void signalCalculationFinished(const QImage &image, uint ms);
}; };
......
...@@ -29,7 +29,7 @@ WaveformGenerator::~WaveformGenerator() ...@@ -29,7 +29,7 @@ WaveformGenerator::~WaveformGenerator()
} }
QImage WaveformGenerator::calculateWaveform(const QSize &waveformSize, const QImage &image, WaveformGenerator::PaintMode paintMode, QImage WaveformGenerator::calculateWaveform(const QSize &waveformSize, const QImage &image, WaveformGenerator::PaintMode paintMode,
const bool &drawAxis, WaveformGenerator::Rec rec, const uint &accelFactor) bool drawAxis, WaveformGenerator::Rec rec, uint accelFactor)
{ {
Q_ASSERT(accelFactor >= 1); Q_ASSERT(accelFactor >= 1);
......
...@@ -27,7 +27,7 @@ public: ...@@ -27,7 +27,7 @@ public:
~WaveformGenerator(); ~WaveformGenerator();
QImage calculateWaveform(const QSize &waveformSize, const QImage &image, WaveformGenerator::PaintMode paintMode, QImage calculateWaveform(const QSize &waveformSize, const QImage &image, WaveformGenerator::PaintMode paintMode,
const bool &drawAxis, const WaveformGenerator::Rec rec, const uint &accelFactor = 1); bool drawAxis, const WaveformGenerator::Rec rec, uint accelFactor = 1);
//signals: //signals:
//void signalCalculationFinished(QImage image, const uint &ms); //void signalCalculationFinished(QImage image, const uint &ms);
......
...@@ -49,8 +49,8 @@ public slots: ...@@ -49,8 +49,8 @@ public slots:
void slotUpdateEffectParams(const QDomElement &e); void slotUpdateEffectParams(const QDomElement &e);
void slotUpdateParameterList(const QStringList &); void slotUpdateParameterList(const QStringList &);
signals: signals:
void removeEffect(ClipItem*, QDomElement); void removeEffect(ClipItem*, const QDomElement &);
void updateClipEffect(ClipItem*, QDomElement); void updateClipEffect(ClipItem*, const QDomElement &);
void parameterChanged(); void parameterChanged();
}; };
......
...@@ -2020,7 +2020,7 @@ void CustomTrackView::slotDropEffect(ClipItem *clip, QDomElement effect, GenTime ...@@ -2020,7 +2020,7 @@ void CustomTrackView::slotDropEffect(ClipItem *clip, QDomElement effect, GenTime
} }
} }
void CustomTrackView::slotAddEffect(QDomElement effect, GenTime pos, int track) void CustomTrackView::slotAddEffect(QDomElement effect, const GenTime &pos, int track)
{ {
QList<QGraphicsItem *> itemList; QList<QGraphicsItem *> itemList;
QUndoCommand *effectCommand = new QUndoCommand(); QUndoCommand *effectCommand = new QUndoCommand();
...@@ -2432,7 +2432,7 @@ void CustomTrackView::slotUpdateClipRegion(ClipItem *clip, int ix, QString regio ...@@ -2432,7 +2432,7 @@ void CustomTrackView::slotUpdateClipRegion(ClipItem *clip, int ix, QString regio
m_commandStack->push(command); m_commandStack->push(command);
} }
ClipItem *CustomTrackView::cutClip(ItemInfo info, GenTime cutTime, bool cut, EffectsList oldStack, bool execute) ClipItem *CustomTrackView::cutClip(const ItemInfo &info, const GenTime &cutTime, bool cut, const EffectsList &oldStack, bool execute)
{ {
if (cut) { if (cut) {
// cut clip // cut clip
...@@ -2666,7 +2666,7 @@ void CustomTrackView::slotAddTransition(ClipItem* /*clip*/, ItemInfo transitionI ...@@ -2666,7 +2666,7 @@ void CustomTrackView::slotAddTransition(ClipItem* /*clip*/, ItemInfo transitionI
setDocumentModified(); setDocumentModified();
} }
void CustomTrackView::addTransition(ItemInfo transitionInfo, int endTrack, QDomElement params, bool refresh) void CustomTrackView::addTransition(const ItemInfo &transitionInfo, int endTrack, const QDomElement &params, bool refresh)
{ {
Transition *tr = new Transition(transitionInfo, endTrack, m_document->fps(), params, true); Transition *tr = new Transition(transitionInfo, endTrack, m_document->fps(), params, true);
//kDebug() << "---- ADDING transition " << params.attribute("value"); //kDebug() << "---- ADDING transition " << params.attribute("value");
...@@ -2679,7 +2679,7 @@ void CustomTrackView::addTransition(ItemInfo transitionInfo, int endTrack, QDomE ...@@ -2679,7 +2679,7 @@ void CustomTrackView::addTransition(ItemInfo transitionInfo, int endTrack, QDomE
} }
} }
void CustomTrackView::deleteTransition(ItemInfo transitionInfo, int endTrack, QDomElement /*params*/, bool refresh) void CustomTrackView::deleteTransition(const ItemInfo &transitionInfo, int endTrack, QDomElement /*params*/, bool refresh)
{ {
Transition *item = getTransitionItemAt(transitionInfo.startPos, transitionInfo.track); Transition *item = getTransitionItemAt(transitionInfo.startPos, transitionInfo.track);
if (!item) { if (!item) {
...@@ -3049,7 +3049,7 @@ int CustomTrackView::duration() const ...@@ -3049,7 +3049,7 @@ int CustomTrackView::duration() const
return m_projectDuration; return m_projectDuration;
} }
void CustomTrackView::addTrack(TrackInfo type, int ix) void CustomTrackView::addTrack(const TrackInfo &type, int ix)
{ {
QList <TransitionInfo> transitionInfos; QList <TransitionInfo> transitionInfos;
if (ix == -1 || ix == m_document->tracksCount()) { if (ix == -1 || ix == m_document->tracksCount()) {
...@@ -4830,7 +4830,7 @@ bool CustomTrackView::moveClip(const ItemInfo &start, const ItemInfo &end, bool ...@@ -4830,7 +4830,7 @@ bool CustomTrackView::moveClip(const ItemInfo &start, const ItemInfo &end, bool
return success; return success;
} }
void CustomTrackView::moveGroup(QList <ItemInfo> startClip, QList <ItemInfo> startTransition, const GenTime &offset, const int trackOffset, bool reverseMove) void CustomTrackView::moveGroup(QList<ItemInfo> startClip, QList<ItemInfo> startTransition, const GenTime &offset, const int trackOffset, bool reverseMove)
{ {
// Group Items // Group Items
resetSelectionGroup(); resetSelectionGroup();
......
...@@ -55,7 +55,7 @@ public: ...@@ -55,7 +55,7 @@ public:
virtual void mouseReleaseEvent(QMouseEvent * event); virtual void mouseReleaseEvent(QMouseEvent * event);
virtual void mouseMoveEvent(QMouseEvent * event); virtual void mouseMoveEvent(QMouseEvent * event);
virtual void mouseDoubleClickEvent(QMouseEvent *event); virtual void mouseDoubleClickEvent(QMouseEvent *event);
void addTrack(TrackInfo type, int ix = -1); void addTrack(const TrackInfo &type, int ix = -1);
void removeTrack(int ix); void removeTrack(int ix);
/** @brief Makes the document use new track infos (name, type, ...). */ /** @brief Makes the document use new track infos (name, type, ...). */
void configTracks(const QList<TrackInfo> &trackInfos); void configTracks(const QList<TrackInfo> &trackInfos);
...@@ -68,7 +68,7 @@ public: ...@@ -68,7 +68,7 @@ public:
For example, attempting to move a clip to t = -1 s will actually move it to t = 0 s. For example, attempting to move a clip to t = -1 s will actually move it to t = 0 s.
*/ */
bool moveClip(const ItemInfo &start, const ItemInfo &end, bool refresh, ItemInfo *out_actualEnd = NULL); bool moveClip(const ItemInfo &start, const ItemInfo &end, bool refresh, ItemInfo *out_actualEnd = NULL);
void moveGroup(QList <ItemInfo> startClip, QList <ItemInfo> startTransition, const GenTime &offset, const int trackOffset, bool reverseMove = false); void moveGroup(QList<ItemInfo> startClip, QList<ItemInfo> startTransition, const GenTime &offset, const int trackOffset, bool reverseMove = false);
/** move transition, startPos = (old start, old end), endPos = (new start, new end) */ /** move transition, startPos = (old start, old end), endPos = (new start, new end) */
void moveTransition(const ItemInfo &start, const ItemInfo &end, bool refresh); void moveTransition(const ItemInfo &start, const ItemInfo &end, bool refresh);
void resizeClip(const ItemInfo &start, const ItemInfo &end, bool dontWorry = false); void resizeClip(const ItemInfo &start, const ItemInfo &end, bool dontWorry = false);
...@@ -83,7 +83,7 @@ public: ...@@ -83,7 +83,7 @@ public:
/** @brief An effect was dropped on @param clip */ /** @brief An effect was dropped on @param clip */
void slotDropEffect(ClipItem *clip, QDomElement effect, GenTime pos, int track); void slotDropEffect(ClipItem *clip, QDomElement effect, GenTime pos, int track);
/** @brief Add effect to current clip */ /** @brief Add effect to current clip */
void slotAddEffect(QDomElement effect, GenTime pos, int track); void slotAddEffect(QDomElement effect, const GenTime &pos, int track);
void slotAddGroupEffect(QDomElement effect, AbstractGroupItem *group, AbstractClipItem *dropTarget = NULL); void slotAddGroupEffect(QDomElement effect, AbstractGroupItem *group, AbstractClipItem *dropTarget = NULL);
void addEffect(int track, GenTime pos, QDomElement effect); void addEffect(int track, GenTime pos, QDomElement effect);
void deleteEffect(int track, GenTime pos, QDomElement effect); void deleteEffect(int track, GenTime pos, QDomElement effect);
...@@ -91,10 +91,9 @@ public: ...@@ -91,10 +91,9 @@ public:
/** @brief Enable / disable a list of effects */ /** @brief Enable / disable a list of effects */
void updateEffectState(int track, GenTime pos, QList <int> effectIndexes, bool disable, bool updateEffectStack); void updateEffectState(int track, GenTime pos, QList <int> effectIndexes, bool disable, bool updateEffectStack);
void moveEffect(int track, GenTime pos, QList <int> oldPos, QList <int> newPos); void moveEffect(int track, GenTime pos, QList <int> oldPos, QList <int> newPos);
void addTransition(ItemInfo transitionInfo, int endTrack, QDomElement params, bool refresh); void addTransition(const ItemInfo &transitionInfo, int endTrack, const QDomElement &params, bool refresh);
void deleteTransition(ItemInfo transitionInfo, int endTrack, QDomElement params, bool refresh); void deleteTransition(const ItemInfo &transitionInfo, int endTrack, QDomElement params, bool refresh);
void updateTransition(int track, GenTime pos, QDomElement oldTransition, QDomElement transition, bool updateTransitionWidget); void updateTransition(int track, GenTime pos, QDomElement oldTransition, QDomElement transition, bool updateTransitionWidget);
void moveTransition(GenTime oldpos, GenTime newpos);
void activateMonitor(); void activateMonitor();
int duration() const; int duration() const;
void deleteSelectedClips(); void deleteSelectedClips();
...@@ -105,7 +104,7 @@ public: ...@@ -105,7 +104,7 @@ public:
void updateSceneFrameWidth(); void updateSceneFrameWidth();
//QList <TrackInfo> tracksList() const; //QList <TrackInfo> tracksList() const;
void setTool(PROJECTTOOL tool); void setTool(PROJECTTOOL tool);
ClipItem *cutClip(ItemInfo info, GenTime cutTime, bool cut, EffectsList oldStack = EffectsList(), bool execute = true); ClipItem *cutClip(const ItemInfo &info, const GenTime &cutTime, bool cut, const EffectsList &oldStack = EffectsList(), bool execute = true);
void slotSeekToPreviousSnap(); void slotSeekToPreviousSnap();
void slotSeekToNextSnap(); void slotSeekToNextSnap();
double getSnapPointForPos(double pos); double getSnapPointForPos(double pos);
......
...@@ -34,8 +34,7 @@ BackupWidget::BackupWidget(const KUrl &projectUrl, const KUrl &projectFolder, co ...@@ -34,8 +34,7 @@ BackupWidget::BackupWidget(const KUrl &projectUrl, const KUrl &projectFolder, co
// No url, means we opened the backup dialog from an empty project // No url, means we opened the backup dialog from an empty project
info_label->setText(i18n("Showing all backup files in folder")); info_label->setText(i18n("Showing all backup files in folder"));
m_projectWildcard = '*'; m_projectWildcard = '*';
} } else {
else {
info_label->setText(i18n("Showing backup files for %1", projectUrl.fileName())); info_label->setText(i18n("Showing backup files for %1", projectUrl.fileName()));
m_projectWildcard = projectUrl.fileName().section('.', 0, -2); m_projectWildcard = projectUrl.fileName().section('.', 0, -2);
if (!projectId.isEmpty()) m_projectWildcard.append('-' + projectId); if (!projectId.isEmpty()) m_projectWildcard.append('-' + projectId);
...@@ -83,7 +82,7 @@ void BackupWidget::slotParseBackupFiles() ...@@ -83,7 +82,7 @@ void BackupWidget::slotParseBackupFiles()
QString label; QString label;
for (int i = 0; i < resultList.count(); ++i) { for (int i = 0; i < resultList.count(); ++i) {
label = resultList.at(i).lastModified().toString(Qt::SystemLocaleLongDate); label = resultList.at(i).lastModified().toString(Qt::SystemLocaleLongDate);
if (m_projectWildcard.startsWith('*')) { if (m_projectWildcard.startsWith(QLatin1Char('*'))) {
// Displaying all backup files, so add project name in the entries // Displaying all backup files, so add project name in the entries
label.prepend(resultList.at(i).fileName().section('-', 0, -7) + ".kdenlive - "); label.prepend(resultList.at(i).fileName().section('-', 0, -7) + ".kdenlive - ");
} }
...@@ -106,7 +105,8 @@ void BackupWidget::slotDisplayBackupPreview() ...@@ -106,7 +105,8 @@ void BackupWidget::slotDisplayBackupPreview()
QString BackupWidget::selectedFile() const QString BackupWidget::selectedFile() const
{ {
if (!backup_list->currentItem()) return QString(); if (!backup_list->currentItem())
return QString();
return backup_list->currentItem()->data(Qt::UserRole).toString(); return backup_list->currentItem()->data(Qt::UserRole).toString();
} }
......
...@@ -42,20 +42,20 @@ ...@@ -42,20 +42,20 @@
#include <kmessagebox.h> #include <kmessagebox.h>
DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QString &id) : DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QString &id) :
QObject(), QObject(),
lastSeekPosition(0), lastSeekPosition(0),
audioFrameCache(), audioFrameCache(),
m_refcount(0), m_refcount(0),
m_baseTrackProducers(), m_baseTrackProducers(),
m_videoTrackProducers(), m_videoTrackProducers(),
m_audioTrackProducers(), m_audioTrackProducers(),
m_snapMarkers(QList < CommentedTime >()), m_snapMarkers(QList < CommentedTime >()),
m_duration(), m_duration(),
m_thumbProd(NULL), m_thumbProd(NULL),
m_audioThumbCreated(false), m_audioThumbCreated(false),
m_id(id), m_id(id),
m_placeHolder(xml.hasAttribute("placeholder")), m_placeHolder(xml.hasAttribute("placeholder")),
m_properties() m_properties()
{ {
int type = xml.attribute("type").toInt(); int type = xml.attribute("type").toInt();
m_clipType = (CLIPTYPE) type; m_clipType = (CLIPTYPE) type;
...@@ -71,8 +71,8 @@ DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QStrin ...@@ -71,8 +71,8 @@ DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QStrin
for (int i = 0; i < metas.count(); ++i) { for (int i = 0; i < metas.count(); ++i) {
QDomElement e = metas.item(i).toElement(); QDomElement e = metas.item(i).toElement();
if (!e.isNull()) { if (!e.isNull()) {
m_metadata.insert(e.attribute("name").section('.', 2), QStringList() << e.firstChild().nodeValue() << e.attribute("tool")); m_metadata.insert(e.attribute("name").section('.', 2), QStringList() << e.firstChild().nodeValue() << e.attribute("tool"));
} }
} }
if (xml.hasAttribute("cutzones")) { if (xml.hasAttribute("cutzones")) {
QStringList cuts = xml.attribute("cutzones").split(';', QString::SkipEmptyParts); QStringList cuts = xml.attribute("cutzones").split(';', QString::SkipEmptyParts);
...@@ -83,9 +83,9 @@ DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QStrin ...@@ -83,9 +83,9 @@ DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QStrin
} }
if (xml.hasAttribute("analysisdata")) { if (xml.hasAttribute("analysisdata")) {
QStringList adata = xml.attribute("analysisdata").split('#', QString::SkipEmptyParts); QStringList adata = xml.attribute("analysisdata").split('#', QString::SkipEmptyParts);
for (int i = 0; i < adata.count(); ++i) for (int i = 0; i < adata.count(); ++i)
m_analysisdata.insert(adata.at(i).section('?', 0, 0), adata.at(i).section('?', 1, 1)); m_analysisdata.insert(adata.at(i).section('?', 0, 0), adata.at(i).section('?', 1, 1));
} }
KUrl url = KUrl(xml.attribute("resource")); KUrl url = KUrl(xml.attribute("resource"));
...@@ -96,7 +96,7 @@ DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QStrin ...@@ -96,7 +96,7 @@ DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QStrin
} else { } else {
int out = xml.attribute("out").toInt(); int out = xml.attribute("out").toInt();
int in = xml.attribute("in").toInt(); int in = xml.attribute("in").toInt();
if (out > in) setDuration(GenTime(out - in + 1, KdenliveSettings::project_fps())); if (out > in) setDuration(GenTime(out - in + 1, KdenliveSettings::project_fps()));
} }
if (!m_properties.contains("name")) m_properties.insert("name", url.fileName()); if (!m_properties.contains("name")) m_properties.insert("name", url.fileName());
...@@ -125,7 +125,7 @@ DocClipBase::~DocClipBase() ...@@ -125,7 +125,7 @@ DocClipBase::~DocClipBase()
m_videoTrackProducers.clear(); m_videoTrackProducers.clear();
} }
void DocClipBase::setZone(QPoint zone) void DocClipBase::setZone(const QPoint &zone)
{ {
m_properties.insert("zone_in", QString::number(zone.x())); m_properties.insert("zone_in", QString::number(zone.x()));
m_properties.insert("zone_out", QString::number(zone.y())); m_properties.insert("zone_out", QString::number(zone.y()));
...@@ -267,14 +267,14 @@ QDomElement DocClipBase::toXML(bool hideTemporaryProperties) const ...@@ -267,14 +267,14 @@ QDomElement DocClipBase::toXML(bool hideTemporaryProperties) const
while (j.hasNext()) { while (j.hasNext()) {
j.next(); j.next();
if (!j.value().isEmpty()) { if (!j.value().isEmpty()) {
QDomElement property = doc.createElement("metaproperty"); QDomElement property = doc.createElement("metaproperty");
property.setAttribute("name", "meta.attr." + j.key()); property.setAttribute("name", "meta.attr." + j.key());
QStringList values = j.value(); QStringList values = j.value();
QDomText value = doc.createTextNode(values.at(0)); QDomText value = doc.createTextNode(values.at(0));
if (values.count() > 1) property.setAttribute("tool", values.at(1)); if (values.count() > 1) property.setAttribute("tool", values.at(1));
property.appendChild(value); property.appendChild(value);
clip.appendChild(property); clip.appendChild(property);
} }
} }
doc.appendChild(clip); doc.appendChild(clip);
if (!m_cutZones.isEmpty()) { if (!m_cutZones.isEmpty()) {
...@@ -287,12 +287,12 @@ QDomElement DocClipBase::toXML(bool hideTemporaryProperties) const ...@@ -287,12 +287,12 @@ QDomElement DocClipBase::toXML(bool hideTemporaryProperties) const
} }
QString adata; QString adata;
if (!m_analysisdata.isEmpty()) { if (!m_analysisdata.isEmpty()) {
QMapIterator<QString, QString> i(m_analysisdata); QMapIterator<QString, QString> i(m_analysisdata);
while (i.hasNext()) { while (i.hasNext()) {
i.next(); i.next();
//WARNING: a ? and # separator is not a good idea //WARNING: a ? and # separator is not a good idea
adata.append(i.key() + "?" + i.value() + "#"); adata.append(i.key() + "?" + i.value() + "#");
} }
} }
clip.setAttribute("analysisdata", adata); clip.setAttribute("analysisdata", adata);
//kDebug() << "/// CLIP XML: " << doc.toString(); //kDebug() << "/// CLIP XML: " << doc.toString();
...@@ -301,17 +301,17 @@ QDomElement DocClipBase::toXML(bool hideTemporaryProperties) const ...@@ -301,17 +301,17 @@ QDomElement DocClipBase::toXML(bool hideTemporaryProperties) const
const QString DocClipBase::shortInfo() const const QString DocClipBase::shortInfo() const
{ {
QString info; QString info;
if (m_clipType == AV || m_clipType == VIDEO || m_clipType == IMAGE || m_clipType == PLAYLIST) { if (m_clipType == AV || m_clipType == VIDEO || m_clipType == IMAGE || m_clipType == PLAYLIST) {
info = m_properties.value("frame_size") + " "; info = m_properties.value("frame_size") + " ";
if (m_properties.contains("fps")) { if (m_properties.contains("fps")) {
info.append(i18n("%1 fps", m_properties.value("fps").left(5))); info.append(i18n("%1 fps", m_properties.value("fps").left(5)));