]> git.sesse.net Git - kdenlive/commitdiff
Another attempt to fix effects order problem, issue:
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 23 Oct 2008 17:32:30 +0000 (17:32 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 23 Oct 2008 17:32:30 +0000 (17:32 +0000)
http://www.kdenlive.org:80/mantis/view.php?id=236

svn path=/branches/KDE4/; revision=2545

src/clipitem.cpp
src/clipitem.h
src/renderer.cpp

index 5321b0dcb1cfbbb9019cb7215a15cff93b129259..e6a89cea0abc8d81addd2f0de6362a7ae824ac12 100644 (file)
@@ -41,7 +41,7 @@
 
 
 ClipItem::ClipItem(DocClipBase *clip, ItemInfo info, double fps, bool generateThumbs)
-        : AbstractClipItem(info, QRectF(), fps), m_clip(clip), m_resizeMode(NONE), m_grabPoint(0), m_maxTrack(0), m_hasThumbs(false), startThumbTimer(NULL), endThumbTimer(NULL), m_effectsCounter(1), audioThumbWasDrawn(false), m_opacity(1.0), m_timeLine(0), m_startThumbRequested(false), m_endThumbRequested(false), m_startFade(0), m_endFade(0), m_hover(false), m_selectedEffect(-1), m_speed(1.0), framePixelWidth(0), m_startPix(QPixmap()), m_endPix(QPixmap()) {
+        : AbstractClipItem(info, QRectF(), fps), m_clip(clip), m_resizeMode(NONE), m_grabPoint(0), m_maxTrack(0), m_hasThumbs(false), startThumbTimer(NULL), endThumbTimer(NULL), audioThumbWasDrawn(false), m_opacity(1.0), m_timeLine(0), m_startThumbRequested(false), m_endThumbRequested(false), m_startFade(0), m_endFade(0), m_hover(false), m_selectedEffect(-1), m_speed(1.0), framePixelWidth(0), m_startPix(QPixmap()), m_endPix(QPixmap()) {
     setRect(0, 0, (info.endPos - info.startPos).frames(fps) - 0.02, (qreal)(KdenliveSettings::trackheight() - 2));
     setPos((qreal) info.startPos.frames(fps), (qreal)(info.track * KdenliveSettings::trackheight()) + 1);
 
@@ -993,7 +993,7 @@ QVariant ClipItem::itemChange(GraphicsItemChange change, const QVariant &value)
 }*/
 
 int ClipItem::effectsCounter() {
-    return m_effectsCounter++;
+    return effectsCount() + 1;
 }
 
 int ClipItem::effectsCount() {
@@ -1015,6 +1015,7 @@ QDomElement ClipItem::effectAt(int ix) {
 
 void ClipItem::setEffectAt(int ix, QDomElement effect) {
     kDebug() << "CHange EFFECT AT: " << ix << ", CURR: " << m_effectList.at(ix).attribute("tag") << ", NEW: " << effect.attribute("tag");
+    effect.setAttribute("kdenlive_ix", ix + 1);
     m_effectList.insert(ix, effect);
     m_effectList.removeAt(ix + 1);
     m_effectNames = m_effectList.effectNames().join(" / ");
@@ -1134,8 +1135,10 @@ QHash <QString, QString> ClipItem::getEffectArgs(QDomElement effect) {
 
 void ClipItem::deleteEffect(QString index) {
     bool needRepaint = false;
+    QString ix;
     for (int i = 0; i < m_effectList.size(); ++i) {
-        if (m_effectList.at(i).attribute("kdenlive_ix") == index) {
+        ix = m_effectList.at(i).attribute("kdenlive_ix");
+        if (ix == index) {
             if (m_effectList.at(i).attribute("id") == "fadein") {
                 m_startFade = 0;
                 needRepaint = true;
@@ -1144,8 +1147,7 @@ void ClipItem::deleteEffect(QString index) {
                 needRepaint = true;
             }
             m_effectList.removeAt(i);
-            break;
-        }
+        } else if (ix.toInt() > index.toInt()) m_effectList[i].setAttribute("kdenlive_ix", ix.toInt() - 1);
     }
     m_effectNames = m_effectList.effectNames().join(" / ");
     if (needRepaint) update(boundingRect());
index 84b89a47577f54a2f6d5f888cb907da84be546e5..f66004ea08d2d549d6df7b185177d1674cf08a42 100644 (file)
@@ -127,8 +127,6 @@ private:
     QTimer *startThumbTimer;
     QTimer *endThumbTimer;
 
-    /** counter used to provide a unique id to each effect */
-    int m_effectsCounter;
     int m_selectedEffect;
     double m_opacity;
     QTimeLine *m_timeLine;
index ea763c051ba1d7e21dda93f76088b4b5e7174acf..3dbf990fdf7916babfa18c09461b2962d01b5f62 100644 (file)
@@ -1756,7 +1756,7 @@ void Render::mltMoveEffect(int track, GenTime position, int oldPos, int newPos)
         while (filter) {
             int pos = QString(filter->get("kdenlive_ix")).toInt();
             if (pos >= newPos) {
-                if (pos < oldPos) filter->set("kdenlive_ix", QString(filter->get("kdenlive_ix")).toInt() + 1);
+                if (pos < oldPos) filter->set("kdenlive_ix", pos + 1);
                 filtersList.append(filter);
                 clipService.detach(*filter);
             } else ct++;