]> git.sesse.net Git - kdenlive/commitdiff
Add reverse clip to clip actions: http://kdenlive.org/mantis/view.php?id=2933
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 4 Apr 2013 13:28:32 +0000 (15:28 +0200)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 4 Apr 2013 13:29:52 +0000 (15:29 +0200)
src/dvdwizardmenu.cpp
src/mainwindow.cpp
src/projectlist.cpp
src/projectlist.h

index abfc780a24c9b25e00aeda287b6cbea318cee620..c0e86f852d76bddb2cd532643c09879943d4dcba 100644 (file)
@@ -458,7 +458,7 @@ void DvdWizardMenu::buildImage()
        QString profileName = DvdWizardVob::getDvdProfile(m_format);
        Mlt::Profile profile(profileName.toUtf8().constData());
        profile.set_explicit(true);
-       Mlt::Producer *producer = new Mlt::Producer(profile, m_view.background_image->url().path().toUtf8().data());
+       Mlt::Producer *producer = new Mlt::Producer(profile, m_view.background_image->url().path().toUtf8().constData());
        if (producer && producer->is_valid()) {
            pix = QPixmap::fromImage(KThumb::getFrame(producer, 0, m_finalSize.width(), m_width, m_height));
            m_movieLength = producer->get_length();
index 014bb9a5e2b6dc0679d517e51f111f187e9af980..9847a34ccb65bfc659333213ab2a586344956518 100644 (file)
@@ -4052,6 +4052,11 @@ void MainWindow::loadClipActions()
                            connect(action,SIGNAL(triggered()), this, SLOT(slotStartClipAction()));
                        }
                }
+               if (KdenliveSettings::producerslist().contains("framebuffer")) {
+                       QAction *action=actionMenu->addAction(i18n("Reverse clip"));
+                       action->setData("framebuffer");
+                       connect(action,SIGNAL(triggered()), this, SLOT(slotStartClipAction()));
+               }
        }
 
 }
index 860b9b4383889b941964b48f3d576cc9265221dd..ee1feaaf196f8c2264153d9b0ee1c00ea7a8d278 100644 (file)
@@ -3603,6 +3603,44 @@ void ProjectList::startClipFilterJob(const QString &filterName, const QString &c
     else {
         destination = ids.values();
     }
+    if (filterName == "framebuffer") {
+       Mlt::Profile profile;
+       QStringList keys = ids.keys();
+       int ix = 0;
+       foreach(const QString &url, destination) {
+           QString prodstring = QString("framebuffer:" + url + "?-1");
+           Mlt::Producer *reversed = new Mlt::Producer(profile, prodstring.toUtf8().constData());
+           if (!reversed || !reversed->is_valid()) {
+               emit displayMessage(i18n("Cannot reverse clip"), -2, ErrorMessage);
+               continue;
+           }
+           QString dest = url + ".mlt";
+           if (QFile::exists(dest)) {
+               if (KMessageBox::questionYesNo(this, i18n("File %1 already exists.\nDo you want to overwrite it?", dest)) == KMessageBox::No) continue;
+           }
+           Mlt::Consumer *cons = new Mlt::Consumer(profile, "xml", dest.toUtf8().constData());
+           if (cons == NULL || !cons->is_valid()) {
+               emit displayMessage(i18n("Cannot render reversed clip"), -2, ErrorMessage);
+               continue;
+           }
+           Mlt::Playlist list;
+           list.insert_at(0, reversed, 0);
+           delete reversed;
+           cons->connect(list);
+           cons->run();
+           delete cons;
+           QString groupId;
+           QString groupName;
+           DocClipBase *base = m_doc->clipManager()->getClipById(keys.at(ix));
+           if (base) {
+               groupId = base->getProperty("groupid");
+               groupName = base->getProperty("groupname");
+           }
+           emit addClip(dest, groupId, groupName);
+           ix++;
+       }
+       return;
+    }
     
     if (filterName == "motion_est") {
        // Show config dialog
index 6f763906afc9b7f409d54629eac8ce2791427967..25a222d9949a56707e4fcac5245cb6f9936ef8d7 100644 (file)
@@ -60,6 +60,7 @@
 #else
 // Dummy KMessageWidget to allow compilation of MyMessageWidget class since Qt's moc doesn work inside #ifdef
 #include <QLabel>
+
 class KMessageWidget: public QLabel
 {
 public: