]> git.sesse.net Git - kdenlive/blobdiff - src/trackview.cpp
remove some useless debug
[kdenlive] / src / trackview.cpp
index 854bc09f38398fca26b6b9153034e729a23834da..9b95d97032e77d223bb226ce58a809898e447643 100644 (file)
@@ -106,8 +106,7 @@ TrackView::TrackView(KdenliveDoc *doc, bool *ok, QWidget *parent) :
     connect(m_trackview, SIGNAL(updateTrackHeaders()), this, SLOT(slotRepaintTracks()));
 
     parseDocument(m_doc->toXml());
-    int error = m_doc->setSceneList();
-    if (error == -1) *ok = false;
+    if (m_doc->setSceneList() == -1) *ok = false;
     else *ok = true;
     connect(m_trackview, SIGNAL(cursorMoved(int, int)), m_ruler, SLOT(slotCursorMoved(int, int)));
     connect(m_trackview->horizontalScrollBar(), SIGNAL(valueChanged(int)), m_ruler, SLOT(slotMoveRuler(int)));
@@ -124,6 +123,18 @@ TrackView::~TrackView()
     delete m_trackview;
 }
 
+//virtual
+void TrackView::keyPressEvent(QKeyEvent * event)
+{
+    if (event->key() == Qt::Key_Up) {
+        m_trackview->slotTrackUp();
+        event->accept();
+    } else if (event->key() == Qt::Key_Down) {
+        m_trackview->slotTrackDown();
+        event->accept();
+    } else QWidget::keyPressEvent(event);
+}
+
 int TrackView::duration() const
 {
     return m_trackview->duration();
@@ -295,6 +306,13 @@ void TrackView::parseDocument(QDomDocument doc)
                 else if (paramName == "force_track" && p.text() == "1") forceTrack = true;
             }
         }
+        if (a_track == b_track || b_track == 0) {
+            // invalid transition, remove it
+            m_documentErrors.append(i18n("Removed invalid transition: %1", e.attribute("id")) + '\n');
+            tractor.removeChild(transitions.item(i));
+            i--;
+            continue;
+        }
         if (transitionAdd || mlt_service != "mix") {
             // Transition should be added to the scene
             ItemInfo transitionInfo;
@@ -512,7 +530,7 @@ void TrackView::slotRebuildTrackHeaders()
         connect(header, SIGNAL(switchTrackVideo(int)), m_trackview, SLOT(slotSwitchTrackVideo(int)));
         connect(header, SIGNAL(switchTrackAudio(int)), m_trackview, SLOT(slotSwitchTrackAudio(int)));
         connect(header, SIGNAL(switchTrackLock(int)), m_trackview, SLOT(slotSwitchTrackLock(int)));
-
+        connect(header, SIGNAL(selectTrack(int)), m_trackview, SLOT(slotSelectTrack(int)));
         connect(header, SIGNAL(deleteTrack(int)), this, SIGNAL(deleteTrack(int)));
         connect(header, SIGNAL(insertTrack(int)), this, SIGNAL(insertTrack(int)));
         connect(header, SIGNAL(changeTrack(int)), this, SIGNAL(changeTrack(int)));
@@ -616,7 +634,6 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool locked)
                 if (locked) item->setItemLocked(true);
                 clip->addReference();
                 position += (out - in + 1);
-                kDebug() << "/////////\n\n\n" << "CLIP SPEED: " << speed << ", " << strobe << "\n\n\n/////////////////////";
                 if (speed != 1.0 || strobe > 1) {
                     QDomElement speedeffect = MainWindow::videoEffects.getEffectByTag(QString(), "speed").cloneNode().toElement();
                     EffectsList::setParameter(speedeffect, "speed", QString::number((int)(100 * speed + 0.5)));
@@ -773,7 +790,15 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool locked)
                                             if (factor.startsWith('%')) {
                                                 fact = ProfilesDialog::getStringEval(m_doc->mltProfile(), factor);
                                             } else fact = factor.toDouble();
-                                            e.setAttribute("value", paramvalue.toDouble() * fact);
+                                            if (e.attribute("type") == "simplekeyframe") {
+                                                QStringList kfrs = paramvalue.split(";");
+                                                for (int l = 0; l < kfrs.count(); l++) {
+                                                    QString fr = kfrs.at(l).section("=", 0, 0);
+                                                    double val = kfrs.at(l).section("=", 1, 1).toDouble();
+                                                    kfrs[l] = fr + ":" + QString::number((int)(val * fact));
+                                                }
+                                                e.setAttribute("keyframes", kfrs.join(";"));
+                                            } else e.setAttribute("value", paramvalue.toDouble() * fact);
                                         } else e.setAttribute("value", paramvalue);
                                         break;
                                     }