#include "jogshuttle.h"
#include "clipproperties.h"
#include "wizard.h"
+#include "editclipcommand.h"
+#include "titlewidget.h"
static const int ID_STATUS_MSG = 1;
static const int ID_EDITMODE_MSG = 2;
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() {
if (!initialGroup.exists()) {
// this is our first run, show Wizard
Wizard *w = new Wizard(this);
- if (w->exec() == QDialog::Accepted) {
+ if (w->exec() == QDialog::Accepted && w->isOk()) {
w->adjustSettings();
initialGroup.writeEntry("version", "0.7");
+ delete w;
+ } else {
+ delete w;
+ // TODO: find a better way to exit application faster
+ QTimer::singleShot(1000, this, SLOT(queryQuit()));
}
- delete w;
}
}
void MainWindow::newFile() {
QString profileName;
KUrl projectFolder;
+ QPoint projectTracks(3, 2);
if (m_timelineArea->count() == 0) profileName = KdenliveSettings::default_profile();
else {
ProjectSettings *w = new ProjectSettings;
if (w->exec() != QDialog::Accepted) return;
profileName = w->selectedProfile();
projectFolder = w->selectedFolder();
+ projectTracks = w->tracks();
delete w;
}
- KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, m_commandStack, profileName, this);
+ KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, m_commandStack, profileName, projectTracks, this);
doc->m_autosave = new KAutoSaveFile(KUrl(), doc);
TrackView *trackView = new TrackView(doc, this);
m_timelineArea->addTab(trackView, KIcon("kdenlive"), doc->description());
void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale) {
KdenliveDoc *doc;
- doc = new KdenliveDoc(url, KUrl(), m_commandStack, QString(), this);
+ doc = new KdenliveDoc(url, KUrl(), m_commandStack, QString(), QPoint(3, 2), this);
if (stale == NULL) {
stale = new KAutoSaveFile(url, doc);
doc->m_autosave = stale;
if (KdenliveSettings::rendererpath().isEmpty()) {
// Cannot find the MLT inigo renderer, ask for location
- KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(), i18n("Cannot find the inigo program required for rendering (part of Mlt)"), this);
+ KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(QString(), i18n("Cannot find the inigo program required for rendering (part of Mlt)"), this);
getUrl->exec();
KUrl rendererPath = getUrl->selectedUrl();
delete getUrl;
void MainWindow::slotRenderProject() {
if (!m_renderWidget) {
m_renderWidget = new RenderWidget(this);
- connect(m_renderWidget, SIGNAL(doRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool)), this, SLOT(slotDoRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool)));
+ connect(m_renderWidget, SIGNAL(doRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double)), this, SLOT(slotDoRender(const QString&, const QString&, const QStringList &, const QStringList &, bool, bool, double, double)));
+ if (m_activeDocument) m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
}
/*TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
if (currentTab) m_renderWidget->setTimeline(currentTab);
m_renderWidget->show();
}
-void MainWindow::slotDoRender(const QString &dest, const QString &render, const QStringList &overlay_args, const QStringList &avformat_args, bool zoneOnly, bool playAfter) {
+void MainWindow::slotDoRender(const QString &dest, const QString &render, const QStringList &overlay_args, const QStringList &avformat_args, bool zoneOnly, bool playAfter, double guideStart, double guideEnd) {
if (dest.isEmpty()) return;
int in;
int out;
QStringList args;
args << "-erase";
if (zoneOnly) args << "in=" + QString::number(in) << "out=" + QString::number(out);
+ else if (guideStart != -1) {
+ args << "in=" + QString::number(GenTime(guideStart).frames(m_activeDocument->fps())) << "out=" + QString::number(GenTime(guideEnd).frames(m_activeDocument->fps()));
+ }
if (!overlay_args.isEmpty()) args << "preargs=" + overlay_args.join(" ");
QString videoPlayer = "-";
if (playAfter) {
m_activeDocument->backupMltPlaylist();
if (m_activeTimeline) {
disconnect(m_projectMonitor, SIGNAL(renderPosition(int)), m_activeTimeline, SLOT(moveCursorPos(int)));
+ disconnect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), trackView, SLOT(slotSetZone(QPoint)));
disconnect(m_projectMonitor, SIGNAL(durationChanged(int)), m_activeTimeline, SLOT(setDuration(int)));
disconnect(m_projectList, SIGNAL(projectModified()), m_activeDocument, SLOT(setModified()));
+ disconnect(m_activeDocument, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
disconnect(m_activeDocument, SIGNAL(addProjectClip(DocClipBase *)), m_projectList, SLOT(slotAddClip(DocClipBase *)));
disconnect(m_activeDocument, SIGNAL(addProjectFolder(const QString, const QString &, bool, bool)), m_projectList, SLOT(slotAddFolder(const QString, const QString &, bool, bool)));
disconnect(m_activeDocument, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
disconnect(m_activeDocument, SIGNAL(updateClipDisplay(const QString &)), m_projectList, SLOT(slotUpdateClip(const QString &)));
- disconnect(m_activeDocument, SIGNAL(refreshClipThumbnail(const QString &)), m_projectList, SLOT(slotRefreshClipThumbnail(const QString &)));
disconnect(m_activeDocument, SIGNAL(selectLastAddedClip(const QString &)), m_projectList, SLOT(slotSelectClip(const QString &)));
disconnect(m_activeDocument, SIGNAL(deleteTimelineClip(const QString &)), m_activeTimeline, SLOT(slotDeleteClip(const QString &)));
disconnect(m_activeTimeline, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*)));
disconnect(effectStack, SIGNAL(refreshEffectStack(ClipItem*)), m_activeTimeline->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
disconnect(effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
disconnect(transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), trackView->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
+ disconnect(transitionConfig, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(setCursorPos(int)));
disconnect(m_activeTimeline->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
+ disconnect(trackView, SIGNAL(zoneMoved(int, int)), m_projectMonitor, SLOT(slotZoneMoved(int, int)));
effectStack->clear();
}
m_activeDocument->setRenderer(NULL);
connect(trackView, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
connect(trackView, SIGNAL(mousePosition(int)), this, SLOT(slotUpdateMousePosition(int)));
connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int)));
+ connect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), trackView, SLOT(slotSetZone(QPoint)));
connect(m_projectMonitor, SIGNAL(durationChanged(int)), trackView, SLOT(setDuration(int)));
connect(doc, SIGNAL(addProjectClip(DocClipBase *)), m_projectList, SLOT(slotAddClip(DocClipBase *)));
connect(doc, SIGNAL(addProjectFolder(const QString, const QString &, bool, bool)), m_projectList, SLOT(slotAddFolder(const QString, const QString &, bool, bool)));
connect(doc, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
connect(doc, SIGNAL(updateClipDisplay(const QString &)), m_projectList, SLOT(slotUpdateClip(const QString &)));
- connect(doc, SIGNAL(refreshClipThumbnail(const QString &)), m_projectList, SLOT(slotRefreshClipThumbnail(const QString &)));
connect(doc, SIGNAL(selectLastAddedClip(const QString &)), m_projectList, SLOT(slotSelectClip(const QString &)));
connect(doc, SIGNAL(deleteTimelineClip(const QString &)), trackView, SLOT(slotDeleteClip(const QString &)));
connect(doc, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
-
+ connect(doc, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
connect(trackView, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*)));
connect(effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int)), trackView->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int)));
connect(effectStack, SIGNAL(refreshEffectStack(ClipItem*)), trackView->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
connect(transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), trackView->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
+ connect(transitionConfig, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(setCursorPos(int)));
connect(effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
connect(trackView->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
+ connect(trackView, SIGNAL(zoneMoved(int, int)), m_projectMonitor, SLOT(slotZoneMoved(int, int)));
+
trackView->projectView()->setContextMenu(m_timelineContextMenu, m_timelineContextClipMenu, m_timelineContextTransitionMenu);
m_activeTimeline = trackView;
if (m_renderWidget) m_renderWidget->setDocumentStandard(doc->getDocumentStandard());
m_activeDocument = doc;
}
+void MainWindow::slotGuidesUpdated() {
+ if (m_renderWidget) m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
+}
+
void MainWindow::slotPreferences(int page, int option) {
//An instance of your dialog could be already created and could be
// cached, in which case you want to display the cached dialog
void MainWindow::slotShowClipProperties(DocClipBase *clip) {
if (clip->clipType() == TEXT) {
- m_activeDocument->editTextClip(clip->getProperty("xml"), clip->getId());
+ QString path = clip->getProperty("xml");
+ TitleWidget *dia_ui = new TitleWidget(KUrl()/*path + ".kdenlivetitle")*/, path, m_projectMonitor->render, this);
+ QDomDocument doc;
+ doc.setContent(clip->getProperty("xmldata"));
+ dia_ui->setXml(doc);
+ if (dia_ui->exec() == QDialog::Accepted) {
+ kDebug() << "// UPDATUING CLIP TITLE: " << path;
+ QPixmap pix = dia_ui->renderedPixmap();
+ pix.save(path + ".png");
+ //slotAddClipFile(KUrl("/tmp/kdenlivetitle.png"), QString(), -1);
+ //m_clipManager->slotEditTextClipFile(id, dia_ui->xml().toString());
+ QMap <QString, QString> newprops;
+ newprops.insert("xmldata", dia_ui->xml().toString());
+ EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
+ m_activeDocument->commandStack()->push(command);
+ //setModified(true);
+ }
+ delete dia_ui;
+
+ //m_activeDocument->editTextClip(clip->getProperty("xml"), clip->getId());
return;
}
ClipProperties dia(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
connect(&dia, SIGNAL(addMarker(const QString &, GenTime, QString)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(const QString &, GenTime, QString)));
if (dia.exec() == QDialog::Accepted) {
- m_projectList->slotUpdateClipProperties(dia.clipId(), dia.properties());
+ EditClipCommand *command = new EditClipCommand(m_projectList, dia.clipId(), clip->properties(), dia.properties(), true);
+ m_activeDocument->commandStack()->push(command);
+
+ //m_projectList->slotUpdateClipProperties(dia.clipId(), dia.properties());
if (dia.needsTimelineRefresh()) {
// update clip occurences in timeline
m_activeTimeline->projectView()->slotUpdateClip(dia.clipId());
}
}
+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"