connect(m_clipMonitor, SIGNAL(adjustMonitorSize()), this, SLOT(slotAdjustClipMonitor()));
connect(m_projectMonitor, SIGNAL(adjustMonitorSize()), this, SLOT(slotAdjustProjectMonitor()));
+
+ connect(m_clipMonitor, SIGNAL(saveZone(Render *, QPoint)), this, SLOT(slotSaveZone(Render *, QPoint)));
+ connect(m_projectMonitor, SIGNAL(saveZone(Render *, QPoint)), this, SLOT(slotSaveZone(Render *, QPoint)));
}
void MainWindow::slotAdjustClipMonitor() {
}
}
+void MainWindow::slotSaveZone(Render *render, QPoint zone) {
+ KDialog *dialog = new KDialog(this);
+ dialog->setCaption("Save clip zone");
+ dialog->setButtons(KDialog::Ok | KDialog::Cancel);
+
+ QWidget *widget = new QWidget(dialog);
+ dialog->setMainWidget(widget);
+
+ QVBoxLayout *vbox = new QVBoxLayout(widget);
+ QLabel *label1 = new QLabel(i18n("Save clip zone as:"), this);
+ QString path = m_activeDocument->projectFolder().path();
+ path.append("/");
+ path.append("untitled.westley");
+ KUrlRequester *url = new KUrlRequester(KUrl(path), this);
+ url->setFilter("video/mlt-playlist");
+ QLabel *label2 = new QLabel(i18n("Description:"), this);
+ KLineEdit *edit = new KLineEdit(this);
+ vbox->addWidget(label1);
+ vbox->addWidget(url);
+ vbox->addWidget(label2);
+ vbox->addWidget(edit);
+ if (dialog->exec() == QDialog::Accepted) render->saveZone(url->url(), edit->text(), zone);
+
+}
+
#include "mainwindow.moc"
class RenderWidget;
class JogShuttle;
class DocClipBase;
+class Render;
class MainWindow : public KXmlGuiWindow {
Q_OBJECT
void slotAdjustClipMonitor();
void slotAdjustProjectMonitor();
+ void slotSaveZone(Render *render, QPoint zone);
};
m_contextMenu = new QMenu(this);
m_contextMenu->addMenu(playMenu);
-
QMenu *goMenu = new QMenu(i18n("Go to..."), this);
goMenu->addAction(i18n("Start"), this, SLOT(slotStart()));
goMenu->addAction(i18n("End"), this, SLOT(slotEnd()));
goMenu->addAction(i18n("Zone start"), this, SLOT(slotZoneStart()));
goMenu->addAction(i18n("Zone end"), this, SLOT(slotZoneEnd()));
- m_contextMenu->addMenu(goMenu);
-
- m_contextMenu->addAction(zoneStart);
- m_contextMenu->addAction(zoneEnd);
- QAction *extractFrame = m_contextMenu->addAction(KIcon("document-new"), i18n("Extract frame"), this, SLOT(slotExtractCurrentFrame()));
connect(m_ruler, SIGNAL(seekRenderer(int)), this, SLOT(slotSeek(int)));
connect(m_ruler, SIGNAL(zoneChanged(QPoint)), this, SIGNAL(zoneUpdated(QPoint)));
connect(render, SIGNAL(durationChanged(int)), this, SLOT(adjustRulerSize(int)));
connect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
connect(render, SIGNAL(rendererStopped(int)), this, SLOT(rendererStopped(int)));
+ configMenu->addSeparator();
+ configMenu->addAction(KIcon("transform-scale"), i18n("Resize (100%)"), this, SLOT(slotSetSizeOneToOne()));
+ configMenu->addAction(KIcon("transform-scale"), i18n("Resize (50%)"), this, SLOT(slotSetSizeOneToTwo()));
+ //render->createVideoXWindow(ui.video_frame->winId(), -1);
+ m_length = 0;
+
+ m_contextMenu->addMenu(goMenu);
+ m_contextMenu->addAction(zoneStart);
+ m_contextMenu->addAction(zoneEnd);
+ //TODO: add save zone to timeline monitor when fixed
+ if (name == "clip") m_contextMenu->addAction(KIcon("document-save"), i18n("Save zone"), this, SLOT(slotSaveZone()));
+
+ QAction *extractFrame = m_contextMenu->addAction(KIcon("document-new"), i18n("Extract frame"), this, SLOT(slotExtractCurrentFrame()));
configMenu->addAction(extractFrame);
+
if (name != "clip") {
connect(render, SIGNAL(rendererPosition(int)), this, SIGNAL(renderPosition(int)));
connect(render, SIGNAL(durationChanged(int)), this, SIGNAL(durationChanged(int)));
QAction *setThumbFrame = m_contextMenu->addAction(KIcon("document-new"), i18n("Set current image as thumbnail"), this, SLOT(slotSetThumbFrame()));
configMenu->addAction(setThumbFrame);
}
- configMenu->addSeparator();
- configMenu->addAction(KIcon("transform-scale"), i18n("Resize (100%)"), this, SLOT(slotSetSizeOneToOne()));
- configMenu->addAction(KIcon("transform-scale"), i18n("Resize (50%)"), this, SLOT(slotSetSizeOneToTwo()));
- //render->createVideoXWindow(ui.video_frame->winId(), -1);
- m_length = 0;
+
m_monitorRefresh->show();
kDebug() << "/////// BUILDING MONITOR, ID: " << ui.video_frame->winId();
}
render->setSceneList(doc, 0);
}
+void Monitor::slotSaveZone() {
+ if (render == NULL) return;
+ emit saveZone(render, m_ruler->zone());
+
+ //render->setSceneList(doc, 0);
+}
+
+
void Monitor::resetProfile() {
if (render == NULL) return;
render->resetProfile();
void slotSetSizeOneToTwo();
void slotSetZoneStart();
void slotSetZoneEnd();
+ void slotSaveZone();
public slots:
void slotOpenFile(const QString &);
void refreshClipThumbnail(const QString &);
void adjustMonitorSize();
void zoneUpdated(QPoint);
+ void saveZone(Render *, QPoint);
};
#endif
if (split) slotSplitView(false);
westleyConsumer.connect(prod);
//prod.set("title", "kdenlive document");
- //westleyConsumer.listen("consumer-frame-show", this, (mlt_listener) consumer_frame_show);
westleyConsumer.start();
while (!westleyConsumer.is_stopped()) {}
if (!kdenliveData.isNull()) {
}
+void Render::saveZone(KUrl url, QString desc, QPoint zone) {
+ kDebug() << "// SAVING CLIP ZONE, RENDER: " << m_name;
+ char *tmppath = decodedString("westley:" + url.path());
+ Mlt::Consumer westleyConsumer(*m_mltProfile , tmppath);
+ m_mltProducer->optimise();
+ delete[] tmppath;
+ westleyConsumer.set("terminate_on_pause", 1);
+ if (m_name == "clip") {
+ Mlt::Producer *prod = m_mltProducer->cut(zone.x(), zone.y());
+ tmppath = decodedString(desc);
+ Mlt::Playlist list;
+ list.insert_at(0, prod, 0);
+ list.set("title", tmppath);
+ delete[] tmppath;
+ westleyConsumer.connect(list);
+
+ } else {
+ //TODO: not working yet, save zone from timeline
+ Mlt::Producer *p1 = new Mlt::Producer(m_mltProducer->get_producer());
+ /* Mlt::Service service(p1->parent().get_service());
+ if (service.type() != tractor_type) kWarning() << "// TRACTOR PROBLEM";*/
+
+ //Mlt::Producer *prod = p1->cut(zone.x(), zone.y());
+ tmppath = decodedString(desc);
+ //prod->set("title", tmppath);
+ delete[] tmppath;
+ westleyConsumer.connect(*p1); //list);
+ }
+
+ westleyConsumer.start();
+}
+
const double Render::fps() const {
return m_fps;
}
fileConsumer.connect(service);
fileConsumer.start();
-
}
#include "renderer.moc"
void playZone(const GenTime & startTime, const GenTime & stopTime);
void loopZone(const GenTime & startTime, const GenTime & stopTime);
+ void saveZone(KUrl url, QString desc, QPoint zone);
+
/** Returns the name of the renderer. */
const QString & rendererName() const;